From owner-freebsd-arch Thu Mar 1 5:54:49 2001 Delivered-To: freebsd-arch@freebsd.org Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by hub.freebsd.org (Postfix) with ESMTP id 5AA5837B71B for ; Thu, 1 Mar 2001 05:54:44 -0800 (PST) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (robert@fledge.pr.watson.org [192.0.2.3]) by fledge.watson.org (8.11.1/8.11.1) with SMTP id f21Dsah65621; Thu, 1 Mar 2001 08:54:36 -0500 (EST) (envelope-from robert@fledge.watson.org) Date: Thu, 1 Mar 2001 08:54:36 -0500 (EST) From: Robert Watson X-Sender: robert@fledge.watson.org To: Terry Lambert Cc: "Long, Scott" , "'Garrett Wollman'" , arch@FreeBSD.ORG Subject: Re: Arch question for a UDF FS driver In-Reply-To: <200103010510.WAA16907@usr05.primenet.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Sorry about that blank e-mail -- here's the real thing :-) On Thu, 1 Mar 2001, Terry Lambert wrote: > > > Hash the Unique Id into 31 bits (e.g., u_id % 2147483647). Renumber > > > any collisions into the space above 2**31. You would still need to > > > keep some state when there is a collision, but if the Ids are > > > assigned sequentially then you are likely to win most of the time. > > > > Interesting idea. Like I said, consuming 32 bits within the life of the > > filesystem is going to be pretty hard. > > > > > I don't see what this has to do with vget(), however. > > > > not vget() itself, the vget vfsop. Unless I'm totally clueless here, the > > vget vfsop is supposed to return the vnode that repesents the passed in > > ino_t. > > The question to ask yourself is "under what circumstances do I care > about the ino_t?". So my temptation here is the same as Terry's -- the concept of an "inode number" is fairly dated in that it applies poorly, if at all, to modern file systems (even 1980's file systems). There are, unfortunately, a few apps that make use of the inode number returned by stat -- generally to try and detect hard links (I think tar does this). You should be able to use a hash to prevent most collisions. Really, these applications should be fixed not to use the inode number where possible. In the past I've proposed addressing this by introducing a fsamefile(int fd1, int fd2) interface that would allow an application to determine if two open file descriptors pointed to the same "file" from the perspective of the current file system. Depending on your semantics, I suspect a perfectly acceptable implementation would simply compare the two vnode pointers (let Terry comment on aliasing here). In the past, it has been pointed out to me that this dramatically increases the cost of hard link detection -- as such, maintaining a moderately unique ino_t with effectively constant value (hashed from something fairly constant in the underlying file system) and letting the userland application generate hashes using that field, then resolve hash collisions using fsamefile() would be appropriate. I have an implementation of fsamefile() I've been using here with a fair amount of success, although I haven't adapted any third-party applications to use it. Note that on some platforms (including Linux, last I checked), the ino_t uniqueness property is fundamental to the design of their VFS, and collisions can have *very* nasty affects. In FreeBSD, from the kernel perspective, only the uniqueness of the vnode pointer matters, which is what I try to leverage in the fsamefile() interface (and also samefile() based on paths). As for vfs_vget() -- many of our file systems simple fall back on vfs_stdvget() which just returns EOPNOTSUPP. This is perfectly acceptable. Robert N M Watson FreeBSD Core Team, TrustedBSD Project robert@fledge.watson.org NAI Labs, Safeport Network Services To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message