Date: Wed, 3 Nov 2010 22:17:42 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r214763 - in stable/8/sys/fs: nfs nfsserver Message-ID: <201011032217.oA3MHgVB035543@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Wed Nov 3 22:17:42 2010 New Revision: 214763 URL: http://svn.freebsd.org/changeset/base/214763 Log: MFC: r214255 Modify the experimental NFSv4 server's file handle hash function to use the generic hash32_buf() function. Although adding the bytes seemed sufficient for UFS and ZFS, since most of the bytes are the same for file handles on the same volume, this might not be sufficient for other file systems. Use of a generic function also seems preferable to one specific to NFSv4. Modified: stable/8/sys/fs/nfs/nfs_var.h stable/8/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/8/sys/fs/nfs/nfs_var.h Wed Nov 3 21:51:05 2010 (r214762) +++ stable/8/sys/fs/nfs/nfs_var.h Wed Nov 3 22:17:42 2010 (r214763) @@ -578,7 +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 *); +uint32_t nfsrv_hashfh(fhandle_t *); /* nfs_commonkrpc.c */ int newnfs_nmcancelreqs(struct nfsmount *); Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Wed Nov 3 21:51:05 2010 (r214762) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Wed Nov 3 22:17:42 2010 (r214763) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); */ #include <fs/nfs/nfsport.h> +#include <sys/hash.h> #include <sys/sysctl.h> #include <nlm/nlm_prot.h> #include <nlm/nlm.h> @@ -3090,15 +3091,12 @@ nfsvno_testexp(struct nfsrv_descript *nd /* * Calculate a hash value for the fid in a file handle. */ -int +uint32_t nfsrv_hashfh(fhandle_t *fhp) { - int hashval = 0, i; - uint8_t *cp; + uint32_t hashval; - cp = (uint8_t *)&fhp->fh_fid; - for (i = 0; i < sizeof(struct fid); i++) - hashval += *cp++; + hashval = hash32_buf(&fhp->fh_fid, sizeof(struct fid), 0); return (hashval); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011032217.oA3MHgVB035543>