tests: test resize2fs 32->64 and 64->32bit conversion code

Add some simple tests to check that flex_bg and meta_bg filesystems
can be converted between 32 and 64bit layouts.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
crypto
Darrick J. Wong 2014-12-15 12:40:05 -05:00 committed by Theodore Ts'o
parent fe12931f8f
commit 012143a5d7
18 changed files with 1061 additions and 0 deletions

94
tests/r_32to64bit/expect Normal file
View File

@ -0,0 +1,94 @@
resize2fs 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
resize2fs test.img -b
Converting the filesystem to 64-bit.
The filesystem on test.img is now 524288 (1k) blocks long.
Exit status is 0
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 extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
+Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
@@ -15,7 +15,8 @@
First block: 1
Block size: 1024
Fragment size: 1024
-Reserved GDT blocks: 256
+Group descriptor size: 64
+Reserved GDT blocks: 254
Blocks per group: 8192
Fragments per group: 8192
Inodes per group: 1024
@@ -40,16 +41,16 @@
group:block:super:gdt:bbitmap:ibitmap:itable
-0:1:1:2-3:260:276:292
-1:8193:8193:8194-8195:261:277:548
+0:1:1:2-5:260:276:292
+1:8193:8193:8194-8197:261:277:548
2:16385:-1:-1:262:278:804
-3:24577:24577:24578-24579:263:279:1060
+3:24577:24577:24578-24581:263:279:1060
4:32769:-1:-1:264:280:1316
-5:40961:40961:40962-40963:265:281:1572
+5:40961:40961:40962-40965:265:281:1572
6:49153:-1:-1:266:282:1828
-7:57345:57345:57346-57347:267:283:2084
+7:57345:57345:57346-57349:267:283:2084
8:65537:-1:-1:268:284:2340
-9:73729:73729:73730-73731:269:285:2596
+9:73729:73729:73730-73733:269:285:2596
10:81921:-1:-1:270:286:2852
11:90113:-1:-1:271:287:3108
12:98305:-1:-1:272:288:3364
@@ -65,9 +66,9 @@
22:180225:-1:-1:131079:131095:132641
23:188417:-1:-1:131080:131096:132897
24:196609:-1:-1:131081:131097:133153
-25:204801:204801:204802-204803:131082:131098:133409
+25:204801:204801:204802-204805:131082:131098:133409
26:212993:-1:-1:131083:131099:133665
-27:221185:221185:221186-221187:131084:131100:133921
+27:221185:221185:221186-221189:131084:131100:133921
28:229377:-1:-1:131085:131101:134177
29:237569:-1:-1:131086:131102:134433
30:245761:-1:-1:131087:131103:134689
@@ -89,7 +90,7 @@
46:376833:-1:-1:262159:262175:265761
47:385025:-1:-1:262160:262176:266017
48:393217:-1:-1:393217:393233:393249
-49:401409:401409:401410-401411:393218:393234:393505
+49:401409:401409:401410-401413:393218:393234:393505
50:409601:-1:-1:393219:393235:393761
51:417793:-1:-1:393220:393236:394017
52:425985:-1:-1:393221:393237:394273
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/r_32to64bit/name Normal file
View File

@ -0,0 +1 @@
convert flex_bg 32bit fs to 64bit fs

74
tests/r_32to64bit/script Normal file
View File

@ -0,0 +1,74 @@
if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
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
blocksize = 1024
inode_size = 256
make_hugefiles = true
hugefiles_dir = /
hugefiles_slack = 0
hugefiles_name = aaaaa
hugefiles_digits = 4
hugefiles_size = 1M
zero_hugefiles = false
}
ENDL
echo "resize2fs test" > $OUT
MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 524288 >> $OUT 2>&1
rm -rf $CONF
# dump and check
($DUMPE2FS -h $TMPFILE; $DUMPE2FS -g $TMPFILE) 2> /dev/null | 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
# resize it
echo "resize2fs test.img -b" >> $OUT
$RESIZE2FS -b -f $TMPFILE 2>&1 >> $OUT 2>&1
status=$?
echo Exit status is $status >> $OUT
# dump and check
($DUMPE2FS -h $TMPFILE; $DUMPE2FS -g $TMPFILE) 2> /dev/null | 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
else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
echo "$test_name: $test_description: skipped"
fi

