diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2014-10-13 04:31:17 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-10-13 04:31:17 -0400 |
commit | 08c8e319e3e11e30eb8c0b65809d434e807a4456 (patch) | |
tree | b3c157db214b25ffc042e9f62ad597d72f4d58bf /e2fsck/pass3.c | |
parent | 6a0f113535cdc4937b60f763667a545183b98c85 (diff) | |
download | e2fsprogs-08c8e319e3e11e30eb8c0b65809d434e807a4456.tar.gz |
libext2fs/e2fsck: refactor everyone who writes zero blocks to disk
Convert all call sites that write zero blocks to disk to use
ext2fs_zero_blocks2() since it can use Linux's zero out feature to do
the writes more quickly. Reclaim the zero buffer at freefs time and
make the write-zeroes fallback use a larger buffer.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'e2fsck/pass3.c')
-rw-r--r-- | e2fsck/pass3.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c index f03c7aec..2d94ece8 100644 --- a/e2fsck/pass3.c +++ b/e2fsck/pass3.c @@ -809,20 +809,13 @@ static int expand_dir_proc(ext2_filsys fs, es->num--; retval = ext2fs_write_dir_block4(fs, new_blk, block, 0, es->dir); - } else { - retval = ext2fs_get_mem(fs->blocksize, &block); - if (retval) { - es->err = retval; - return BLOCK_ABORT; - } - memset(block, 0, fs->blocksize); - retval = io_channel_write_blk64(fs->io, new_blk, 1, block); - } + ext2fs_free_mem(&block); + } else + retval = ext2fs_zero_blocks2(fs, new_blk, 1, NULL, NULL); if (retval) { es->err = retval; return BLOCK_ABORT; } - ext2fs_free_mem(&block); *blocknr = new_blk; ext2fs_mark_block_bitmap2(ctx->block_found_map, new_blk); |