Modify the file handle hash function in the experimental NFS
server so that it will work better for non-UFS file systems. The new function simply sums the bytes of the fh_fid field of fhandle_t. MFC after: 10 days
This commit is contained in:
parent
8bb77249db
commit
91027b4ef0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=214224
@ -576,6 +576,7 @@ void nfsvno_unlockvfs(mount_t);
|
|||||||
int nfsvno_lockvfs(mount_t);
|
int nfsvno_lockvfs(mount_t);
|
||||||
int nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *);
|
int nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *);
|
||||||
int nfsvno_testexp(struct nfsrv_descript *, struct nfsexstuff *);
|
int nfsvno_testexp(struct nfsrv_descript *, struct nfsexstuff *);
|
||||||
|
int nfsrv_hashfh(fhandle_t *);
|
||||||
|
|
||||||
/* nfs_commonkrpc.c */
|
/* nfs_commonkrpc.c */
|
||||||
int newnfs_nmcancelreqs(struct nfsmount *);
|
int newnfs_nmcancelreqs(struct nfsmount *);
|
||||||
|
@ -73,7 +73,7 @@ struct nfsexstuff {
|
|||||||
bcmp(&(f1)->fh_fid, &(f2)->fh_fid, sizeof(struct fid)) == 0)
|
bcmp(&(f1)->fh_fid, &(f2)->fh_fid, sizeof(struct fid)) == 0)
|
||||||
|
|
||||||
#define NFSLOCKHASH(f) \
|
#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 NFSFPVNODE(f) ((struct vnode *)((f)->f_data))
|
||||||
#define NFSFPCRED(f) ((f)->f_cred)
|
#define NFSFPCRED(f) ((f)->f_cred)
|
||||||
|
@ -3087,6 +3087,21 @@ nfsvno_testexp(struct nfsrv_descript *nd, struct nfsexstuff *exp)
|
|||||||
return (1);
|
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 *);
|
extern int (*nfsd_call_nfsd)(struct thread *, struct nfssvc_args *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user