[PATCH 08/25] dumpe2fs: display external journal feature flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Display the feature flags of an external journal.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
Reported-by: TR Reardon <thomas_reardon@xxxxxxxxxxx>
---
 misc/dumpe2fs.c               |   14 ++++++++++
 tests/j_ext_dumpe2fs/expect   |   55 +++++++++++++++++++++++++++++++++++++++++
 tests/j_ext_dumpe2fs/image.gz |  Bin
 tests/j_ext_dumpe2fs/name     |    1 +
 tests/j_ext_dumpe2fs/script   |   40 ++++++++++++++++++++++++++++++
 5 files changed, 109 insertions(+), 1 deletion(-)
 create mode 100644 tests/j_ext_dumpe2fs/expect
 create mode 100644 tests/j_ext_dumpe2fs/image.gz
 create mode 100644 tests/j_ext_dumpe2fs/name
 create mode 100644 tests/j_ext_dumpe2fs/script


diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index 25dce9c..4c7bf46 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -433,8 +433,9 @@ static void print_journal_information(ext2_filsys fs)
 	errcode_t	retval;
 	char		buf[1024];
 	char		str[80];
-	unsigned int	i;
+	unsigned int	i, j, printed = 0;
 	journal_superblock_t	*jsb;
+	__u32			*mask_ptr, mask, m;
 
 	/* Get the journal superblock */
 	if ((retval = io_channel_read_blk64(fs->io,
@@ -465,6 +466,17 @@ static void print_journal_information(ext2_filsys fs)
 		       journal_checksum_type_str(jsb->s_checksum_type),
 		       ext2fs_be32_to_cpu(jsb->s_checksum));
 
+	printf("%s", _("Journal features:        "));
+	for (i = 0, mask_ptr = &jsb->s_feature_compat; i < 3; i++, mask_ptr++) {
+		mask = be32_to_cpu(*mask_ptr);
+		for (j = 0, m = 1; j < 32; j++, m <<= 1) {
+			if (mask & m) {
+				printf(" %s", e2p_jrnl_feature2string(i, m));
+				printed++;
+			}
+		}
+	}
+
 	printf(_("\nJournal block size:       %u\n"
 		 "Journal length:           %u\n"
 		 "Journal first block:      %u\n"
diff --git a/tests/j_ext_dumpe2fs/expect b/tests/j_ext_dumpe2fs/expect
new file mode 100644
index 0000000..c75f74c
--- /dev/null
+++ b/tests/j_ext_dumpe2fs/expect
@@ -0,0 +1,55 @@
+e2fsck external journal
+../e2fsck/e2fsck: Filesystem has unsupported feature(s) while trying to open test.img
+
+The superblock could not be read or does not describe a valid ext2/ext3/ext4
+filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
+filesystem (and not swap or ufs or something else), then the superblock
+is corrupt, and you might try running e2fsck with an alternate superblock:
+    e2fsck -b 8193 <device>
+ or
+    e2fsck -b 32768 <device>
+
+Exit status is 8
+dumpe2fs external journal
+Filesystem volume name:   <none>
+Last mounted on:          <not available>
+Filesystem magic number:  0xEF53
+Filesystem revision #:    1 (dynamic)
+Filesystem features:      journal_dev metadata_csum
+Default mount options:    user_xattr acl block_validity
+Filesystem state:         clean
+Errors behavior:          Continue
+Filesystem OS type:       Linux
+Inode count:              0
+Block count:              2048
+Reserved block count:     0
+Free blocks:              0
+Free inodes:              0
+First block:              1
+Block size:               1024
+Fragment size:            1024
+Blocks per group:         8192
+Fragments per group:      8192
+Inodes per group:         0
+Inode blocks per group:   0
+Mount count:              0
+Check interval:           0 (<none>)
+Reserved blocks uid:      0
+Reserved blocks gid:      0
+First inode:              11
+Inode size:	          256
+Required extra isize:     28
+Desired extra isize:      28
+Default directory hash:   half_md4
+Checksum type:            crc32c
+Checksum:                 0x3a9935ab
+Journal checksum type:    crc32c
+Journal checksum:         0x661e816f
+Journal features:         journal_64bit journal_checksum_v3
+Journal block size:       1024
+Journal length:           2048
+Journal first block:      3
+Journal sequence:         0x00000003
+Journal start:            0
+Journal number of users:  1
+Journal users:            117f752e-f27d-4f6f-a652-072586a29b82
diff --git a/tests/j_ext_dumpe2fs/image.gz b/tests/j_ext_dumpe2fs/image.gz
new file mode 100644
index 0000000000000000000000000000000000000000..781b591c0f81778a4209096878b15bc0be99e04e
GIT binary patch
literal 2963
z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sDGfIj5jiB9z}1_UCg*Wa8sAj(h72*zv3VB;m2z~O}V>Lf+<
zy*DrDx*c_$p?&<~uB7xx12A`^O}d*ia^zr$)KjT}^NY7w=i}xSlvvFNe7xBHdXE9|
z27u_eyj5f%J`BOW>luj>vB%273vYAv&-^>%$8zu1BiS>Fu&y?MDPR`s1Tq53v`D-F
zN#qy9ItyX3dAAH{50VCtjjGAu9=qMtu=POV%FqsK9u{e~-XZke6B=^NGo-!H&X+vg
gaSONw+yZU^w}4yVe<^UKcQ&KvGxI(Vk3Am$0x-=eNB{r;

literal 0
HcmV?d00001

diff --git a/tests/j_ext_dumpe2fs/name b/tests/j_ext_dumpe2fs/name
new file mode 100644
index 0000000..60d276c
--- /dev/null
+++ b/tests/j_ext_dumpe2fs/name
@@ -0,0 +1 @@
+dumpe2fs of external journal device
diff --git a/tests/j_ext_dumpe2fs/script b/tests/j_ext_dumpe2fs/script
new file mode 100644
index 0000000..1611c45
--- /dev/null
+++ b/tests/j_ext_dumpe2fs/script
@@ -0,0 +1,40 @@
+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
+
+gunzip < $test_dir/image.gz > $TMPFILE
+
+echo "e2fsck external journal" >> $OUT
+$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT.new
+sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
+rm -f $OUT.new
+
+echo "dumpe2fs external journal" >> $OUT
+$DUMPE2FS $TMPFILE > $OUT.new 2>&1
+sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
+rm -f $OUT.new
+
+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

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux