diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:49:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:49:25 +0000 |
commit | 464df1d5e5ab1322e2dd0a7796939fff1aeefa9a (patch) | |
tree | 6a403684e0978f0287d7f0ec0e5aab1fd31a59e1 /tests/f_large_dir | |
parent | Initial commit. (diff) | |
download | e2fsprogs-upstream.tar.xz e2fsprogs-upstream.zip |
Adding upstream version 1.47.0.upstream/1.47.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/f_large_dir')
-rw-r--r-- | tests/f_large_dir/expect | 34 | ||||
-rw-r--r-- | tests/f_large_dir/is_slow_test | 0 | ||||
-rw-r--r-- | tests/f_large_dir/name | 1 | ||||
-rw-r--r-- | tests/f_large_dir/script | 90 |
4 files changed, 125 insertions, 0 deletions
diff --git a/tests/f_large_dir/expect b/tests/f_large_dir/expect new file mode 100644 index 0000000..495ea85 --- /dev/null +++ b/tests/f_large_dir/expect @@ -0,0 +1,34 @@ +128-byte inodes cannot handle dates beyond 2038 and are deprecated +Creating filesystem with 108341 1k blocks and 65072 inodes +Superblock backups stored on blocks: + 8193, 24577, 40961, 57345, 73729 + +Allocating group tables: done +Writing inode tables: 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 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 + +Inode 12 ref count is 65012, should be 1. Fix? yes + +Pass 5: Checking group summary information + +test.img: ***** FILE SYSTEM WAS MODIFIED ***** +test.img: 65023/65072 files (0.0% non-contiguous), 96666/108341 blocks +Exit status is 1 diff --git a/tests/f_large_dir/is_slow_test b/tests/f_large_dir/is_slow_test new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/f_large_dir/is_slow_test diff --git a/tests/f_large_dir/name b/tests/f_large_dir/name new file mode 100644 index 0000000..4b96890 --- /dev/null +++ b/tests/f_large_dir/name @@ -0,0 +1 @@ +optimize 3 level htree directories diff --git a/tests/f_large_dir/script b/tests/f_large_dir/script new file mode 100644 index 0000000..e323583 --- /dev/null +++ b/tests/f_large_dir/script @@ -0,0 +1,90 @@ +OUT=$test_name.log +EXP=$test_dir/expect +E2FSCK=../e2fsck/e2fsck + +NAMELEN=255 +DIRENT_SZ=8 +BLOCKSZ=1024 +INODESZ=128 +DIRENT_PER_LEAF=$((BLOCKSZ / (NAMELEN + DIRENT_SZ))) +HEADER=32 +INDEX_SZ=8 +INDEX_L1=$(((BLOCKSZ - HEADER) / INDEX_SZ)) +INDEX_L2=$(((BLOCKSZ - DIRENT_SZ) / INDEX_SZ)) +DIRBLK=$((2 + INDEX_L1 * INDEX_L2)) +ENTRIES=$((DIRBLK * DIRENT_PER_LEAF)) +EXT4_LINK_MAX=65000 +if [ $ENTRIES -lt $((EXT4_LINK_MAX + 10)) ]; then + ENTRIES=$((EXT4_LINK_MAX + 10)) + DIRBLK=$((ENTRIES / DIRENT_PER_LEAF + 3)) +fi +# directory leaf blocks plus inode count and 25% for the rest of the fs +FSIZE=$(((DIRBLK + EXT4_LINK_MAX * ((BLOCKSZ + INODESZ) / BLOCKSZ)) * 5 / 4)) + +$MKE2FS -b 1024 -O large_dir,uninit_bg -N $((ENTRIES + 50)) \ + -I $INODESZ -F $TMPFILE $FSIZE > $OUT.new 2>&1 +RC=$? +if [ $RC -eq 0 ]; then +{ + # 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 + 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 + ELAPSED=$((SECONDS - START)) + if test $((i % 5000)) -eq 0 -a $ELAPSED -gt 10; then + RATE=$(((i - last) / ELAPSED)) + echo "$test_name: $i/$ENTRIES links, ${ELAPSED}s @ $RATE/s" >&2 + START=$SECONDS + last=$i + fi + if test $i -lt $((EXT4_LINK_MAX + 10)); then + printf "mkdir d%0254u\n" $i + else + printf "ln foofile f%0254u\n" $i + fi + i=$((i + 1)) + done +} | $DEBUGFS -w $TMPFILE > /dev/null 2>> $OUT.new + RC=$? +fi + +if [ $RC -eq 0 ]; then + $E2FSCK -yfD $TMPFILE >> $OUT.new 2>&1 + status=$? + echo Exit status is $status >> $OUT.new + sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new > $OUT + rm -f $OUT.new + + cmp -s $OUT $EXP + RC=$? +fi +if [ $RC -eq 0 ]; then + echo "$test_name: $test_description: ok" + touch $test_name.ok +else + echo "$test_name: $test_description: failed" + diff -u $EXP $OUT > $test_name.failed +fi |