From owner-freebsd-current@FreeBSD.ORG Wed Aug 24 13:24:56 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 7DFC81065674; Wed, 24 Aug 2011 13:24:56 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-jnhn.mail.uoguelph.ca (esa-jnhn.mail.uoguelph.ca [131.104.91.44]) by mx1.freebsd.org (Postfix) with ESMTP id 22A758FC13; Wed, 24 Aug 2011 13:24:55 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4EAEX7VE6DaFvO/2dsb2JhbABCFoQ2pCKBQAEBBSNWGxgCAg0ZAlkGLodaqVuSAoEshA2BEASTGZEX X-IronPort-AV: E=Sophos;i="4.68,275,1312171200"; d="scan'208";a="135383348" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 24 Aug 2011 09:24:54 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id C298BB3F5D; Wed, 24 Aug 2011 09:24:54 -0400 (EDT) Date: Wed, 24 Aug 2011 09:24:54 -0400 (EDT) From: Rick Macklem To: Kostik Belousov Message-ID: <920337541.272757.1314192294772.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <20110824082119.GJ17489@deviant.kiev.zoral.com.ua> 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: Pawel Jakub Dawidek , Benjamin Kaduk , 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: Wed, 24 Aug 2011 13:24:56 -0000 Kostik Belousov wrote: > On Tue, Aug 23, 2011 at 11:23:03PM +0200, Pawel Jakub Dawidek wrote: > > On Tue, Aug 23, 2011 at 04:11:20PM -0400, Rick Macklem wrote: > > > Pawel Jakub Dawidek wrote: > > > > On Tue, Aug 23, 2011 at 10:09:41AM -0400, Rick Macklem wrote: > > > > > Ok, I'll admit I wasn't very fond of a fixed table that would > > > > > inevitably > > > > > get out of date someday, either. > > > > > > > > > > I didn't think hashing for the cases not in the table was > > > > > worth the > > > > > effort, > > > > > but doing a hash instead of a table seems reasonable. > > > > > > > > > > I see that ZFS only uses the low order 8 bits, so I'll try and > > > > > come > > > > > up > > > > > with an 8bit hash solution and will post a patch for > > > > > testing/review > > > > > soon. > > > > > > > > > > I don't think the vfs_sysctl() is that great a concern, given > > > > > that > > > > > it > > > > > appears to be deprecated already anyhow. (With an 8bit hash, > > > > > vfs_typenum > > > > > won't be that sparse.) I'll also make sure that whatever hash > > > > > I use > > > > > doesn't collide for the current list of file names (although I > > > > > will > > > > > include > > > > > code that handles a collision in the patch). > > > > > > > > Sounds great. Thanks! > > > > > > > Here's the patch. (Hiroki could you please test this, thanks, > > > rick.) > > > ps: If the white space gets trashed, the same patch is at: > > > http://people.freebsd.org/~rmacklem/fsid.patch > > > > The patch is fine by me. Thanks, Rick! > > Sorry, I am late. > > It seems that the probability of the collisions for the hash is quite > high. > Due to the fixup procedure, the resulting typenum will depend on the > order > of the module initialization, isn't it ? IMO, it makes the patch goal > not > met. Well, the about 15 file system types currently in FreeBSD don't collide. (At least with the patch I posted. I'll test it again with "hash & 0xff;".) Also, since the collision results in the second one using the next higher value (usually, until you get something like 50+ file system types), it works for those cases unless the order that these 2 file systems call vfs_register() is reversed. (The likelyhood of this reversal is lower than the likelyhood of vfs_register() just being called in a different order, I think?) Since it now changes whenever a different kernel config or different module loading order is used and there aren't a lot of complaints, I think "usually works" is good enough. However, it doesn't matter to me, so I'll let others decide. Yet another option is to go back to what hrs@ originally suggested, which was change ZFS to not use vfc_typenum in its fsid. (I now see that 0 won't conflict with any assigned vfc_typenum values, since they start at 1 and 255 would also probably be safe, since its unlikely there ever will be 255 different file system types.) The problem with this is no future FS can use the same trick.