public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Ron Yorston <rmy@tigress.co.uk>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ext2: avoid needless discard of preallocated blocks
Date: Sat, 19 Aug 2006 22:46:03 -0700	[thread overview]
Message-ID: <20060819224603.bf687be2.akpm@osdl.org> (raw)
In-Reply-To: <200608171945.k7HJjaLk029781@tiffany.internal.tigress.co.uk>

On Thu, 17 Aug 2006 20:45:36 +0100
Ron Yorston <rmy@tigress.co.uk> wrote:

> Currently preallocated blocks in ext2 are discarded on every call
> to iput() (by ext2_put_inode() calling ext2_discard_prealloc()).
> 
> An earlier attempt to fix this ("discard ext2 preallocation in last
> iput") moved the ext2_discard_prealloc() call to ext2_clear_inode(),
> but was found to cause filesystem corruption in a test using fsx.
> The problem was that ext2_clear_inode() was writing the inode data
> to disk before calling ext2_discard_prealloc(), so the value of
> i_blocks on disk included the preallocated blocks.
> 
> This patch moves the call to ext2_discard_prealloc() to the new
> function ext2_drop_inode().  This should be both efficient (discard
> happens on only the last call to iput()) and correct (fixes i_blocks
> before writing to disk).  Also, as there is now possibly a longer
> window during which an open file may have an incorrrect block count
> in its on-disk inode, ext2_update_inode adjusts the block count to
> account for preallocated blocks.

Been there, done that.  The problem was that hanging onto the preallocation
will cause separate files to have up-to-seven-block gaps between them.  So
if you put a large number of small files in the same directory, the time to
read them all back is quite significantly impacted: they cover a lot more
disk.

  reply	other threads:[~2006-08-20  6:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-17 19:45 [PATCH] ext2: avoid needless discard of preallocated blocks Ron Yorston
2006-08-20  5:46 ` Andrew Morton [this message]
2006-08-20 11:48   ` Ron Yorston
2006-08-20 15:24     ` Arjan van de Ven
2006-08-20 15:33       ` Val Henson
2006-08-28 19:41         ` Valerie Henson

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=20060819224603.bf687be2.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmy@tigress.co.uk \
    /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