tests: verify rebuilding of sparse extent trees & block map file conversion

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Darrick J. Wong 2015-04-21 10:40:50 -04:00 committed by Theodore Ts'o
parent e228d700d5
commit 2f79cd18a9
31 changed files with 1009 additions and 0 deletions

View File

@ -0,0 +1,16 @@
debugfs: ex /a
Level Entries Logical Physical Length Flags
0/ 1 1/ 1 0 - 0 9 1
1/ 1 1/ 1 0 - 0 10 - 10 1
Pass 1: Checking inodes, blocks, and sizes
Inode 12 extent tree (at level 1) could be shorter. Fix? yes
Pass 1E: Optimizing extent trees
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 12/128 files (0.0% non-contiguous), 19/512 blocks
Exit status is 1

View File

@ -0,0 +1,10 @@
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 12/128 files (0.0% non-contiguous), 19/512 blocks
Exit status is 0
debugfs: ex /a
Level Entries Logical Physical Length Flags
0/ 0 1/ 1 0 - 0 10 - 10 1

Binary file not shown.

View File

@ -0,0 +1 @@
extent tree can be collapsed one level

View File

@ -0,0 +1,118 @@
if [ "$DESCRIPTION"x != x ]; then
test_description="$DESCRIPTION"
fi
if [ "$IMAGE"x = x ]; then
IMAGE=$test_dir/image.gz
fi
if [ "$FSCK_OPT"x = x ]; then
FSCK_OPT=-yf
fi
if [ "$SECOND_FSCK_OPT"x = x ]; then
SECOND_FSCK_OPT=-yf
fi
if [ "$OUT1"x = x ]; then
OUT1=$test_name.1.log
fi
if [ "$OUT2"x = x ]; then
OUT2=$test_name.2.log
fi
if [ "$EXP1"x = x ]; then
if [ -f $test_dir/expect.1.gz ]; then
EXP1=$test_name.1.tmp
gunzip < $test_dir/expect.1.gz > $EXP1
else
EXP1=$test_dir/expect.1
fi
fi
if [ "$EXP2"x = x ]; then
if [ -f $test_dir/expect.2.gz ]; then
EXP2=$test_name.2.tmp
gunzip < $test_dir/expect.2.gz > $EXP2
else
EXP2=$test_dir/expect.2
fi
fi
if [ "$SKIP_GUNZIP" != "true" ] ; then
gunzip < $IMAGE > $TMPFILE
fi
cp /dev/null $OUT1
eval $PREP_CMD
echo 'ex /a' > $TMPFILE.cmd
$DEBUGFS -f $TMPFILE.cmd $TMPFILE > $OUT1.new 2>&1
rm -rf $TMPFILE.cmd
$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT1.new 2>&1
status=$?
echo Exit status is $status >> $OUT1.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1
rm -f $OUT1.new
if [ "$ONE_PASS_ONLY" != "true" ]; then
$FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1
status=$?
echo Exit status is $status >> $OUT2.new
echo 'ex /a' > $TMPFILE.cmd
$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1
rm -rf $TMPFILE.cmd
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2
rm -f $OUT2.new
fi
eval $AFTER_CMD
if [ "$SKIP_VERIFY" != "true" ] ; then
rm -f $test_name.ok $test_name.failed
cmp -s $OUT1 $EXP1
status1=$?
if [ "$ONE_PASS_ONLY" != "true" ]; then
cmp -s $OUT2 $EXP2
status2=$?
else
status2=0
fi
if [ "$PASS_ZERO" = "true" ]; then
cmp -s $test_name.0.log $test_dir/expect.0
status3=$?
else
status3=0
fi
if [ -z "$test_description" ] ; then
description="$test_name"
else
description="$test_name: $test_description"
fi
if [ "$status1" -eq 0 -a "$status2" -eq 0 -a "$status3" -eq 0 ] ; then
echo "$description: ok"
touch $test_name.ok
else
echo "$description: failed"
rm -f $test_name.failed
if [ "$PASS_ZERO" = "true" ]; then
diff $DIFF_OPTS $test_dir/expect.0 \
$test_name.0.log >> $test_name.failed
fi
diff $DIFF_OPTS $EXP1 $OUT1 >> $test_name.failed
if [ "$ONE_PASS_ONLY" != "true" ]; then
diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed
fi
fi
rm -f tmp_expect
fi
if [ "$SKIP_CLEANUP" != "true" ] ; then
unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2
unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD
unset DESCRIPTION SKIP_UNLINK AFTER_CMD PASS_ZERO
fi

