[Top] [All Lists]

Re: sparsify - utility to punch out blocks of 0s in a file

To: Eric Sandeen <sandeen@xxxxxxxxxx>
Subject: Re: sparsify - utility to punch out blocks of 0s in a file
From: Andreas Dilger <adilger@xxxxxxxxx>
Date: Sun, 5 Feb 2012 12:24:26 -0700
Cc: Ron Yorston <rmy@xxxxxxxxxxxxx>, "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>, "linux-ext4@xxxxxxxxxxxxxxx" <linux-ext4@xxxxxxxxxxxxxxx>
In-reply-to: <4F2EBB09.6080905@xxxxxxxxxx>
References: <4F2D8F30.3090802@xxxxxxxxxx> <201202050933.q159XQpB026380@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <4F2EB017.5090006@xxxxxxxxxx> <9C5B5C07-B0E4-4D13-BCFE-7F35162DF5E8@xxxxxxxxx> <4F2EBB09.6080905@xxxxxxxxxx>
On 2012-02-05, at 10:23 AM, Eric Sandeen wrote:
> On 2/5/12 10:55 AM, Andreas Dilger wrote:
>> On 2012-02-05, at 9:36, Eric Sandeen <sandeen@xxxxxxxxxx> wrote:
>>> On 2/5/12 3:33 AM, Ron Yorston wrote:
>>>> Eric Sandeen wrote:
>>>>> Now that ext4, xfs, & ocfs2 can support punch hole, a tool to
>>>>> "re-sparsify" a file by punching out ranges of 0s might be in order.
>>>>> I'll see if util-linux wants it after it gets beat into shape.
>>>>> (or did a tool like this already exist and I missed it?)
>>> Matthias' suggestion of adding SEEK_HOLE/SEEK_DATA makes very good sense 
>>> too.
>> I thought about this, but if SEEK_HOLE/SEEK_DATA (or FIEMAP) worked,
>> then the file would already be sparse, so I don't think that will
>> help in this case...
> But only if other tools originally used them, and there will probably be 
> plenty
> of cases where they don't, or legacy files, or ....

I was thinking that the suggestion was to use SEEK_HOLE/SEEK_DATA to find
the holes in the file...  Of course, it makes a lot of sense if you use
them to skip the existing holes, and only look for strings of zeros in the
data parts...

Cheers, Andreas

<Prev in Thread] Current Thread [Next in Thread>