bug-findutils
[Top][All Lists]
Advanced

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

[bug #24342] -inum predicate shoud use dirent.d_ino instead of stat.st_i


From: anonymous
Subject: [bug #24342] -inum predicate shoud use dirent.d_ino instead of stat.st_ino
Date: Mon, 22 Sep 2008 08:34:35 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071618 Iceweasel/3.0.1 (Debian-3.0.1-1)

URL:
  <http://savannah.gnu.org/bugs/?24342>

                 Summary: -inum predicate shoud use dirent.d_ino instead of
stat.st_ino
                 Project: findutils
            Submitted by: None
            Submitted on: Mon 22 Sep 2008 08:34:30 AM UTC
                Category: find
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: George Spelvin
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.4.0
           Fixed Release: None

    _______________________________________________________

Details:

Having to stat(2) files to evaluate the -inum predicate 

While looking for files corresponding to fsck complaints, I noticed that
"find . \( -inum x -o -inum y -o -inum z \) -print" is quite slow, due to
making a stat() call on every file.

The predicate is indeed marked NeedsStatInfo in tree.c, but it's not clear
why it doesn't use d_ino from the readdir call.  (Although changing it appears
to require messing with lib/savedirinfo.c)

The one gotcha is with mount points, which have two inode numbers: d_ino is
the covered inode number, while st_ino is the covering inode number.  However,
eliminating stat() on non-directories would still be an enormous help, and
find(1) already has extensive support for avoiding stat() calls on
non-directories that can be used.

(Linux bind mounts allow you to mount a single file, but in that case d_ino
holds the covering inode number; verified in 2.6.26.)



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon 22 Sep 2008 08:34:30 AM UTC  Name: findi.c  Size: 0B   By: None
A simple utility that finds on inode number, demonstrating the desired
efficiency.
<http://savannah.gnu.org/bugs/download.php?file_id=16538>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?24342>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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