]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
The FTS_NOSTAT option is an optimisation that reduces the number
authorpeadar <peadar@FreeBSD.org>
Sat, 8 May 2004 15:09:02 +0000 (15:09 +0000)
committerpeadar <peadar@FreeBSD.org>
Sat, 8 May 2004 15:09:02 +0000 (15:09 +0000)
commitea85333e1c1a82579fb86f69dc49c04544c848bf
tree2f49bc03634a311b4d94a860efa4cb4d6c939cff
parentbc0d53456e34dc72ed85a47b0adfc7133ff1cd80
The FTS_NOSTAT option is an optimisation that reduces the number
of stat(2) calls by keeping an eye of the number of links a directory
has. It assumes that each subdirectory will have a hard link to its
parent, to represent the ".." node, and stops calling stat(2) when
all links are accounted for in a given directory.

This assumption is really only valid for UNIX-like filesystems: A
concrete example is NTFS. The NTFS "i-node" does contain a link
count, but most/all directories have a link count between 0 and 2
inclusive. The end result is that find on an NTFS volume won't
actually traverse the entire hierarchy of the directories passed
to it. (Those with a link count of two are not traversed at all)

The fix checks the "UFSness" of the filesystem before enabling the
optimisation.

Reviewed By: Tim Kientzle (kientzle@)
include/fts.h
lib/libc/gen/fts-compat.c
lib/libc/gen/fts-compat.h
lib/libc/gen/fts.c