bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] fts: introduce the FTS_NOLEAF flag


From: Paul Eggert
Subject: Re: [PATCH 1/2] fts: introduce the FTS_NOLEAF flag
Date: Thu, 7 Sep 2017 23:51:11 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 09/12/15 10:35, Pádraig Brady wrote:
p.s. I see that find does a stat per file on XFS,
while d_type can be used to distinguish dirs there.
On XFS DT_DIR is set for dirs and DT_UNKNOWN otherwise.
I wonder is there some optimization we could do for that case.

There might be, but what are you basing this summary on? Although I don't use XFS and don't know much about it, I just looked in linux-4.13-rc1/fs/xfs/xfs_dir2_readdir.c and its xfs_dir3_get_dtype function suggests that readdir's d_type either generally works, or always returns DT_UNKNOWN, depending on how the xfs filesystem is set up. See linux-4.13-rc1/fs/xfs/libxfs/xfs_format.h and its xfs_sb_version_hasftype function.

This might explain why Gnulib fts (which has your change) improves performance for you (if your xfs had an appropriate setup) whereas it is no faster for Kamil (if Kamil's xfs had an inappropriate setup).

Anyway, this comment in Gnulib fts.c:

      /* List here the file system types that lack usable dirent.d_type
         info, yet for which the optimization does apply.  */
    case S_MAGIC_REISERFS:
    case S_MAGIC_XFS:
      return NOSTAT_LEAF_OPTIMIZATION;

seems wrong or at least incomplete, since XFS either has usable dirent.d_type info, or lacks it, depending on how the filesystem is set up.

Perhaps someone with more XFS expertise could comment?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]