From owner-svn-src-all@FreeBSD.ORG Sat Oct 23 09:23:58 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 1A671106564A; Sat, 23 Oct 2010 09:23:58 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 272E88FC14; Sat, 23 Oct 2010 09:23:56 +0000 (UTC) Received: by eyb7 with SMTP id 7so849666eyb.13 for ; Sat, 23 Oct 2010 02:23:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=9AuxMN3XpmPEzcKbcSQnaOVWCI79NlF0NhtmX5YrDIw=; b=CIGHtA0nbbD6WXOR8zLGx0HcbcPXsvWHukRjradAYeacbcasqRCs1dZku6sWVERELz C0DVFViE0F/hHmMYgIQC1BKRiJCgH1TcTF8eyQeTGfDhIrntzs9gbqHorkjC439wciQt zxIlb0rs90FyUOw6BT4UIr7e/h2W1Tuy+rbQE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=W+bkd84Dkf2TnswhKg/V6/kJZ5XRucITw9thkl3xQCSJl5vkLNwFdNE7vlTEqjtkYH S4OCWEgx6O2ziSJj+EVEyv6OQyfFkBnpdeJdLFUUNj2YZy0aFIc3CEMIO52Sv3nkQP1p OtyqF/C9mxrvpWFRsm9LPsbG6zjNF0LREGPOQ= Received: by 10.213.31.134 with SMTP id y6mr4121696ebc.82.1287824445951; Sat, 23 Oct 2010 02:00:45 -0700 (PDT) Received: from localhost ([212.98.186.134]) by mx.google.com with ESMTPS id q58sm4485429eeh.21.2010.10.23.02.00.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 23 Oct 2010 02:00:44 -0700 (PDT) Date: Sat, 23 Oct 2010 12:00:40 +0300 From: Gleb Kurtsou To: Rick Macklem Message-ID: <20101023090040.GA67039@tops> References: <201010222138.o9MLcuLY066850@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201010222138.o9MLcuLY066850@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214224 - 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 09:23:58 -0000 On (22/10/2010 21:38), Rick Macklem wrote: > Author: rmacklem > Date: Fri Oct 22 21:38:56 2010 > New Revision: 214224 > URL: http://svn.freebsd.org/changeset/base/214224 > > Log: > 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 > > Modified: > head/sys/fs/nfs/nfs_var.h > head/sys/fs/nfs/nfsdport.h > head/sys/fs/nfsserver/nfs_nfsdport.c > > Modified: head/sys/fs/nfs/nfs_var.h > ============================================================================== > --- head/sys/fs/nfs/nfs_var.h Fri Oct 22 20:46:08 2010 (r214223) > +++ head/sys/fs/nfs/nfs_var.h Fri Oct 22 21:38:56 2010 (r214224) > @@ -576,6 +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 *); > > /* nfs_commonkrpc.c */ > int newnfs_nmcancelreqs(struct nfsmount *); > > Modified: head/sys/fs/nfs/nfsdport.h > ============================================================================== > --- head/sys/fs/nfs/nfsdport.h Fri Oct 22 20:46:08 2010 (r214223) > +++ head/sys/fs/nfs/nfsdport.h Fri Oct 22 21:38:56 2010 (r214224) > @@ -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: head/sys/fs/nfsserver/nfs_nfsdport.c > ============================================================================== > --- head/sys/fs/nfsserver/nfs_nfsdport.c Fri Oct 22 20:46:08 2010 (r214223) > +++ head/sys/fs/nfsserver/nfs_nfsdport.c Fri Oct 22 21:38:56 2010 (r214224) > @@ -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); > +} > + Is there a reason not to use fnv_32_buf() from sys/fnv_hash.h or hash32_buf() from sys/hash.h? Just summing up bytes for hash is not generally helpful. Thanks, Gleb. > extern int (*nfsd_call_nfsd)(struct thread *, struct nfssvc_args *); > > /* > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"