View File

@ -0,0 +1,139 @@
resize2fs test
Creating filesystem with 786432 1k blocks and 98304 inodes
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Creating 727 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
resize2fs -b test.img
Converting the filesystem to 64-bit.
The filesystem on test.img is now 786432 (1k) blocks long.
resize2fs test.img
Resizing the filesystem on test.img to 1179648 (1k) blocks.
The filesystem on test.img is now 1179648 (1k) blocks long.
Exit status is 0
Change in FS metadata:
@@ -1,15 +1,15 @@
group:block:super:gdt:bbitmap:ibitmap:itable
-0:1:1:2-7:8:9:10
-1:8193:8193:8194-8199:8200:8201:8202
+0:1:1:2-10:266:267:268
+1:8193:8193:8194-8202:8458:8459:8460
2:16385:-1:-1:16385:16386:16387
-3:24577:24577:24578-24583:24584:24585:24586
+3:24577:24577:24578-24586:24842:24843:24844
4:32769:-1:-1:32769:32770:32771
-5:40961:40961:40962-40967:40968:40969:40970
+5:40961:40961:40962-40970:41226:41227:41228
6:49153:-1:-1:49153:49154:49155
-7:57345:57345:57346-57351:57352:57353:57354
+7:57345:57345:57346-57354:57610:57611:57612
8:65537:-1:-1:65537:65538:65539
-9:73729:73729:73730-73735:73736:73737:73738
+9:73729:73729:73730-73738:73994:73995:73996
10:81921:-1:-1:81921:81922:81923
11:90113:-1:-1:90113:90114:90115
12:98305:-1:-1:98305:98306:98307
@@ -25,9 +25,9 @@
22:180225:-1:-1:180225:180226:180227
23:188417:-1:-1:188417:188418:188419
24:196609:-1:-1:196609:196610:196611
-25:204801:204801:204802-204807:204808:204809:204810
+25:204801:204801:204802-204810:205066:205067:205068
26:212993:-1:-1:212993:212994:212995
-27:221185:221185:221186-221191:221192:221193:221194
+27:221185:221185:221186-221194:221450:221451:221452
28:229377:-1:-1:229377:229378:229379
29:237569:-1:-1:237569:237570:237571
30:245761:-1:-1:245761:245762:245763
@@ -49,7 +49,7 @@
46:376833:-1:-1:376833:376834:376835
47:385025:-1:-1:385025:385026:385027
48:393217:-1:-1:393217:393218:393219
-49:401409:401409:401410-401415:401416:401417:401418
+49:401409:401409:401410-401418:401674:401675:401676
50:409601:-1:-1:409601:409602:409603
51:417793:-1:-1:417793:417794:417795
52:425985:-1:-1:425985:425986:425987
@@ -81,7 +81,7 @@
78:638977:-1:-1:638977:638978:638979
79:647169:-1:-1:647169:647170:647171
80:655361:-1:-1:655361:655362:655363
-81:663553:663553:663554-663559:663560:663561:663562
+81:663553:663553:663554-663562:663818:663819:663820
82:671745:-1:-1:671745:671746:671747
83:679937:-1:-1:679937:679938:679939
84:688129:-1:-1:688129:688130:688131
@@ -96,3 +96,51 @@
93:761857:-1:-1:761857:761858:761859
94:770049:-1:-1:770049:770050:770051
95:778241:-1:-1:778241:778242:778243
+96:786433:-1:-1:786433:786434:786435
+97:794625:-1:-1:794625:794626:794627
+98:802817:-1:-1:802817:802818:802819
+99:811009:-1:-1:811009:811010:811011
+100:819201:-1:-1:819201:819202:819203
+101:827393:-1:-1:827393:827394:827395
+102:835585:-1:-1:835585:835586:835587
+103:843777:-1:-1:843777:843778:843779
+104:851969:-1:-1:851969:851970:851971
+105:860161:-1:-1:860161:860162:860163
+106:868353:-1:-1:868353:868354:868355
+107:876545:-1:-1:876545:876546:876547
+108:884737:-1:-1:884737:884738:884739
+109:892929:-1:-1:892929:892930:892931
+110:901121:-1:-1:901121:901122:901123
+111:909313:-1:-1:909313:909314:909315
+112:917505:-1:-1:917505:917506:917507
+113:925697:-1:-1:925697:925698:925699
+114:933889:-1:-1:933889:933890:933891
+115:942081:-1:-1:942081:942082:942083
+116:950273:-1:-1:950273:950274:950275
+117:958465:-1:-1:958465:958466:958467
+118:966657:-1:-1:966657:966658:966659
+119:974849:-1:-1:974849:974850:974851
+120:983041:-1:-1:983041:983042:983043
+121:991233:-1:-1:991233:991234:991235
+122:999425:-1:-1:999425:999426:999427
+123:1007617:-1:-1:1007617:1007618:1007619
+124:1015809:-1:-1:1015809:1015810:1015811
+125:1024001:1024001:1024002-1024010:1024011:1024012:1024013
+126:1032193:-1:-1:1032193:1032194:1032195
+127:1040385:-1:-1:1040385:1040386:1040387
+128:1048577:-1:-1:1048577:1048578:1048579
+129:1056769:-1:-1:1056769:1056770:1056771
+130:1064961:-1:-1:1064961:1064962:1064963
+131:1073153:-1:-1:1073153:1073154:1073155
+132:1081345:-1:-1:1081345:1081346:1081347
+133:1089537:-1:-1:1089537:1089538:1089539
+134:1097729:-1:-1:1097729:1097730:1097731
+135:1105921:-1:-1:1105921:1105922:1105923
+136:1114113:-1:-1:1114113:1114114:1114115
+137:1122305:-1:-1:1122305:1122306:1122307
+138:1130497:-1:-1:1130497:1130498:1130499
+139:1138689:-1:-1:1138689:1138690:1138691
+140:1146881:-1:-1:1146881:1146882:1146883
+141:1155073:-1:-1:1155073:1155074:1155075
+142:1163265:-1:-1:1163265:1163266:1163267
+143:1171457:-1:-1:1171457:1171458:1171459
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 a totally full filesystem to 64bit, then expand

