[Top][All Lists]

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

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

From: Kamil Dudka
Subject: Re: [PATCH 1/2] fts: introduce the FTS_NOLEAF flag
Date: Fri, 08 Sep 2017 18:16:58 +0200

On Friday, September 8, 2017 8:51:11 AM CEST Paul Eggert wrote:
> > 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).

Yes.  In my testing environment, readdir() always returned valid dtype, so
the leaf optimization was not needed.  Anyway, it should be safe to keep it
enabled for XFS.  It has been enabled in Fedora since December 2015 without
causing any bug reports so far.

> 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:
> 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?

The following linux commit seems to be related:



reply via email to

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