From owner-svn-src-stable-8@FreeBSD.ORG Mon Nov 1 02:21:36 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B4F1106566B; Mon, 1 Nov 2010 02:21:36 +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 2E5DA8FC08; Mon, 1 Nov 2010 02:21:36 +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 oA12Lalj021092; Mon, 1 Nov 2010 02:21:36 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA12Laot021088; Mon, 1 Nov 2010 02:21:36 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201011010221.oA12Laot021088@svn.freebsd.org> From: Rick Macklem Date: Mon, 1 Nov 2010 02:21:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214616 - in stable/8/sys/fs: nfs nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 02:21:36 -0000 Author: rmacklem Date: Mon Nov 1 02:21:35 2010 New Revision: 214616 URL: http://svn.freebsd.org/changeset/base/214616 Log: MFC: r214224 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. Modified: stable/8/sys/fs/nfs/nfs_var.h stable/8/sys/fs/nfs/nfsdport.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 Mon Nov 1 02:20:18 2010 (r214615) +++ stable/8/sys/fs/nfs/nfs_var.h Mon Nov 1 02:21:35 2010 (r214616) @@ -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 *); Modified: stable/8/sys/fs/nfs/nfsdport.h ============================================================================== --- stable/8/sys/fs/nfs/nfsdport.h Mon Nov 1 02:20:18 2010 (r214615) +++ stable/8/sys/fs/nfs/nfsdport.h Mon Nov 1 02:21:35 2010 (r214616) @@ -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) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Mon Nov 1 02:20:18 2010 (r214615) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Mon Nov 1 02:21:35 2010 (r214616) @@ -3087,6 +3087,21 @@ nfsvno_testexp(struct nfsrv_descript *nd 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 *); /*