Big performance improvement for fts-based tools that use FTS_NOSTAT.
authorJim Meyering <jim@meyering.net>
Thu, 12 Oct 2006 10:32:32 +0000 (10:32 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 12 Oct 2006 10:32:32 +0000 (10:32 +0000)
commit73d4f7aea9a7d30da20f7930d6d6fd46f5ebc336
treefbb48583192ce8d4a5ed52a4cfbc5d4ad1ee7559
parentd0fe5568668882bc8f9682aa40efda822f8f9c94
Big performance improvement for fts-based tools that use FTS_NOSTAT.
Avoid spurious inode-mismatch problems on non-POSIX file systems.
Details: http://article.gmane.org/gmane.comp.lib.gnulib.bugs/7416
* lib/fts_.h (FTS_DEFER_STAT): Define new flag.
(FTS_OPTIONMASK): Extend the mask to reflect this addition.
* lib/fts.c (DT_IS_KNOWN, DT_MUST_BE): Define.
(FTS_NO_STAT_REQUIRED, FTS_STAT_REQUIRED): Define.
(fts_set_stat_required): New function.
(fts_open): Defer the calls to fts_stat, if possible or requested.
Move the code that maps a command-line fts_info value FTS_DOT to FTS_D
into fts_stat itself.
(fts_read): Perform any required (deferred) fts_stat call.
(fts_build): Likewise, for the directory we're about to open and read.
In the readdir loop, carefully decide whether each entry will require
an eventual call to fts_stat, using dirent.d_type info if available.
(fts_stat): Move the test for whether to honor FTS_COMFOLLOW on
a command line argument into this function.  Update all callers.
Map a return value of FTS_DOT to FTS_D for a command line argument.
* modules/fts (Depends-on): Add d-type.  Alphabetize.
Thanks to Miklos Szeredi for his tenacity and for the initial
bug report about "find" failing on a FUSE-based file system.
ChangeLog
lib/fts.c
lib/fts_.h
modules/fts