View File

@ -0,0 +1,83 @@
if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
FSCK_OPT=-fn
OUT=$test_name.log
EXP=$test_dir/expect
CONF=$TMPFILE.conf
#gzip -d < $EXP.gz > $EXP
cat > $CONF << ENDL
[fs_types]
ext4h = {
features = has_journal,extent,huge_file,uninit_bg,dir_nlink,extra_isize,sparse_super,filetype,dir_index,ext_attr,^resize_inode,^meta_bg,^flex_bg
blocksize = 1024
inode_size = 256
make_hugefiles = true
hugefiles_dir = /
hugefiles_slack = 0
hugefiles_name = aaaaa
hugefiles_digits = 4
hugefiles_size = 1M
zero_hugefiles = false
}
ENDL
echo "resize2fs test" > $OUT
MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 786432 >> $OUT 2>&1
rm -rf $CONF
# check
$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
status=$?
echo Exit status is $status >> $OUT
# convert it
echo "resize2fs -b test.img" >> $OUT
$RESIZE2FS -b -f $TMPFILE 2>&1 >> $OUT 2>&1
$DUMPE2FS -g $TMPFILE 2>&1 >> $OUT.before 2> /dev/null
# grow it
echo "resize2fs test.img" >> $OUT
dd if=/dev/zero of=$TMPFILE conv=notrunc bs=1 count=1 seek=1207959552 2> /dev/null
$RESIZE2FS -f $TMPFILE 2>&1 >> $OUT 2>&1
status=$?
echo Exit status is $status >> $OUT
# dump and check
$DUMPE2FS -g $TMPFILE 2>&1 >> $OUT.after 2> /dev/null
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
#
# 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
rm $OUT.before $OUT.after
unset IMAGE FSCK_OPT OUT EXP CONF
else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
echo "$test_name: $test_description: skipped"
fi

