[lkml]   [2006]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] ext2: avoid needless discard of preallocated blocks
On Thu, 17 Aug 2006 20:45:36 +0100
Ron Yorston <> 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
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-08-20 08:21    [W:0.050 / U:1.760 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site