Skip to content

Commit

Permalink
mke2fs: don't zero inode table blocks that are already zeroed
Browse files Browse the repository at this point in the history
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 <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
djwong authored and tytso committed Dec 14, 2014
1 parent 77905d7 commit 5effd0a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions misc/mke2fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5effd0a

Please sign in to comment.