View File

@ -0,0 +1,80 @@
resize2fs 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 479 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
resize2fs test.img -b
Converting the filesystem to 64-bit.
The filesystem on test.img is now 524288 (1k) blocks long.
Exit status is 0
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 dir_index filetype meta_bg extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
+Filesystem features: has_journal ext_attr dir_index filetype meta_bg extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
@@ -10,11 +10,12 @@
Inode count: 65536
Block count: 524288
Reserved block count: 26214
-Free blocks: 858
+Free blocks: 852
Free inodes: 65046
First block: 1
Block size: 1024
Fragment size: 1024
+Group descriptor size: 64
Blocks per group: 8192
Fragments per group: 8192
Inodes per group: 1024
@@ -54,9 +55,9 @@
12:98305:-1:-1:15:31:3107
13:106497:-1:-1:16:32:3363
14:114689:-1:-1:17:33:3619
-15:122881:-1:-1:18:34:3875
-16:131073:-1:-1:131073:131089:131105
-17:139265:-1:-1:131074:131090:131361
+15:122881:-1:122881:18:34:3875
+16:131073:-1:131073:135201:131089:131105
+17:139265:-1:139265:131074:131090:131361
18:147457:-1:-1:131075:131091:131617
19:155649:-1:-1:131076:131092:131873
20:163841:-1:-1:131077:131093:132129
@@ -86,9 +87,9 @@
44:360449:-1:-1:262158:262174:265250
45:368641:-1:-1:262159:262175:265506
46:376833:-1:-1:262160:262176:265762
-47:385025:-1:-1:262161:262177:266018
-48:393217:-1:-1:393217:393233:393249
-49:401409:401409:-1:393218:393234:393505
+47:385025:-1:385025:262161:262177:266018
+48:393217:-1:393217:397345:393233:393249
+49:401409:401409:401410:393218:393234:393505
50:409601:-1:-1:393219:393235:393761
51:417793:-1:-1:393220:393236:394017
52:425985:-1:-1:393221:393237:394273
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 meta_bg 32bit fs to 64bit fs

View File

@ -0,0 +1,74 @@
if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
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,meta_bg,^resize_inode
blocksize = 1024
inode_size = 256
make_hugefiles = true
hugefiles_dir = /
hugefiles_slack = 0
hugefiles_name = aaaaa
hugefiles_digits = 4
hugefiles_size = 1M
zero_hugefiles = false
}
ENDL
echo "resize2fs test" > $OUT
MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 524288 >> $OUT 2>&1
rm -rf $CONF
# dump and check
($DUMPE2FS -h $TMPFILE; $DUMPE2FS -g $TMPFILE) 2> /dev/null | 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
# resize it
echo "resize2fs test.img -b" >> $OUT
$RESIZE2FS -b -f $TMPFILE 2>&1 >> $OUT 2>&1
status=$?
echo Exit status is $status >> $OUT
# dump and check
($DUMPE2FS -h $TMPFILE; $DUMPE2FS -g $TMPFILE) 2> /dev/null | 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
else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
echo "$test_name: $test_description: skipped"
fi

View File

