> 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 preallocationwill cause separate files to have up-to-seven-block gaps between them. Soif you put a large number of small files in the same directory, the time toread them all back is quite significantly impacted: they cover a lot moredisk.-To unsubscribe from this list: send the line "unsubscribe linux-kernel" inthe body of a message to majordomo@vger.kernel.orgMore majordomo info at http://vger.kernel.org/majordomo-info.htmlPlease read the FAQ at http://www.tux.org/lkml/