bug-grep
[Top][All Lists]
Advanced

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

Re: SEEK_HOLE defined but useless on linux-3.4+/ext4 [Re: small ascii fi


From: Paul Eggert
Subject: Re: SEEK_HOLE defined but useless on linux-3.4+/ext4 [Re: small ascii files can be sparse
Date: Tue, 31 Jul 2012 09:32:51 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0

On 07/31/2012 09:07 AM, Jim Meyering wrote:
> I did something similar in gnulib's fts.c when deciding
> whether it needs to sort directory entries on inode number
> in order to avoid an O(N^2) seek storm.  There, I used fstatfs
> to get each device's statfs.f_type, so far without complaint.
> Then, since we're using a file descriptor, there would be no race.

For that purpose, a race isn't such a big deal, since it
merely causes fts to be slower.  But for 'grep'
a race might cause the output to be incorrect, so we
need to consider it more carefully.

I don't see how having a file descriptor avoids a race.
Using fstat gives us only a device+inode pair, right?
And if there's a unmount+mount between the time that we do the
fstat, and the time we check the file system, the
device number might not correspond to what's in the
mount table that we see, so we might get incorrect
information about the current file.



reply via email to

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