@ -0,0 +1,107 @@
resize2fs test
Creating filesystem with 786432 1k blocks and 98304 inodes
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Creating 727 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
resize2fs test.img -b
Converting the filesystem to 64-bit.
The filesystem on test.img is now 786432 (1k) blocks long.
Exit status is 0
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 dir_index filetype extent sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
+Filesystem features: has_journal ext_attr dir_index filetype extent 64bit sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
@@ -10,11 +10,12 @@
Inode count: 98304
Block count: 786432
Reserved block count: 39321
-Free blocks: 764
+Free blocks: 734
Free inodes: 97566
First block: 1
Block size: 1024
Fragment size: 1024
+Group descriptor size: 64
Blocks per group: 8192
Fragments per group: 8192
Inodes per group: 1024
@@ -38,16 +39,16 @@
group:block:super:gdt:bbitmap:ibitmap:itable
-0:1:1:2-4:5:6:7
-1:8193:8193:8194-8196:8197:8198:8199
+0:1:1:2-7:8:9:10
+1:8193:8193:8194-8199:8200:8201:8202
2:16385:-1:-1:16385:16386:16387
-3:24577:24577:24578-24580:24581:24582:24583
+3:24577:24577:24578-24583:24584:24585:24586
4:32769:-1:-1:32769:32770:32771
-5:40961:40961:40962-40964:40965:40966:40967
+5:40961:40961:40962-40967:40968:40969:40970
6:49153:-1:-1:49153:49154:49155
-7:57345:57345:57346-57348:57349:57350:57351
+7:57345:57345:57346-57351:57352:57353:57354
8:65537:-1:-1:65537:65538:65539
-9:73729:73729:73730-73732:73733:73734:73735
+9:73729:73729:73730-73735:73736:73737:73738
10:81921:-1:-1:81921:81922:81923
11:90113:-1:-1:90113:90114:90115
12:98305:-1:-1:98305:98306:98307
@@ -63,9 +64,9 @@
22:180225:-1:-1:180225:180226:180227
23:188417:-1:-1:188417:188418:188419
24:196609:-1:-1:196609:196610:196611
-25:204801:204801:204802-204804:204805:204806:204807
+25:204801:204801:204802-204807:204808:204809:204810
26:212993:-1:-1:212993:212994:212995
-27:221185:221185:221186-221188:221189:221190:221191
+27:221185:221185:221186-221191:221192:221193:221194
28:229377:-1:-1:229377:229378:229379
29:237569:-1:-1:237569:237570:237571
30:245761:-1:-1:245761:245762:245763
@@ -87,7 +88,7 @@
46:376833:-1:-1:376833:376834:376835
47:385025:-1:-1:385025:385026:385027
48:393217:-1:-1:393217:393218:393219
-49:401409:401409:401410-401412:401413:401414:401415
+49:401409:401409:401410-401415:401416:401417:401418
50:409601:-1:-1:409601:409602:409603
51:417793:-1:-1:417793:417794:417795
52:425985:-1:-1:425985:425986:425987
@@ -119,7 +120,7 @@
78:638977:-1:-1:638977:638978:638979
79:647169:-1:-1:647169:647170:647171
80:655361:-1:-1:655361:655362:655363
-81:663553:663553:663554-663556:663557:663558:663559
+81:663553:663553:663554-663559:663560:663561:663562
82:671745:-1:-1:671745:671746:671747
83:679937:-1:-1:679937:679938:679939
84:688129:-1:-1:688129:688130:688131
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 32bit fs to 64bit fs, forcing inode table move

View File

@ -0,0 +1,74 @@
if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
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,uninit_bg,dir_nlink,extra_isize,sparse_super,filetype,dir_index,ext_attr,^resize_inode,^meta_bg,^flex_bg
blocksize = 1024
inode_size = 256
make_hugefiles = true
hugefiles_dir = /
hugefiles_slack = 0
hugefiles_name = aaaaa
hugefiles_digits = 4
hugefiles_size = 1M
zero_hugefiles = false
}
ENDL
echo "resize2fs test" > $OUT
MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 786432 >> $OUT 2>&1
rm -rf $CONF
# dump and check
($DUMPE2FS -h $TMPFILE; $DUMPE2FS -g $TMPFILE) 2> /dev/null | 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
# convert it
echo "resize2fs test.img -b" >> $OUT
$RESIZE2FS -b -f $TMPFILE 2>&1 >> $OUT 2>&1
status=$?
echo Exit status is $status >> $OUT
# dump and check
($DUMPE2FS -h $TMPFILE; $DUMPE2FS -g $TMPFILE) 2> /dev/null | 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
else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
echo "$test_name: $test_description: skipped"
fi

