[prev in list] [next in list] [prev in thread] [next in thread] 

List:       netatalk
Subject:    Re: [netatalk-admins] DIDs - an idea -or- I didn't read the AFP specs completely yet
From:       William LeFebvre <wnl () groupsys ! com>
Date:       1998-04-17 0:09:48
[Download RAW message or body]

Andras wrote:
> I assume, You discover a moved directory by not finding it at the right
> place. If you try to locate that directory purely by inode/dev number,
> You lose if the given inode was reused; not to mention, that - AFAIK -
> there is no simple way to get a pathname from an inode/dev number (I
> might be wrong here), so You would have to search the tree for the
> directory, which is very close to searching for the unambiguous [in
> contents I mean] .DID file in the directory. The only case I see You
> could lose here is when some uneducated user removes the .DID file, in
> which case all Your aliases pointing to this dir would break; but You
> still would not resolve to a wrong one, as with inode reuse You could
> based on inode/dev.
> 
> Or did You think about performance issues? Clear me up, please!

If the inode number is for a directory, you actually can derive a
pathname for it, much in the same way that pwd does.  I wrote code
to do this aeons ago.  However, it requires lots of diddling around
on the raw device.  Since you can't open a file by inode number you
have to look at the file's contents baesd on the block numbers in
the inode,  Then you can find the inode number for "..".  Recurse
until you reach the root (special code needed for crossing mount
points, too).  For performance it's only slightly worse than a pwd,
and can't take advantage of any kernel caching.  It also requires
the ability to open the raw device, which usually means being root.

An inode number for a non-directory can't be translated in to a path
without scanning the whole disk.  This is primarily because it could
potentially be present in multiple directories.  But since we're
talking about DIDs here, then we're already dealing only with
directories.

				William LeFebvre
				Group sys Consulting
				<wnl@groupsys.com>
				+1 770 813 3224

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic