2 # SPDX-License-Identifier: GPL-2.0
6 # Test ext4's large_dir feature
8 # Create a directory with enough entries that we can exercise the large_dir
9 # code paths, and then verify that the resulting file system is valid using
13 _begin_fstest auto quick dir
15 # Override the default cleanup function.
20 if [ ! -z "$loop_mnt" ]; then
21 $UMOUNT_PROG $loop_mnt
24 [ ! -z "$fs_img" ] && rm -rf $fs_img
27 # Import common functions.
30 # real QA test starts here
32 # Modify as appropriate.
36 _require_test_program "dirstress"
37 _require_scratch_ext4_feature "large_dir"
39 echo "Silence is golden"
41 loop_mnt=$TEST_DIR/$seq.mnt
42 fs_img=$TEST_DIR/$seq.img
45 $XFS_IO_PROG -f -c "truncate 20G" $fs_img >>$seqres.full 2>&1
47 # We need to create enough files (400,000) so that using a file system
48 # with a 1k block size, the hash tree created will have three levels
49 # (which is the distringuishing characteristics of a large_dir versus
50 # non-large_dir). We use no journal mode to decrease the run time of
52 ${MKFS_PROG} -t ${FSTYP} -b 1024 -N 400020 -O large_dir,^has_journal \
53 $fs_img 20G >> $seqres.full 2>&1 || _fail "mkfs failed"
56 _mount -o loop $fs_img $loop_mnt > /dev/null 2>&1 || \
57 _fail "Couldn't do initial mount"
59 if ! $here/src/dirstress -c -d $loop_mnt -p 1 -f 400000 -C >$tmp.out 2>&1
61 echo " dirstress failed"
62 cat $tmp.out >> $seqres.full
63 echo " dirstress failed" >> $seqres.full
67 $UMOUNT_PROG $loop_mnt || _fail "umount failed"
70 $E2FSCK_PROG -fn $fs_img >> $seqres.full 2>&1 || _fail "file system corrupted"