98
tests/r_64to32bit/expect Normal file
View File

@ -0,0 +1,98 @@
resize2fs 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
resize2fs test.img -s
Converting the filesystem to 32-bit.
The filesystem on test.img is now 524288 (1k) blocks long.
Exit status is 0
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 extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
+Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
@@ -10,12 +10,11 @@
Inode count: 65536
Block count: 524288
Reserved block count: 26214
-Free blocks: 571
+Free blocks: 589
Free inodes: 65048
First block: 1
Block size: 1024
Fragment size: 1024
-Group descriptor size: 64
Reserved GDT blocks: 256
Blocks per group: 8192
Fragments per group: 8192
@@ -41,16 +40,16 @@
group:block:super:gdt:bbitmap:ibitmap:itable
-0:1:1:2-5:262:278:294
-1:8193:8193:8194-8197:263:279:550
+0:1:1:2-3:262:278:294
+1:8193:8193:8194-8195:263:279:550
2:16385:-1:-1:264:280:806
-3:24577:24577:24578-24581:265:281:1062
+3:24577:24577:24578-24579:265:281:1062
4:32769:-1:-1:266:282:1318
-5:40961:40961:40962-40965:267:283:1574
+5:40961:40961:40962-40963:267:283:1574
6:49153:-1:-1:268:284:1830
-7:57345:57345:57346-57349:269:285:2086
+7:57345:57345:57346-57347:269:285:2086
8:65537:-1:-1:270:286:2342
-9:73729:73729:73730-73733:271:287:2598
+9:73729:73729:73730-73731:271:287:2598
10:81921:-1:-1:272:288:2854
11:90113:-1:-1:273:289:3110
12:98305:-1:-1:274:290:3366
@@ -66,9 +65,9 @@
22:180225:-1:-1:131079:131095:132641
23:188417:-1:-1:131080:131096:132897
24:196609:-1:-1:131081:131097:133153
-25:204801:204801:204802-204805:131082:131098:133409
+25:204801:204801:204802-204803:131082:131098:133409
26:212993:-1:-1:131083:131099:133665
-27:221185:221185:221186-221189:131084:131100:133921
+27:221185:221185:221186-221187:131084:131100:133921
28:229377:-1:-1:131085:131101:134177
29:237569:-1:-1:131086:131102:134433
30:245761:-1:-1:131087:131103:134689
@@ -90,7 +89,7 @@
46:376833:-1:-1:262159:262175:265761
47:385025:-1:-1:262160:262176:266017
48:393217:-1:-1:393217:393233:393249
-49:401409:401409:401410-401413:393218:393234:393505
+49:401409:401409:401410-401411:393218:393234:393505
50:409601:-1:-1:393219:393235:393761
51:417793:-1:-1:393220:393236:394017
52:425985:-1:-1:393221:393237:394273
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/r_64to32bit/name Normal file
View File

@ -0,0 +1 @@
convert flex_bg 64bit fs to 32bit fs

76
tests/r_64to32bit/script Normal file
View File

