]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
fts: Improve performance on the Lustre file system.
authorCollin Funk <collin.funk1@gmail.com>
Fri, 2 Jan 2026 04:24:29 +0000 (20:24 -0800)
committerCollin Funk <collin.funk1@gmail.com>
Fri, 2 Jan 2026 04:24:29 +0000 (20:24 -0800)
Reported by Tim Day <timday@amazon.com> in
<https://bugs.gnu.org/80106>.

* lib/fts.c (S_MAGIC_LUSTRE): New macro.
(dirent_inode_sort_may_be_useful): Return false on Lustre file systems
so inode sorting is not performed.

ChangeLog
lib/fts.c

index 53f19b337ada6e64b6b65d334b1264763bfce9ba..5ffd08aba2477064c9881acbdd238d29a3c21172 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-01-01  Collin Funk  <collin.funk1@gmail.com>
+
+       fts: Improve performance on the Lustre file system.
+       Reported by Tim Day <timday@amazon.com> in
+       <https://bugs.gnu.org/80106>.
+       * lib/fts.c (S_MAGIC_LUSTRE): New macro.
+       (dirent_inode_sort_may_be_useful): Return false on Lustre file systems
+       so inode sorting is not performed.
+
 2026-01-01  Bruno Haible  <bruno@clisp.org>
 
        doc: Update regarding stable branches.
index a38804ce78a2834499220199cb0b84dbd395bbec..4be7c77fe84d4fea8ab03572f73192e4e2e1a776 100644 (file)
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -652,6 +652,7 @@ enum leaf_optimization
 /* Linux-specific constants from coreutils' src/fs.h */
 # define S_MAGIC_AFS 0x5346414F
 # define S_MAGIC_CIFS 0xFF534D42
+# define S_MAGIC_LUSTRE 0x0BD00BD0
 # define S_MAGIC_NFS 0x6969
 # define S_MAGIC_PROC 0x9FA0
 # define S_MAGIC_TMPFS 0x1021994
@@ -758,6 +759,11 @@ dirent_inode_sort_may_be_useful (FTSENT const *p, int dir_fd)
 
   switch (filesystem_type (p, dir_fd))
     {
+    case S_MAGIC_LUSTRE:
+      /* On Lustre, sorting directory entries interferes with its ability to
+         prefetch file metadata (via statahead).  This would make a make a
+         command like 'du' around 9 times slower.  See
+         <https://bugs.gnu.org/80106>.  */
     case S_MAGIC_CIFS:
     case S_MAGIC_NFS:
     case S_MAGIC_TMPFS: