resize2fs: fix regression test to not depend on ext4.ko being loaded

The behavior of the r_fixup_lastbg_big test varies depending on
whether or not ext4.ko is loaded and supports lazy_itable_init.  This
makes checking the bg flags after resize2fs hard to predict, so put in
a way to force resize2fs to zero the inode tables, and compare the
output based on lazy_itable_init == 0.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
crypto
Darrick J. Wong 2015-01-27 13:10:47 -05:00 committed by Theodore Ts'o
parent 5f0164b3a4
commit f21c30d90c
3 changed files with 6 additions and 3 deletions

View File

@ -904,7 +904,8 @@ retry:
group_block = ext2fs_group_first_block2(fs,
old_fs->group_desc_count);
csum_flag = ext2fs_has_group_desc_csum(fs);
if (access("/sys/fs/ext4/features/lazy_itable_init", F_OK) == 0)
if (!getenv("RESIZE2FS_FORCE_ITABLE_INIT") &&
access("/sys/fs/ext4/features/lazy_itable_init", F_OK) == 0)
lazy_itable_init = 1;
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
old_desc_blocks = fs->super->s_first_meta_bg;

View File

@ -22,6 +22,8 @@ Group 2: (Blocks 16385-19999)
Free blocks: 16385-19999
Free inodes: 833-1248
Resizing the filesystem on test.img to 40000 (1k) blocks.
Begin pass 1 (max = 2)
Extending the inode table ----------------------------------------XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on test.img is now 40000 (1k) blocks long.
Group 2: (Blocks 16385-24576) [INODE_UNINIT, BLOCK_UNINIT]
@ -31,7 +33,7 @@ Group 2: (Blocks 16385-24576) [INODE_UNINIT, BLOCK_UNINIT]
8192 free blocks, 416 free inodes, 0 directories, 416 unused inodes
Free blocks: 16385-24576
Free inodes: 833-1248
Group 3: (Blocks 24577-32768) [INODE_UNINIT]
Group 3: (Blocks 24577-32768) [INODE_UNINIT, ITABLE_ZEROED]
Backup superblock at 24577, Group descriptors at 24578-24578
Reserved GDT blocks at 24579-24656
Block bitmap at 413 (bg #0 + 412)

View File

@ -13,7 +13,7 @@ $DEBUGFS -R "set_bg 2 flags 0" -w $TMPFILE > /dev/null 2>&1
$DEBUGFS -R "set_bg 2 checksum 0xd318" -w $TMPFILE > /dev/null 2>&1
$DUMPE2FS $TMPFILE 2>&1 | grep -A10 '^Group 2:' >> $OUT
dd if=/dev/zero of=$TMPFILE bs=1 count=1 seek=$((1024 * 40000)) conv=notrunc >> $OUT 2> /dev/null
$RESIZE2FS_EXE -f -p $TMPFILE >> $OUT 2>&1
RESIZE2FS_FORCE_ITABLE_INIT=1 $RESIZE2FS_EXE -f -p $TMPFILE >> $OUT 2>&1
$DUMPE2FS $TMPFILE 2>&1 | grep -A10 '^Group 2:' >> $OUT
$E2FSCK -fy $TMPFILE >> $OUT 2>&1