mke2fs: allow creation of journal device with superblock checksum

Enable mke2fs to create an external journal device with a superblock
checksum.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Cc: TR Reardon <thomas_reardon@hotmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
crypto
Darrick J. Wong 2014-09-08 16:12:08 -07:00 committed by Theodore Ts'o
parent fc06f25a10
commit 7a8f497356
4 changed files with 40 additions and 1 deletions

View File

@ -2124,7 +2124,8 @@ profile_error:
reserved_ratio = 0;
fs_param.s_feature_incompat = EXT3_FEATURE_INCOMPAT_JOURNAL_DEV;
fs_param.s_feature_compat = 0;
fs_param.s_feature_ro_compat = 0;
fs_param.s_feature_ro_compat &=
EXT4_FEATURE_RO_COMPAT_METADATA_CSUM;
}
/* Check the user's mkfs options for 64bit */
@ -2743,6 +2744,8 @@ int main (int argc, char *argv[])
/* Check the user's mkfs options for metadata checksumming */
if (!quiet &&
!EXT2_HAS_INCOMPAT_FEATURE(fs->super,
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) &&
EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
if (!EXT2_HAS_INCOMPAT_FEATURE(fs->super,
@ -2909,6 +2912,7 @@ int main (int argc, char *argv[])
if (fs->super->s_feature_incompat &
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
create_journal_dev(fs);
printf("\n");
exit(ext2fs_close_free(&fs) ? 1 : 0);
}

View File

@ -0,0 +1,5 @@
Creating filesystem with 4096 1k blocks and 0 inodes
Superblock backups stored on blocks:
Zeroing journal device: 
Filesystem features: journal_dev metadata_csum

View File

@ -0,0 +1 @@
create external journal with sb checksum (metadata_csum)

View File

@ -0,0 +1,29 @@
FSCK_OPT=-fy
OUT=$test_name.log
if [ -f $test_dir/expect.gz ]; then
EXP=$test_name.tmp
gunzip < $test_dir/expect.gz > $EXP1
else
EXP=$test_dir/expect
fi
cp /dev/null $OUT
$MKE2FS -F -o Linux -b 1024 -O journal_dev,metadata_csum -T ext4 $TMPFILE 4096 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1
$DUMPE2FS -h $TMPFILE 2>&1 | grep 'Filesystem features:' >> $OUT
rm -f $TMPFILE
cmp -s $OUT $EXP
status=$?
if [ "$status" = 0 ] ; then
echo "$test_name: $test_description: ok"
touch $test_name.ok
else
echo "$test_name: $test_description: failed"
diff $DIFF_OPTS $EXP $OUT > $test_name.failed
rm -f $test_name.tmp
fi
unset IMAGE FSCK_OPT OUT EXP