bugfindutils - Bugs: bug #24342, -inum predicate shoud use...

 
 

bug #24342: -inum predicate shoud use dirent.d_ino instead of stat.st_ino

Submitter:  None
Submitted:  Mon 22 Sep 2008 08:34:30 AM UTC
   
 
Category:  find Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  jay
Originator Name:  George Spelvin Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  4.4.0
Fixed Release:  4.5.4
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 08 Mar 2009 12:26:03 PM UTC, comment #2: 

The updated patches are what I actually pushed (into 4.5.x).

(file #17618, file #17619)

James Youngman <jay>
Group administrator
Sat 07 Mar 2009 09:09:07 PM UTC, comment #1: 

The attached patches (against 4.5.x) should fix this performance bug.

(file #17615, file #17616)

James Youngman <jay>
Group administrator
Mon 22 Sep 2008 08:34:30 AM UTC, original submission:  

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.)

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #16538:  findi.c added by None (1B - application/octet-stream - A simple utility that finds on inode number, demonstrating the desired efficiency.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jay (Updated the item)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-07-06 jay Open/ClosedOpen Closed
        Fixed ReleaseNone 4.5.4
    2009-03-08 jay Attached File- Added 0001-Optimise-away-calls-to-stat-if-all-we-need-is-the-in.patch, #17618
        Attached File- Added 0002-For-samefile-skip-stat-if-inode-numbers-differ.patch, #17619
        StatusNone Fixed
    2009-03-08 jay Attached File#17616 Removed
    2009-03-08 jay Attached File#17615 Removed
    2009-03-07 jay Assigned toNone jay
    2009-03-07 jay Attached File- Added 0001-Optimise-away-calls-to-stat-if-all-we-need-is-the-in.patch, #17615
        Attached File- Added 0002-For-samefile-skip-stat-if-inode-numbers-differ.patch, #17616
    2008-09-22 None Attached File- Added findi.c, #16538

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code