On Tue, Jun 14, 2016 at 10:37:16AM +0800, Wang Xiaoguang wrote: > Hello, > > Thanks for reviewing. > > On 06/08/2016 04:55 PM, Eryu Guan wrote: [snip] > >>+ > >>+loop_dev1=`_create_loop_device $fs_img1` > >>+loop_dev2=`_create_loop_device $fs_img2` > >You're using two loop devices and one is used as external journal > >device, I think test on SCRATCH_DEV should be fine, e.g. > > > >_scratch_mkfs_sized a 8M ext4 filesystem, then use a script to find the > >journal superblock on disk, then modify the journal.s_sequence according > >to the location of journal superblock and the offset of s_sequence to > >it. I use the following script to do all this: > > > >#/bin/bash > >dev=$1 > >mkfs -t ext4 $dev 8M > >blocksize=`dumpe2fs -h $dev 2>/dev/null | grep "Block size" | awk '{print $3}'` > >offset=0 > >found=0 > ># this is the jbd2 journal superblock magic number on disk, in big endian > >magic="c0 3b 39 98" > > > ># 8M in bytes > >filesize=$((8 * 1024 * 1024)) > >while [ $offset -lt $filesize ]; do > > if | grep -i "$magic";then > > echo "Found journal: $offset" > > found=1 > > break > > fi > > offset=$((offset + blocksize)) > >done > Thanks for your script, but I wonder whether there will be some other > metadata which would have the same magic number "c0 3b 39 98", such > as ext4 super_block or block_group_description. I don't think so. If they have the same magic number, it looks like a bug to me. Thanks, Eryu -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html