From: Darrick J. Wong Date: Sun, 14 Dec 2014 03:01:15 +0000 (-0500) Subject: mke2fs: don't zero inode table blocks that are already zeroed X-Git-Tag: v1.43-WIP-2015-05-18~110 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5effd0a02283922dd53102ff409a4382fa1dfed7;p=thirdparty%2Fe2fsprogs.git mke2fs: don't zero inode table blocks that are already zeroed At mke2fs time, if we discard the device and discard zeroes data, don't bother zeroing the inode table blocks a second time. Signed-off-by: Darrick J. Wong Signed-off-by: Theodore Ts'o --- diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 0a0d2b334..aeb852f04 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -421,12 +421,14 @@ static void write_inode_tables(ext2_filsys fs, int lazy_flag, int itable_zeroed) ext2fs_bg_flags_set(fs, i, EXT2_BG_INODE_ZEROED); ext2fs_group_desc_csum_set(fs, i); } - retval = ext2fs_zero_blocks2(fs, blk, num, &blk, &num); - if (retval) { - fprintf(stderr, _("\nCould not write %d " - "blocks in inode table starting at %llu: %s\n"), - num, blk, error_message(retval)); - exit(1); + if (!itable_zeroed) { + retval = ext2fs_zero_blocks2(fs, blk, num, &blk, &num); + if (retval) { + fprintf(stderr, _("\nCould not write %d " + "blocks in inode table starting at %llu: %s\n"), + num, blk, error_message(retval)); + exit(1); + } } if (sync_kludge) { if (sync_kludge == 1)