linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sunil Mushran <sunil.mushran@oracle.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: ext4 development <linux-ext4@vger.kernel.org>,
	xfs-oss <xfs@oss.sgi.com>,
	ocfs2-devel@oss.oracle.com
Subject: Re: sparsify - utility to punch out blocks of 0s in a file
Date: Mon, 06 Feb 2012 10:40:11 -0800	[thread overview]
Message-ID: <4F301E8B.7050909@oracle.com> (raw)
In-Reply-To: <4F2D8F30.3090802@redhat.com>

On 02/04/2012 12:04 PM, 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 whipped this up fast, it probably has bugs&  off-by-ones but thought
> I'd send it out.  It's not terribly efficient doing 4k reads by default
> I suppose.
>
> 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?)
>
> (Another mode which does a file copy, possibly from stdin
> might be good, like e2fsprogs/contrib/make-sparse.c ?  Although
> that can be hacked up with cp already).
>
> It works like this:
>
> [root@inode sparsify]# ./sparsify  -h
> Usage: sparsify [-m min hole size] [-o offset] [-l length] filename


So I have a similar tool queued up in ocfs2-tools. Named puncher.
http://oss.oracle.com/git/?p=ocfs2-tools.git;a=shortlog;h=puncher

I'll pull it out if we get something in util-linux. But maybe you can 
extract something useful from it.

Like.... maybe doing dry-run as default. It is an inplace modification
after all. Also using a large hole size as default (1MB). Over using 
hole punching will negatively affect read performance. We should make 
the sane choice for the user.

On a related note, it may make sense for ext4 to populate the cluster 
size (bigalloc) in stat.st_blksize.

2 cents...

  parent reply	other threads:[~2012-02-06 18:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-04 20:04 sparsify - utility to punch out blocks of 0s in a file Eric Sandeen
2012-02-04 20:10 ` Eric Sandeen
2012-02-04 20:17   ` Eric Sandeen
2012-02-05 15:05   ` Raghavendra D Prabhu
2012-02-05 23:44   ` Michael Tokarev
2012-02-05 23:55     ` Eric Sandeen
2012-02-05  9:33 ` Ron Yorston
2012-02-05 16:36   ` Eric Sandeen
2012-02-05 16:55     ` Andreas Dilger
2012-02-05 17:23       ` Matthias Schniedermeyer
2012-02-05 17:23       ` Eric Sandeen
2012-02-05 19:24         ` Andreas Dilger
2012-02-05 17:19     ` Ron Yorston
2012-02-05 17:21       ` Eric Sandeen
2012-02-06 18:40 ` Sunil Mushran [this message]
2012-02-06 21:41 ` Ted Ts'o
2012-02-06 21:47   ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F301E8B.7050909@oracle.com \
    --to=sunil.mushran@oracle.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=sandeen@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).