Messages in this thread | | | From | Andreas Dilger <> | Subject | Re: O_TRUNC problem on a full filesystem | Date | Thu, 24 May 2001 11:24:10 -0600 (MDT) |
| |
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?" http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |