From owner-svn-src-all@FreeBSD.ORG Sat Oct 23 22:28:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FF981065670; Sat, 23 Oct 2010 22:28:29 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 53AF58FC0C; Sat, 23 Oct 2010 22:28:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9NMSTep003959; Sat, 23 Oct 2010 22:28:29 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9NMSTts003956; Sat, 23 Oct 2010 22:28:29 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201010232228.o9NMSTts003956@svn.freebsd.org> From: Rick Macklem Date: Sat, 23 Oct 2010 22:28:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214255 - in head/sys/fs: nfs nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Oct 2010 22:28:29 -0000 Author: rmacklem Date: Sat Oct 23 22:28:29 2010 New Revision: 214255 URL: http://svn.freebsd.org/changeset/base/214255 Log: 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. Suggested by: gleb.kurtsou at gmail.com MFC after: 10 days Modified: head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Sat Oct 23 22:11:30 2010 (r214254) +++ head/sys/fs/nfs/nfs_var.h Sat Oct 23 22:28:29 2010 (r214255) @@ -576,7 +576,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: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Sat Oct 23 22:11:30 2010 (r214254) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Sat Oct 23 22:28:29 2010 (r214255) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); */ #include +#include #include #include #include @@ -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); }