add SMBFS_ATTRTIMO for the attribute cache timeout, instead of magic

number

bump the timeout to 5s; eventually we'd want to do some heuristics similar
to NFS, i.e. make the attribute cache timeout longer for files nor recently
changed
This commit is contained in:
jdolecek 2003-02-27 09:14:25 +00:00
parent c2793620f8
commit fe1daad52a
2 changed files with 8 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_node.c,v 1.13 2003/02/25 09:09:31 jdolecek Exp $ */
/* $NetBSD: smbfs_node.c,v 1.14 2003/02/27 09:14:26 jdolecek Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.13 2003/02/25 09:09:31 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.14 2003/02/27 09:14:26 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -319,12 +319,13 @@ smbfs_attr_cachelookup(struct vnode *vp, struct vattr *va)
{
struct smbnode *np = VTOSMB(vp);
struct smbmount *smp = VTOSMBFS(vp);
int s, diff;
int s;
time_t diff;
s = splclock();
diff = mono_time.tv_sec - np->n_attrage;
splx(s);
if (diff > 2) /* XXX should be configurable */
if (diff > SMBFS_ATTRTIMO) /* XXX should be configurable */
return ENOENT;
va->va_type = vp->v_type; /* vnode type (for create) */

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_node.h,v 1.6 2003/02/24 21:52:53 jdolecek Exp $ */
/* $NetBSD: smbfs_node.h,v 1.7 2003/02/27 09:14:25 jdolecek Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@ -48,6 +48,8 @@
/*efine NNEW 0x0008*//* smb/vnode has been allocated */
#define NREFPARENT 0x0010 /* node holds parent from recycling */
#define SMBFS_ATTRTIMO 5 /* Attribute cache timeout in sec */
struct smbfs_fctx;
struct smbnode {
@ -92,10 +94,6 @@ int smbfs_nget(struct mount *mp, struct vnode *dvp, const char *name, int nmlen,
struct smbfattr *fap, struct vnode **vpp);
#define smbfs_hash(x, y) hash32_strn((x), (y), HASH32_STR_INIT)
#ifndef __NetBSD__
int smbfs_getpages(void *);
int smbfs_putpages(void *);
#endif
int smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred);
int smbfs_writevnode(struct vnode *vp, struct uio *uiop, struct ucred *cred, int ioflag);
void smbfs_attr_cacheenter(struct vnode *vp, struct smbfattr *fap);