View File

@ -0,0 +1,23 @@
debugfs: ex /a
Level Entries Logical Physical Length Flags
0/ 1 1/ 2 0 - 16 9 17
1/ 1 1/ 4 0 - 0 10 - 10 1
1/ 1 2/ 4 11 - 11 100 - 100 1
1/ 1 3/ 4 13 - 13 101 - 101 1
1/ 1 4/ 4 15 - 15 102 - 102 1
0/ 1 2/ 2 17 - 21 12 5
1/ 1 1/ 3 17 - 17 103 - 103 1
1/ 1 2/ 3 19 - 19 104 - 104 1
1/ 1 3/ 3 21 - 21 105 - 105 1
Pass 1: Checking inodes, blocks, and sizes
Inode 12 extent tree (at (level 1) could be narrower. Fix? yes
Pass 1E: Optimizing extent trees
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 12/128 files (8.3% non-contiguous), 26/512 blocks
Exit status is 1

View File

@ -0,0 +1,17 @@
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 12/128 files (8.3% non-contiguous), 26/512 blocks
Exit status is 0
debugfs: ex /a
Level Entries Logical Physical Length Flags
0/ 1 1/ 1 0 - 21 9 22
1/ 1 1/ 7 0 - 0 10 - 10 1
1/ 1 2/ 7 11 - 11 100 - 100 1
1/ 1 3/ 7 13 - 13 101 - 101 1
1/ 1 4/ 7 15 - 15 102 - 102 1
1/ 1 5/ 7 17 - 17 103 - 103 1
1/ 1 6/ 7 19 - 19 104 - 104 1
1/ 1 7/ 7 21 - 21 105 - 105 1

Binary file not shown.

View File

@ -0,0 +1 @@
compress an extent tree level

View File

@ -0,0 +1,118 @@
if [ "$DESCRIPTION"x != x ]; then
test_description="$DESCRIPTION"
fi
if [ "$IMAGE"x = x ]; then
IMAGE=$test_dir/image.gz
fi
if [ "$FSCK_OPT"x = x ]; then
FSCK_OPT=-yf
fi
if [ "$SECOND_FSCK_OPT"x = x ]; then
SECOND_FSCK_OPT=-yf
fi
if [ "$OUT1"x = x ]; then
OUT1=$test_name.1.log
fi
if [ "$OUT2"x = x ]; then
OUT2=$test_name.2.log
fi
if [ "$EXP1"x = x ]; then
if [ -f $test_dir/expect.1.gz ]; then
EXP1=$test_name.1.tmp
gunzip < $test_dir/expect.1.gz > $EXP1
else
EXP1=$test_dir/expect.1
fi
fi
if [ "$EXP2"x = x ]; then
if [ -f $test_dir/expect.2.gz ]; then
EXP2=$test_name.2.tmp
gunzip < $test_dir/expect.2.gz > $EXP2
else
EXP2=$test_dir/expect.2
fi
fi
if [ "$SKIP_GUNZIP" != "true" ] ; then
gunzip < $IMAGE > $TMPFILE
fi
cp /dev/null $OUT1
eval $PREP_CMD
echo 'ex /a' > $TMPFILE.cmd
$DEBUGFS -f $TMPFILE.cmd $TMPFILE > $OUT1.new 2>&1
rm -rf $TMPFILE.cmd
$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT1.new 2>&1
status=$?
echo Exit status is $status >> $OUT1.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1
rm -f $OUT1.new
if [ "$ONE_PASS_ONLY" != "true" ]; then
$FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1
status=$?
echo Exit status is $status >> $OUT2.new
echo 'ex /a' > $TMPFILE.cmd
$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1
rm -rf $TMPFILE.cmd
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2
rm -f $OUT2.new
fi
eval $AFTER_CMD
if [ "$SKIP_VERIFY" != "true" ] ; then
rm -f $test_name.ok $test_name.failed
cmp -s $OUT1 $EXP1
status1=$?
if [ "$ONE_PASS_ONLY" != "true" ]; then
cmp -s $OUT2 $EXP2
status2=$?
else
status2=0
fi
if [ "$PASS_ZERO" = "true" ]; then
cmp -s $test_name.0.log $test_dir/expect.0
status3=$?
else
status3=0
fi
if [ -z "$test_description" ] ; then
description="$test_name"
else
description="$test_name: $test_description"
fi
if [ "$status1" -eq 0 -a "$status2" -eq 0 -a "$status3" -eq 0 ] ; then
echo "$description: ok"
touch $test_name.ok
else
echo "$description: failed"
rm -f $test_name.failed
if [ "$PASS_ZERO" = "true" ]; then
diff $DIFF_OPTS $test_dir/expect.0 \
$test_name.0.log >> $test_name.failed
fi
diff $DIFF_OPTS $EXP1 $OUT1 >> $test_name.failed
if [ "$ONE_PASS_ONLY" != "true" ]; then
diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed
fi
fi
rm -f tmp_expect
fi
if [ "$SKIP_CLEANUP" != "true" ] ; then
unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2
unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD
unset DESCRIPTION SKIP_UNLINK AFTER_CMD PASS_ZERO
fi

View File

@ -0,0 +1,26 @@
debugfs: stat /a
Inode: 12 Type: regular Mode: 0644 Flags: 0x0
Generation: 1573716129 Version: 0x00000000:00000001
User: 0 Group: 0 Size: 524288
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 1030
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5457f87a:62ae2980 -- Mon Nov 3 21:49:46 2014
atime: 0x5457f87a:61ba0598 -- Mon Nov 3 21:49:46 2014
mtime: 0x5457f87a:62ae2980 -- Mon Nov 3 21:49:46 2014
crtime: 0x5457f87a:61ba0598 -- Mon Nov 3 21:49:46 2014
Size of extra inode fields: 28
BLOCKS:
(0-11):1025-1036, (IND):24, (12-267):1037-1292, (DIND):25, (IND):41, (268-511):1293-1536
TOTAL: 515
Pass 1: Checking inodes, blocks, and sizes
Pass 1E: Optimizing extent trees
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 12/128 files (8.3% non-contiguous), 570/2048 blocks
Exit status is 1

View File

@ -0,0 +1,10 @@
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 12/128 files (0.0% non-contiguous), 570/2048 blocks
Exit status is 0
debugfs: ex /a
Level Entries Logical Physical Length Flags
0/ 0 1/ 1 0 - 511 1025 - 1536 512

Binary file not shown.

View File

@ -0,0 +1 @@
convert blockmap file to extents file

117
tests/f_convert_bmap/script Normal file
View File

@ -0,0 +1,117 @@
if [ "$DESCRIPTION"x != x ]; then
test_description="$DESCRIPTION"
fi
if [ "$IMAGE"x = x ]; then
IMAGE=$test_dir/image.gz
fi
if [ "$FSCK_OPT"x = x ]; then
FSCK_OPT=-yf
fi
if [ "$SECOND_FSCK_OPT"x = x ]; then
SECOND_FSCK_OPT=-yf
fi
if [ "$OUT1"x = x ]; then
OUT1=$test_name.1.log
fi
if [ "$OUT2"x = x ]; then
OUT2=$test_name.2.log
fi
if [ "$EXP1"x = x ]; then
if [ -f $test_dir/expect.1.gz ]; then
EXP1=$test_name.1.tmp
gunzip < $test_dir/expect.1.gz > $EXP1
else
EXP1=$test_dir/expect.1
fi
fi
if [ "$EXP2"x = x ]; then
if [ -f $test_dir/expect.2.gz ]; then
EXP2=$test_name.2.tmp
gunzip < $test_dir/expect.2.gz > $EXP2
else
EXP2=$test_dir/expect.2
fi
fi
if [ "$SKIP_GUNZIP" != "true" ] ; then
gunzip < $IMAGE > $TMPFILE
fi
cp /dev/null $OUT1
eval $PREP_CMD
echo 'stat /a' > $TMPFILE.cmd
$DEBUGFS -f $TMPFILE.cmd $TMPFILE > $OUT1.new 2>&1
rm -rf $TMPFILE.cmd
$TUNE2FS -O extent $TMPFILE >> $OUT1.new 2>&1
$FSCK $FSCK_OPT -E bmap2extent -N test_filesys $TMPFILE >> $OUT1.new 2>&1
status=$?
echo Exit status is $status >> $OUT1.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1
rm -f $OUT1.new
$FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1
status=$?
echo Exit status is $status >> $OUT2.new
echo 'ex /a' > $TMPFILE.cmd
$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1
rm -rf $TMPFILE.cmd
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2
rm -f $OUT2.new
eval $AFTER_CMD
if [ "$SKIP_VERIFY" != "true" ] ; then
rm -f $test_name.ok $test_name.failed
cmp -s $OUT1 $EXP1
status1=$?
if [ "$ONE_PASS_ONLY" != "true" ]; then
cmp -s $OUT2 $EXP2
status2=$?
else
status2=0
fi
if [ "$PASS_ZERO" = "true" ]; then
cmp -s $test_name.0.log $test_dir/expect.0
status3=$?
else
status3=0
fi
if [ -z "$test_description" ] ; then
description="$test_name"
else
description="$test_name: $test_description"
fi
if [ "$status1" -eq 0 -a "$status2" -eq 0 -a "$status3" -eq 0 ] ; then
echo "$description: ok"
touch $test_name.ok
else
echo "$description: failed"
rm -f $test_name.failed
if [ "$PASS_ZERO" = "true" ]; then
diff $DIFF_OPTS $test_dir/expect.0 \
$test_name.0.log >> $test_name.failed
fi
diff $DIFF_OPTS $EXP1 $OUT1 >> $test_name.failed
if [ "$ONE_PASS_ONLY" != "true" ]; then
diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed
fi
fi
rm -f tmp_expect
fi
if [ "$SKIP_CLEANUP" != "true" ] ; then
unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2
unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD
unset DESCRIPTION SKIP_UNLINK AFTER_CMD PASS_ZERO
fi

View File

@ -0,0 +1,33 @@
debugfs: stat /a
Inode: 12 Type: regular Mode: 0644 Flags: 0x0
Generation: 1573716129 Version: 0x00000000:00000001
User: 0 Group: 0 Size: 524288
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 1030
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5457f87a:62ae2980 -- Mon Nov 3 21:49:46 2014
atime: 0x5457f87a:61ba0598 -- Mon Nov 3 21:49:46 2014
mtime: 0x5457f87a:62ae2980 -- Mon Nov 3 21:49:46 2014
crtime: 0x5457f87a:61ba0598 -- Mon Nov 3 21:49:46 2014
Size of extra inode fields: 28
BLOCKS:
(0-11):1025-1036, (IND):24, (12-267):1037-1292, (DIND):25, (IND):41, (268-511):1293-1536
TOTAL: 515
debugfs: ex /zero
Level Entries Logical Physical Length Flags
0/ 1 1/ 1 0 - 8 28 9
1/ 1 1/ 4 0 - 0 27 - 27 1
1/ 1 2/ 4 2 - 2 29 - 29 1
1/ 1 3/ 4 4 - 4 31 - 31 1
1/ 1 4/ 4 6 - 6 33 - 33 1
Pass 1: Checking inodes, blocks, and sizes
Pass 1E: Optimizing extent trees
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 13/128 files (15.4% non-contiguous), 574/2048 blocks
Exit status is 1

View File

@ -0,0 +1,16 @@
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 13/128 files (7.7% non-contiguous), 574/2048 blocks
Exit status is 0
debugfs: ex /a
Level Entries Logical Physical Length Flags
0/ 0 1/ 1 0 - 511 1025 - 1536 512
debugfs: ex /zero
Level Entries Logical Physical Length Flags
0/ 0 1/ 4 0 - 0 27 - 27 1
0/ 0 2/ 4 2 - 2 29 - 29 1
0/ 0 3/ 4 4 - 4 31 - 31 1
0/ 0 4/ 4 6 - 6 33 - 33 1

Binary file not shown.

View File

@ -0,0 +1 @@
convert blockmap and extents files to extents files

View File

@ -0,0 +1,119 @@
if [ "$DESCRIPTION"x != x ]; then
test_description="$DESCRIPTION"
fi
if [ "$IMAGE"x = x ]; then
IMAGE=$test_dir/image.gz
fi
if [ "$FSCK_OPT"x = x ]; then
FSCK_OPT=-yf
fi
if [ "$SECOND_FSCK_OPT"x = x ]; then
SECOND_FSCK_OPT=-yf
fi
if [ "$OUT1"x = x ]; then
OUT1=$test_name.1.log
fi
if [ "$OUT2"x = x ]; then
OUT2=$test_name.2.log
fi
if [ "$EXP1"x = x ]; then
if [ -f $test_dir/expect.1.gz ]; then
EXP1=$test_name.1.tmp
gunzip < $test_dir/expect.1.gz > $EXP1
else
EXP1=$test_dir/expect.1
fi
fi
if [ "$EXP2"x = x ]; then
if [ -f $test_dir/expect.2.gz ]; then
EXP2=$test_name.2.tmp
gunzip < $test_dir/expect.2.gz > $EXP2
else
EXP2=$test_dir/expect.2
fi
fi
if [ "$SKIP_GUNZIP" != "true" ] ; then
gunzip < $IMAGE > $TMPFILE
fi
cp /dev/null $OUT1
eval $PREP_CMD
echo 'stat /a' > $TMPFILE.cmd
echo 'ex /zero' >> $TMPFILE.cmd
$DEBUGFS -f $TMPFILE.cmd $TMPFILE > $OUT1.new 2>&1
rm -rf $TMPFILE.cmd
$TUNE2FS -O extent $TMPFILE >> $OUT1.new 2>&1
$FSCK $FSCK_OPT -E bmap2extent -N test_filesys $TMPFILE >> $OUT1.new 2>&1
status=$?
echo Exit status is $status >> $OUT1.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1
rm -f $OUT1.new
$FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1
status=$?
echo Exit status is $status >> $OUT2.new
echo 'ex /a' > $TMPFILE.cmd
echo 'ex /zero' >> $TMPFILE.cmd
$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1
rm -rf $TMPFILE.cmd
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2
rm -f $OUT2.new
eval $AFTER_CMD
if [ "$SKIP_VERIFY" != "true" ] ; then
rm -f $test_name.ok $test_name.failed
cmp -s $OUT1 $EXP1
status1=$?
if [ "$ONE_PASS_ONLY" != "true" ]; then
cmp -s $OUT2 $EXP2
status2=$?
else
status2=0
fi
if [ "$PASS_ZERO" = "true" ]; then
cmp -s $test_name.0.log $test_dir/expect.0
status3=$?
else
status3=0
fi
if [ -z "$test_description" ] ; then
description="$test_name"
else
description="$test_name: $test_description"
fi
if [ "$status1" -eq 0 -a "$status2" -eq 0 -a "$status3" -eq 0 ] ; then
echo "$description: ok"
touch $test_name.ok
else
echo "$description: failed"
rm -f $test_name.failed
if [ "$PASS_ZERO" = "true" ]; then
diff $DIFF_OPTS $test_dir/expect.0 \
$test_name.0.log >> $test_name.failed
fi
diff $DIFF_OPTS $EXP1 $OUT1 >> $test_name.failed
if [ "$ONE_PASS_ONLY" != "true" ]; then
diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed
fi
fi
rm -f tmp_expect
fi
if [ "$SKIP_CLEANUP" != "true" ] ; then
unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2
unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD
unset DESCRIPTION SKIP_UNLINK AFTER_CMD PASS_ZERO
fi

View File

@ -0,0 +1,23 @@
debugfs: ex /a
Level Entries Logical Physical Length Flags
0/ 7 1/ 1 0 - 0 12 1
1/ 7 1/ 1 0 - 0 13 1
2/ 7 1/ 1 0 - 0 14 1
3/ 7 1/ 1 0 - 0 15 1
4/ 7 1/ 1 0 - 0 16 1
5/ 7 1/ 1 0 - 0 17 1
6/ 7 1/ 1 0 - 0 9 1
7/ 7 1/ 1 0 - 0 10 - 10 1
Pass 1: Checking inodes, blocks, and sizes
Inode 12 extent tree could be more shallow (7; could be <= 4)
Fix? yes
Pass 1E: Optimizing extent trees
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 12/128 files (0.0% non-contiguous), 19/512 blocks
Exit status is 1

View File

@ -0,0 +1,10 @@
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 12/128 files (0.0% non-contiguous), 19/512 blocks
Exit status is 0
debugfs: ex /a
Level Entries Logical Physical Length Flags
0/ 0 1/ 1 0 - 0 10 - 10 1

Binary file not shown.

View File

@ -0,0 +1 @@
extent tree is deeper than it needs to be

View File

@ -0,0 +1,118 @@
if [ "$DESCRIPTION"x != x ]; then
test_description="$DESCRIPTION"
fi
if [ "$IMAGE"x = x ]; then
IMAGE=$test_dir/image.gz
fi
if [ "$FSCK_OPT"x = x ]; then
FSCK_OPT=-yf
fi
if [ "$SECOND_FSCK_OPT"x = x ]; then
SECOND_FSCK_OPT=-yf
fi
if [ "$OUT1"x = x ]; then
OUT1=$test_name.1.log
fi
if [ "$OUT2"x = x ]; then
OUT2=$test_name.2.log
fi
if [ "$EXP1"x = x ]; then
if [ -f $test_dir/expect.1.gz ]; then
EXP1=$test_name.1.tmp
gunzip < $test_dir/expect.1.gz > $EXP1
else
EXP1=$test_dir/expect.1
fi
fi
if [ "$EXP2"x = x ]; then
if [ -f $test_dir/expect.2.gz ]; then
EXP2=$test_name.2.tmp
gunzip < $test_dir/expect.2.gz > $EXP2
else
EXP2=$test_dir/expect.2
fi
fi
if [ "$SKIP_GUNZIP" != "true" ] ; then
gunzip < $IMAGE > $TMPFILE
fi
cp /dev/null $OUT1
eval $PREP_CMD
echo 'ex /a' > $TMPFILE.cmd
$DEBUGFS -f $TMPFILE.cmd $TMPFILE > $OUT1.new 2>&1
rm -rf $TMPFILE.cmd
$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT1.new 2>&1
status=$?
echo Exit status is $status >> $OUT1.new
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1
rm -f $OUT1.new
if [ "$ONE_PASS_ONLY" != "true" ]; then
$FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1
status=$?
echo Exit status is $status >> $OUT2.new
echo 'ex /a' > $TMPFILE.cmd
$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1
rm -rf $TMPFILE.cmd
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2
rm -f $OUT2.new
fi
eval $AFTER_CMD
if [ "$SKIP_VERIFY" != "true" ] ; then
rm -f $test_name.ok $test_name.failed
cmp -s $OUT1 $EXP1
status1=$?
if [ "$ONE_PASS_ONLY" != "true" ]; then
cmp -s $OUT2 $EXP2
status2=$?
else
status2=0
fi
if [ "$PASS_ZERO" = "true" ]; then
cmp -s $test_name.0.log $test_dir/expect.0
status3=$?
else
status3=0
fi
if [ -z "$test_description" ] ; then
description="$test_name"
else
description="$test_name: $test_description"
fi
if [ "$status1" -eq 0 -a "$status2" -eq 0 -a "$status3" -eq 0 ] ; then
echo "$description: ok"
touch $test_name.ok
else
echo "$description: failed"
rm -f $test_name.failed
if [ "$PASS_ZERO" = "true" ]; then
diff $DIFF_OPTS $test_dir/expect.0 \
$test_name.0.log >> $test_name.failed
fi
diff $DIFF_OPTS $EXP1 $OUT1 >> $test_name.failed
if [ "$ONE_PASS_ONLY" != "true" ]; then
diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed
fi
fi
rm -f tmp_expect
fi
if [ "$SKIP_CLEANUP" != "true" ] ; then
unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2
unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD
unset DESCRIPTION SKIP_UNLINK AFTER_CMD PASS_ZERO
fi

55
tests/f_opt_extent/expect Normal file
View File

@ -0,0 +1,55 @@
tune2fs metadata_csum test
Creating filesystem with 524288 1k blocks and 65536 inodes
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Creating 477 huge file(s) with 1024 blocks each: done
Writing superblocks and filesystem accounting information: done
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Exit status is 0
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Change in FS metadata:
@@ -10,7 +10,7 @@
Inode count: 65536
Block count: 524288
Reserved block count: 26214
-Free blocks: 570
+Free blocks: 567
Free inodes: 65047
First block: 1
Block size: 1024
@@ -47,8 +47,8 @@
Block bitmap at 262 (+261)
Inode bitmap at 278 (+277)
Inode table at 294-549 (+293)
- 21 free blocks, 535 free inodes, 3 directories, 535 unused inodes
- Free blocks: 4414-4434
+ 18 free blocks, 535 free inodes, 3 directories, 535 unused inodes
+ Free blocks: 4417-4434
Free inodes: 490-1024
Group 1: (Blocks 8193-16384) [INODE_UNINIT]
Backup superblock at 8193, Group descriptors at 8194-8197
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Exit status is 0

1
tests/f_opt_extent/name Normal file
View File

@ -0,0 +1 @@
optimize extent tree

64
tests/f_opt_extent/script Normal file
View File

@ -0,0 +1,64 @@
FSCK_OPT=-fn
OUT=$test_name.log
EXP=$test_dir/expect
CONF=$TMPFILE.conf
cat > $CONF << ENDL
[fs_types]
ext4h = {
features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,sparse_super,filetype,dir_index,ext_attr,resize_inode,64bit,metadata_csum
blocksize = 1024
inode_size = 256
make_hugefiles = true
hugefiles_dir = /xyz
hugefiles_slack = 0
hugefiles_name = aaaaa
hugefiles_digits = 4
hugefiles_size = 1M
zero_hugefiles = false
}
ENDL
echo "tune2fs metadata_csum test" > $OUT
MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 524288 >> $OUT 2>&1
rm -rf $CONF
# dump and check
$DUMPE2FS $TMPFILE 2> /dev/null | grep '^Group 0:' -B99 -A20 | sed -f $cmd_dir/filter.sed > $OUT.before
$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
status=$?
echo Exit status is $status >> $OUT
# check
$FSCK -fyD -N test_filesys $TMPFILE >> $OUT 2>&1
# dump and check
$DUMPE2FS $TMPFILE 2> /dev/null | grep '^Group 0:' -B99 -A20 | sed -f $cmd_dir/filter.sed > $OUT.after
echo "Change in FS metadata:" >> $OUT
diff -u $OUT.before $OUT.after | tail -n +3 >> $OUT
$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
status=$?
echo Exit status is $status >> $OUT
rm $TMPFILE $OUT.before $OUT.after
#
# Do the verification
#
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new
mv $OUT.new $OUT
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
fi
unset IMAGE FSCK_OPT OUT EXP CONF

View File

@ -0,0 +1,44 @@
rebuild extent metadata_csum test
Creating filesystem with 524288 1k blocks and 65536 inodes
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
mke2fs: Operation not supported for inodes containing extents while creating huge files
Writing superblocks and filesystem accounting information: done
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Exit status is 0
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Change in FS metadata:
@@ -2,7 +2,7 @@
Last mounted on: <not available>
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
-Filesystem features: has_journal ext_attr resize_inode dir_index filetype sparse_super large_file huge_file dir_nlink
+Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent sparse_super large_file huge_file dir_nlink
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Exit status is 0

View File

@ -0,0 +1 @@
convert ext3 to extent tree

View File

@ -0,0 +1,65 @@
FSCK_OPT=-fn
OUT=$test_name.log
EXP=$test_dir/expect
CONF=$TMPFILE.conf
cat > $CONF << ENDL
[fs_types]
ext4h = {
features = has_journal,^extent,huge_file,^flex_bg,^uninit_bg,dir_nlink,^extra_isize,sparse_super,filetype,dir_index,ext_attr,resize_inode,^64bit,^metadata_csum
blocksize = 1024
inode_size = 256
make_hugefiles = true
hugefiles_dir = /
num_hugefiles = 100
hugefiles_slack = 0
hugefiles_name = aaaaa
hugefiles_digits = 4
hugefiles_size = 1M
zero_hugefiles = false
}
ENDL
echo "rebuild extent metadata_csum test" > $OUT
MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 524288 >> $OUT 2>&1
rm -rf $CONF
# dump and check
$DUMPE2FS $TMPFILE 2> /dev/null | grep '^Group 0:' -B99 -A20 | sed -f $cmd_dir/filter.sed > $OUT.before
$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
status=$?
echo Exit status is $status >> $OUT
# check
$FSCK -fyD -N test_filesys -E bmap2extent $TMPFILE >> $OUT 2>&1
# dump and check
$DUMPE2FS $TMPFILE 2> /dev/null | grep '^Group 0:' -B99 -A20 | sed -f $cmd_dir/filter.sed > $OUT.after
echo "Change in FS metadata:" >> $OUT
diff -u $OUT.before $OUT.after | tail -n +3 >> $OUT
$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
status=$?
echo Exit status is $status >> $OUT
rm $TMPFILE $OUT.before $OUT.after
#
# Do the verification
#
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new
mv $OUT.new $OUT
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
fi
unset IMAGE FSCK_OPT OUT EXP CONF