diff options
| author | Rick Macklem <rmacklem@FreeBSD.org> | 2010-11-01 02:21:35 +0000 |
|---|---|---|
| committer | Rick Macklem <rmacklem@FreeBSD.org> | 2010-11-01 02:21:35 +0000 |
| commit | 57ad326e1767dff53c2fbb0965ee3e073583e0ec (patch) | |
| tree | a091484697bec2f85fbb7a586fafd454d33a5c73 | |
| parent | 7cb21a4652ff827982f610bbff9e77b1d2ebce33 (diff) | |
Notes
| -rw-r--r-- | sys/fs/nfs/nfs_var.h | 1 | ||||
| -rw-r--r-- | sys/fs/nfs/nfsdport.h | 2 | ||||
| -rw-r--r-- | sys/fs/nfsserver/nfs_nfsdport.c | 15 |
3 files changed, 17 insertions, 1 deletions
diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 9f3a269144e1..7bfdffa38c89 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -578,6 +578,7 @@ void nfsvno_unlockvfs(mount_t); int nfsvno_lockvfs(mount_t); int nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *); int nfsvno_testexp(struct nfsrv_descript *, struct nfsexstuff *); +int nfsrv_hashfh(fhandle_t *); /* nfs_commonkrpc.c */ int newnfs_nmcancelreqs(struct nfsmount *); diff --git a/sys/fs/nfs/nfsdport.h b/sys/fs/nfs/nfsdport.h index fdba91699873..4888866d6e17 100644 --- a/sys/fs/nfs/nfsdport.h +++ b/sys/fs/nfs/nfsdport.h @@ -73,7 +73,7 @@ struct nfsexstuff { bcmp(&(f1)->fh_fid, &(f2)->fh_fid, sizeof(struct fid)) == 0) #define NFSLOCKHASH(f) \ - (&nfslockhash[(*((u_int32_t *)((f)->fh_fid.fid_data))) % NFSLOCKHASHSIZE]) + (&nfslockhash[nfsrv_hashfh(f) % NFSLOCKHASHSIZE]) #define NFSFPVNODE(f) ((struct vnode *)((f)->f_data)) #define NFSFPCRED(f) ((f)->f_cred) diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 0d35d1d04b0b..b49442fd89ca 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -3087,6 +3087,21 @@ nfsvno_testexp(struct nfsrv_descript *nd, struct nfsexstuff *exp) return (1); } +/* + * Calculate a hash value for the fid in a file handle. + */ +int +nfsrv_hashfh(fhandle_t *fhp) +{ + int hashval = 0, i; + uint8_t *cp; + + cp = (uint8_t *)&fhp->fh_fid; + for (i = 0; i < sizeof(struct fid); i++) + hashval += *cp++; + return (hashval); +} + extern int (*nfsd_call_nfsd)(struct thread *, struct nfssvc_args *); /* |
