2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2020 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test subdirectory limit of ext4.
8 # We create more than 65000 subdirectories on the ext4 filesystem.
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
28 # get standard environment, filters and checks
32 # remove previous $seqres.full before test
35 # real QA test starts here
39 _require_test_program "t_create_short_dirs"
40 _require_test_program "t_create_long_dirs"
41 _require_dumpe2fs "$DUMPE2FS_PROG" dumpe2fs
43 echo "Silence is golden"
46 # $1: Number of directories to create
47 # $2: create short dir or long dir
48 # $3: parent directory
52 if [ $2 -eq $SHORT_DIR ]; then
53 dir_name_len="short name"
55 dir_name_len="long name"
58 echo "Num of dirs to create: $1, Dir name len: $dir_name_len, " \
59 "Parent dir: $3" >> $seqres.full
61 _scratch_mkfs "-O extent,dir_nlink,dir_index -I 256" >> $seqres.full 2>&1
65 mkdir -p $3 2> /dev/null
67 if [ $2 -eq $SHORT_DIR ]; then
68 $here/src/t_create_short_dirs $1 $3
70 $here/src/t_create_long_dirs $1 $3
74 nr_dirs=`ls $3 | wc -l`
75 echo "Failed to create directories - $nr_dirs"
84 echo "Failed to remove directories in $3"
92 # check dir_nlink is set
93 $DUMPE2FS_PROG -h $SCRATCH_DEV 2>> $seqres.full | grep '^Filesystem features' | grep -q dir_nlink
95 echo "Feature dir_nlink is not set, please check $seqres.full for detail"
102 DIR_LEN=( $SHORT_DIR $LONG_DIR )
103 PARENT_DIR="$SCRATCH_MNT/subdir"
105 for ((i = 0; i < 2; i++)); do
106 workout $DIR_NUM ${DIR_LEN[$i]} $PARENT_DIR