From owner-freebsd-current@FreeBSD.ORG Thu Aug 25 13:51:59 2011 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CA0C106564A for ; Thu, 25 Aug 2011 13:51:59 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-annu.mail.uoguelph.ca (esa-annu.mail.uoguelph.ca [131.104.91.36]) by mx1.freebsd.org (Postfix) with ESMTP id EC23F8FC13 for ; Thu, 25 Aug 2011 13:51:58 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqAEAKdSVk6DaFvO/2dsb2JhbABCDoQ+pCyBQAEBAQECAQEBASAEJyALBRYYAgINGQIpAQkmBggHBAEaAgSHUQSpGpFZgSyED4ERBJEJghCQQ1Q X-IronPort-AV: E=Sophos;i="4.68,281,1312171200"; d="scan'208";a="132206459" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-annu-pri.mail.uoguelph.ca with ESMTP; 25 Aug 2011 09:51:57 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 8DC0AB3F52; Thu, 25 Aug 2011 09:51:57 -0400 (EDT) Date: Thu, 25 Aug 2011 09:51:57 -0400 (EDT) From: Rick Macklem To: Benjamin Kaduk Message-ID: <2096772200.330408.1314280317504.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.203] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - FF3.0 (Win)/6.0.10_GA_2692) Cc: current@FreeBSD.org Subject: Re: fsid change of ZFS? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Aug 2011 13:51:59 -0000 Benjamin Kaduk wrote: > On Wed, 24 Aug 2011, Rick Macklem wrote: > > > "afs" > > The current OpenAFS codebase uses the all-caps "AFS". Judging by the > omitted text, perhaps this should change. (We also don't use VFS_SET > to > set it, which I filed a bug about.) > > > > > and here is my current rendition of the patch. (I took Gleb's > > suggestion > > and switched to fnv_32_str(). I'll leave it that way unless there is > > a > > collision after adding any names people post to the above list.) > > > > It sounds like people have agreed that this is a reasonable > > solution. > > If hrs@ can confirm that testing shows it fixes the original problem > > (the ZFS file handles don't change when it's loaded at different > > times), > > I'll pass it along to re@. > > > > Thanks for the helpful suggestions, rick > > > > --- kern/vfs_init.c.sav 2011-06-11 18:58:33.000000000 -0400 > > +++ kern/vfs_init.c 2011-08-24 16:15:24.000000000 -0400 > > @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD: head/sys/kern/vfs_in > > > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -138,6 +139,8 @@ vfs_register(struct vfsconf *vfc) > > struct sysctl_oid *oidp; > > struct vfsops *vfsops; > > static int once; > > + struct vfsconf *tvfc; > > + uint32_t hashval; > > > > if (!once) { > > vattr_null(&va_null); > > @@ -152,7 +155,26 @@ vfs_register(struct vfsconf *vfc) > > if (vfs_byname(vfc->vfc_name) != NULL) > > return EEXIST; > > > > - vfc->vfc_typenum = maxvfsconf++; > > + /* > > + * Calculate a hash on vfc_name to use for vfc_typenum. Unless > > + * a collision occurs, it is limited to 8bits since that is > > + * what ZFS uses from vfc_typenum and that also limits how sparsely > > + * distributed vfc_typenum becomes. > > + */ > > + hashval = fnv_32_str(vfc->vfc_name, FNV1_32_INIT); > > + hashval &= 0xff; > > + do { > > + /* Look for and fix any collision. */ > > + TAILQ_FOREACH(tvfc, &vfsconf, vfc_list) { > > + if (hashval == tvfc->vfc_typenum) { > > + hashval++; /* Can exceed 8bits, if needed. */ > > If we're confident that we won't ever fully fill the hash table, I > would > think that this should wrap around back to zero (or one?) instead of > overflowing. > I did it that way so that it could overflow for the highly unlikely case of more than 255 file system types. I suppose I should scan for an unused value 1<->255 and only allow it to go past 255 if all of them are used. I'll post yet another patch soon, rick > Do we need to care about something attempting to add the same vfc_name > twice? This code will happily add a second entry at the next available > index. > > > + break; > > + } > > + } > > + } while (tvfc != NULL); > > + vfc->vfc_typenum = hashval; > > + if (vfc->vfc_typenum >= maxvfsconf) > > + maxvfsconf = vfc->vfc_typenum + 1; > > I guess we're holding off on killing maxvfsconf until after 9.0 is > out? > > -Ben > > > TAILQ_INSERT_TAIL(&vfsconf, vfc, vfc_list); > > > > /* > > > > > > > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to > "freebsd-current-unsubscribe@freebsd.org"