On Mar 20, 2008 23:26 +0530, Aneesh Kumar K.V wrote: > On Thu, Mar 20, 2008 at 10:29:50AM -0700, Mingming Cao wrote: > > On Thu, 2008-03-20 at 11:09 +0530, Aneesh Kumar K.V wrote: > > > > Could you try the following patch? It updates the i_disksize at the > > > > write_end time. > > > > > > I will test the patch and update you. BTW shouldn't we update > > > i_disksize only after actual block got allocated ? > > > > Hmm...I am not 100% sure but I think we should not to change the > > behavior that the on-disk inode size should be updated when write() > > returns to user. Right now the in-memory inode size is updated, user > > would expecting the same when they run e2fsck, but e2fsck reads inode > > size from disk. Pushing the inode i_disksize update at the writeout > > (allocation) time will cause the window that i_size is different than > > the i_disksize being enlarged quite big. > > If we are updating i_disksize during write_end and if we crash before actually > allocating the blocks e2fsck will find errors because the inode doesn't > really have that many blocks right ? No, it would just think the file is sparse and return \0 for the reads. That said, I don't agree with Mingming - the i_disksize should only be increased at the time the blocks are allocated on disk and not when the file is extended in memory. Even if the window where i_size is different than i_disksize is large, this is only important after a crash, and at that time ordered mode users want the file to have a shorter i_disksize and the file contains only valid data, instead of the extended i_size but the file contains \0 bytes at the end. Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc. -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html