-
Jeff Garzik authored
At present, when mounted synchronously or with `chattr +S' in effect, ext2 syncs the indirect blocks for every new block when extending a file. This is not necessary, because a sync is performed on the way out of generic_file_write(). This will pick up all necessary data from inode->i_dirty_buffers and inode->i_dirty_data_buffers, and is sufficient. The patch removes all the syncing of indirect blocks. On a non-write-caching scsi disk, an untar of the util-linux tarball runs three times faster. Writing a 100 megabyte file in one megabyte chunks speeds up ten times. The patch also removes the intermediate indirect block syncing on the truncate() path. Instead, we sync the indirects at a single place, via inode->i_dirty_buffers. This not only means that the writes (may) cluster better. It means that we perform much, much less actual I/O during truncate, because most or all of the indirects will no longer be needed for the file, and will be invalidated. fsync() and msync() still work correctly. One side effect of this patch is that VM-initiated writepage() against a file hole will no longer block on writeout of indirect blocks. This is good.
9950435b