[OpenAFS] Linux client and find command in AFS
Jeffrey Hutzelman
jhutz@cmu.edu
Thu, 07 Apr 2005 10:29:23 -0400
On Thursday, April 07, 2005 09:48:20 AM -0400 Jim Rees <rees@umich.edu>
wrote:
> A bit off the subject, but the way to really speed up "find" is to store a
> flag in the directory that says whether each leaf is a file or directory.
> That way you avoid stat on regular files if there are no other predicates
> that require it.
>
> This can be done in afs by cheating, because the viceid is always even for
> files and odd for directories (or maybe it's the other way around).
Except that to AFS, mount points are files, not directories, and they have
even vnode numbers and even inode numbers. So, an application can't tell
whether something with an even inode number is a file or a mount point
without a stat. Worse, this same property means that a _cache manager_
can't tell whether something is a file or a mount point without calling
FetchStatus on it. Of course, once that's done once, the answer will be in
the vcache.
This actually means Garrance's proposal won't work, either -- we can't cons
up a "correct" link count for a directory without checking to see whether
each of the even-numbered items inside is a file or a mount point. And I'm
pretty sure the cache manager doesn't actually use the "files are even"
trick anywhere, because I don't think that rule holds for DFS-translator
volumes. So the CM would have to do FetchStatus calls for each item in a
directory (or more likely, one or more BulkStatus calls) before it could
return the result of a stat() on the directory itself. That would
definitely _not_ make find faster, and would likely slow down a lot of
cases where the thing calling stat couldn't care less about the link count.
-- Jeff