public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
To: Mike Waychison <mikew@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Andreas Dilger <adilger@clusterfs.com>,
	Sreenivasa Busam <sreenivasac@google.com>,
	"linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>
Subject: Re: fallocate support for bitmap-based files
Date: Fri, 29 Jun 2007 16:24:55 -0500	[thread overview]
Message-ID: <1183152295.12702.20.camel@kleikamp.austin.ibm.com> (raw)
In-Reply-To: <46857107.2000106@google.com>

On Fri, 2007-06-29 at 16:52 -0400, Mike Waychison wrote:
> Dave Kleikamp wrote:
> > 
> > By truncating the blocks file at the correct byte offset, only needing
> > to zero some bits of the last byte of the file.
> 
> We were thinking the unwritten blocks file would be indexed by physical 
> block number of the block device.  There wouldn't be a logical to 
> physical relationship for the blocks, so we wouldn't be able to get away 
> with truncating the blocks file itself.

I misunderstood.  I was thinking about a block-file per regular file
(that had preallocated blocks).  Ignore that comment.

> >>- When the fs comes to read a block from disk, it will need to consult
> >>  the unwritten blocks file to see if that block should be zeroed by the
> >>  CPU.
> >>
> >>- When the unwritten-block is written to, its bit in the unwritten blocks
> >>  file gets zeroed.
> >>
> >>- An obvious efficiency concern: if a user file has no unwritten blocks
> >>  in it, we don't need to consult the unwritten blocks file.
> >>
> >>  Need to work out how to do this.  An obvious solution would be to have
> >>  a number-of-unwritten-blocks counter in the inode.  But do we have space
> >>  for that?
> > 
> > 
> > Would it be too expensive to test the blocks-file page each time a bit
> > is cleared to see if it is all-zero, and then free the page, making it a
> > hole?  This test would stop if if finds any non-zero word, so it may not
> > be too bad.  (This could further be done on a block basis if the block
> > size is less than a page.)
> 
> When clearing the bits, we'd likely see a large stream of writes to the 
> unwritten blocks, which could result in a O(n^2) pass of rescanning the 
> page over and over.  

If you start checking for zero at the bit that was just zeroed, you'd
likely find a non-zero bit right away, so you wouldn't be looking at too
much of the page in the typical case.

> Maybe a per-unwritten-block-file block 
> per-block-header with a count that could be cheaply tested?  Ie: the 
> unwritten block file is composed of blocks that each have a small header 
> that contains count -- when the count hits zero, we could punch a hole 
> in the file.

Having the data be just a bitmap seems more elegant to me.  It would be
nice to avoid keeping a count in the bitmap page if possible.
-- 
David Kleikamp
IBM Linux Technology Center

  reply	other threads:[~2007-06-29 21:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-29 20:01 fallocate support for bitmap-based files Andrew Morton
2007-06-29 20:36 ` Dave Kleikamp
2007-06-29 20:52   ` Mike Waychison
2007-06-29 21:24     ` Dave Kleikamp [this message]
2007-06-29 20:55 ` Theodore Tso
2007-06-29 21:38   ` Andrew Morton
2007-06-29 22:07     ` Mike Waychison
2007-07-04 23:11       ` Valerie Henson
2007-07-06 21:15         ` Mike Waychison
2007-06-29 21:46   ` Andreas Dilger
2007-06-29 22:26     ` Mike Waychison
2007-06-30  5:14       ` Andreas Dilger
2007-06-30 14:31         ` Mingming Cao
2007-06-30 14:13 ` Mingming Cao
2007-06-30 17:29   ` Andreas Dilger
2007-07-02 14:44     ` Mingming Cao
2007-07-02 17:44   ` Badari Pulavarty
2007-07-06 21:33     ` Mike Waychison
2007-07-07  2:05       ` Badari Pulavarty

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=1183152295.12702.20.camel@kleikamp.austin.ibm.com \
    --to=shaggy@linux.vnet.ibm.com \
    --cc=adilger@clusterfs.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=mikew@google.com \
    --cc=sreenivasac@google.com \
    --cc=tytso@mit.edu \
    /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