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: Jim Meyering
Subject: Re: SEEK_HOLE defined but useless on linux-3.4+/ext4 [Re: small ascii files can be sparse
Date: Tue, 31 Jul 2012 18:07:08 +0200

Paul Eggert wrote:
> On 07/31/2012 12:05 AM, Jim Meyering wrote:
>> Given the knowledge that we're using one of those non-compressing file
>> systems, the legacy heuristic will work.
>
> I originally coded it up that way, using the st_fstype member
> that Solaris has -- this is more convenient and more accurate
> than the dance with statvfs.  But I gave it up on the grounds
> that any system sane enough to have st_fstype already has
> a working SEEK_HOLE (or is so old that we don't care about it....).
>
> Maybe while we're asking for SEEK_HOLE, we can also ask for
> st_fstype?  The problem with the statvfs dance is that it opens
> up race conditions when some other process is doing mounts.

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.



reply via email to

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