@ -0,0 +1,76 @@
if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
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
blocksize = 1024
inode_size = 256
make_hugefiles = true
hugefiles_dir = /
hugefiles_slack = 0
hugefiles_name = aaaaa
hugefiles_digits = 4
hugefiles_size = 1M
zero_hugefiles = false
}
ENDL
echo "resize2fs test" > $OUT
MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 524288 >> $OUT 2>&1
rm -rf $CONF
# dump and check
($DUMPE2FS -h $TMPFILE; $DUMPE2FS -g $TMPFILE) 2> /dev/null | 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
# resize it
echo "resize2fs test.img -s" >> $OUT
$RESIZE2FS -s -f $TMPFILE 2>&1 >> $OUT 2>&1
status=$?
echo Exit status is $status >> $OUT
# dump and check
($DUMPE2FS -h $TMPFILE; $DUMPE2FS -g $TMPFILE) 2> /dev/null | 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
#
# 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
rm $OUT.before $OUT.after
unset IMAGE FSCK_OPT OUT EXP CONF
else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
echo "$test_name: $test_description: skipped"
fi

View File

@ -0,0 +1,80 @@
resize2fs 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 479 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
resize2fs test.img -s
Converting the filesystem to 32-bit.
The filesystem on test.img is now 524288 (1k) blocks long.
Exit status is 0
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 dir_index filetype meta_bg extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
+Filesystem features: has_journal ext_attr dir_index filetype meta_bg extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
@@ -10,12 +10,11 @@
Inode count: 65536
Block count: 524288
Reserved block count: 26214
-Free blocks: 852
+Free blocks: 858
Free inodes: 65046
First block: 1
Block size: 1024
Fragment size: 1024
-Group descriptor size: 64
Blocks per group: 8192
Fragments per group: 8192
Inodes per group: 1024
@@ -55,9 +54,9 @@
12:98305:-1:-1:15:31:3107
13:106497:-1:-1:16:32:3363
14:114689:-1:-1:17:33:3619
-15:122881:-1:122881:18:34:3875
-16:131073:-1:131073:131074:131090:131106
-17:139265:-1:139265:131075:131091:131362
+15:122881:-1:-1:18:34:3875
+16:131073:-1:-1:131074:131090:131106
+17:139265:-1:-1:131075:131091:131362
18:147457:-1:-1:131076:131092:131618
19:155649:-1:-1:131077:131093:131874
20:163841:-1:-1:131078:131094:132130
@@ -87,9 +86,9 @@
44:360449:-1:-1:262158:262174:265250
45:368641:-1:-1:262159:262175:265506
46:376833:-1:-1:262160:262176:265762
-47:385025:-1:385025:262161:262177:266018
-48:393217:-1:393217:393218:393234:393250
-49:401409:401409:401410:393219:393235:393506
+47:385025:-1:-1:262161:262177:266018
+48:393217:-1:-1:393218:393234:393250
+49:401409:401409:-1:393219:393235:393506
50:409601:-1:-1:393220:393236:393762
51:417793:-1:-1:393221:393237:394018
52:425985:-1:-1:393222:393238:394274
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 meta_bg 64bit fs to 32bit fs

View File

@ -0,0 +1,76 @@
if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
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,meta_bg,^resize_inode,64bit
blocksize = 1024
inode_size = 256
make_hugefiles = true
hugefiles_dir = /
hugefiles_slack = 0
hugefiles_name = aaaaa
hugefiles_digits = 4
hugefiles_size = 1M
zero_hugefiles = false
}
ENDL
echo "resize2fs test" > $OUT
MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 524288 >> $OUT 2>&1
rm -rf $CONF
# dump and check
($DUMPE2FS -h $TMPFILE; $DUMPE2FS -g $TMPFILE) 2> /dev/null | 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
# resize it
echo "resize2fs test.img -s" >> $OUT
$RESIZE2FS -s -f $TMPFILE 2>&1 >> $OUT 2>&1
status=$?
echo Exit status is $status >> $OUT
# dump and check
($DUMPE2FS -h $TMPFILE; $DUMPE2FS -g $TMPFILE) 2> /dev/null | 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
#
# 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
rm $OUT.before $OUT.after
unset IMAGE FSCK_OPT OUT EXP CONF
else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
echo "$test_name: $test_description: skipped"
fi