[lkml]   [2001]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: O_TRUNC problem on a full filesystem
Andrew writes:
> "Stephen C. Tweedie" wrote:
> > On Wed, May 23, 2001 at 07:55:48PM +1000, Andrew Morton wrote:
> > > When you truncated your file, the blocks remained preallocated
> > > on behalf of the file, and were hence considered "used". For
> > > some reason, a subsequent attempt to allocate blocks for the
> > > same file failed to use that file's preallocated blocks.
> >
> > Nope. ext2_truncate() calls ext2_discard_prealloc() to fix this up.
> > Both 2.2 and 2.4 do this correctly.
> But the problem goes away when you disable EXT2_PREALLOCATE.
> I tested it.

Are you sure that a truncated file will re-use the same truncated blocks,
but not the preallocated ones? I can imagine not re-using all of the data
blocks within a single transaction, but it would be odd if the preallocated
blocks are treated differently.

How have you done the ext3 preallocation code? One way to do it would be
to only mark the blocks as used in the in-memory copy of the block bitmap
and not write that to disk (we keep 2 copies of the block bitmap, IIRC).
That way you don't need to do anything fancy at recovery time.

Did you ever benchmark ext2 with and without preallocation to see if it
made any difference? No point in doing extra work if there is no benefit.

Cheers, Andreas
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?" -- Dogbert
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: 2005-03-22 13:17    [W:0.066 / U:13.064 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site