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: Mon, 30 Jul 2012 16:22:37 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0

On 07/30/2012 12:33 PM, Jim Meyering wrote:

>   - the interface is cumbersome (putting it mildly)

Yes, and I remember that FIEMAP had some real bugs when the
data structure on disk didn't match the data structure in
memory.  Dunno if they're fixed.  Even if they are fixed,
I'd reeeally rather just deal with SEEK_HOLE -- it's a
*much* nicer interface.

> it may be enough to use the old heuristic, but treat a file
> as non-sparse when it has st.st_size <= ST_BLKSIZE(st).

That would mishandle compressed file systems.  Say the file is
5 MB of text, but file system compression squashes it down to 1 MB.
Then st_size is 5 MB whereas st_blocks is just 1 MB,
and grep would incorrectly think that the file has a hole
and therefore is a binary file.

Since the test is marked as expensive, how about if we just
leave things as-is?  Most people don't run expensive tests,
and people who run them on inadequate file systems and with
inadequate kernels that can't do 'ulimit -v' will just have
to watch out (or buy machines with 10 TB of RAM ...).

> The arguments for switching from ext4 to btrfs are adding up...

I rely on you for notes from the bleeding edge....




reply via email to

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