aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2020-02-13 11:16:00 +0100
committerTheodore Ts'o <tytso@mit.edu>2020-03-15 12:33:23 -0400
commit31fff03fa8af5b581175830cbe75890e9bf630d1 (patch)
tree97aa4f51d35f3a0feeb33de0ed81017f46889b53
parent9a4d2dcc8deaa1c28b3a713c2f610be503855946 (diff)
downloade2fsprogs-31fff03fa8af5b581175830cbe75890e9bf630d1.tar.gz
tests: modify f_large_dir test to excercise indexed dir handling
Modify f_large_dir test to create indexed directory and create entries in it. That way the new code in ext2fs_link() for addition of entries into indexed directories gets executed including various special cases when growing htree. Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--tests/f_large_dir/expect10
-rw-r--r--tests/f_large_dir/script27
2 files changed, 32 insertions, 5 deletions
diff --git a/tests/f_large_dir/expect b/tests/f_large_dir/expect
index 8f7d99dc1..028234cc6 100644
--- a/tests/f_large_dir/expect
+++ b/tests/f_large_dir/expect
@@ -11,6 +11,16 @@ 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
+
+test.img: ***** FILE SYSTEM WAS MODIFIED *****
+test.img: 17/65072 files (5.9% non-contiguous), 9732/108341 blocks
+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
Directory exceeds max links, but no DIR_NLINK feature in superblock.
Fix? yes
diff --git a/tests/f_large_dir/script b/tests/f_large_dir/script
index 9af042ca6..e3235836f 100644
--- a/tests/f_large_dir/script
+++ b/tests/f_large_dir/script
@@ -26,17 +26,33 @@ $MKE2FS -b 1024 -O large_dir,uninit_bg -N $((ENTRIES + 50)) \
RC=$?
if [ $RC -eq 0 ]; then
{
- START=$SECONDS
+ # First some initial fs setup to create indexed dir
echo "mkdir /foo"
echo "cd /foo"
touch $TMPFILE.tmp
echo "write $TMPFILE.tmp foofile"
i=0
- last=0
+ while test $i -lt $DIRENT_PER_LEAF ; do
+ printf "mkdir d%0254u\n" $i
+ i=$((i + 1));
+ done
+ echo "expand ./"
+ printf "mkdir d%0254u\n" $i
+} | $DEBUGFS -w $TMPFILE > /dev/null 2>> $OUT.new
+ RC=$?
+ # e2fsck should optimize the dir to become indexed
+ $E2FSCK -yfD $TMPFILE >> $OUT.new 2>&1
+ status=$?
+ echo Exit status is $status >> $OUT.new
+fi
+
+if [ $RC -eq 0 ]; then
+{
+ START=$SECONDS
+ i=$(($DIRENT_PER_LEAF+1))
+ last=$i
+ echo "cd /foo"
while test $i -lt $ENTRIES ; do
- if test $((i % DIRENT_PER_LEAF)) -eq 0; then
- echo "expand ./"
- fi
ELAPSED=$((SECONDS - START))
if test $((i % 5000)) -eq 0 -a $ELAPSED -gt 10; then
RATE=$(((i - last) / ELAPSED))
@@ -54,6 +70,7 @@ if [ $RC -eq 0 ]; then
} | $DEBUGFS -w $TMPFILE > /dev/null 2>> $OUT.new
RC=$?
fi
+
if [ $RC -eq 0 ]; then
$E2FSCK -yfD $TMPFILE >> $OUT.new 2>&1
status=$?