1test_description="fix up last bg when expanding beyond the last bg" 2if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then 3 echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" 4 return 0 5fi 6 7EXP=$test_dir/expect 8OUT=$test_name.log 9E2FSCK=../e2fsck/e2fsck 10 11$MKE2FS -T ext4 -b 1024 -F -U 56d3ee50-8532-4f29-8181-d7c6ea4a94a6 $TMPFILE 20000 > $OUT 2>&1 12$DUMPE2FS $TMPFILE 2>&1 | grep -A10 '^Group 2:' >> $OUT 13$DEBUGFS -R "set_bg 2 itable_unused 0" -w $TMPFILE > /dev/null 2>&1 14$DEBUGFS -R "set_bg 2 flags 0" -w $TMPFILE > /dev/null 2>&1 15$DEBUGFS -R "set_bg 2 checksum 0xd318" -w $TMPFILE > /dev/null 2>&1 16$DUMPE2FS $TMPFILE 2>&1 | grep -A10 '^Group 2:' >> $OUT 17dd if=/dev/zero of=$TMPFILE bs=1 count=1 seek=$((1024 * 40000)) conv=notrunc >> $OUT 2> /dev/null 18( 19RESIZE2FS_FORCE_ITABLE_INIT=1 20export RESIZE2FS_FORCE_ITABLE_INIT 21unset RESIZE2FS_FORCE_LAZY_ITABLE_INIT 22$RESIZE2FS_EXE -f -p $TMPFILE >> $OUT 2>&1 23) 24$DUMPE2FS $TMPFILE 2>&1 | grep -A10 '^Group 2:' >> $OUT 25$E2FSCK -fy $TMPFILE >> $OUT 2>&1 26 27sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" < $OUT > $OUT.new 28mv $OUT.new $OUT 29 30cmp -s $OUT $EXP 31status=$? 32if [ $status -eq 0 ]; then 33 echo "$test_name: $test_description: ok" 34 touch $test_name.ok 35else 36 echo "$test_name: $test_description: failed" 37 diff -u $EXP $OUT > $test_name.failed 38fi 39 40unset EXP OUT E2FSCK 41