ext4_subdir_limit_test.sh: fix "No Space" issue
PATCH 1/1 ext4_subdir_limit_test.sh: fix "No Space" issue
From: Xiaoli Feng <[email protected]>
1G ext4 filesystem default has 65536 inode. And some inodes will be used after format. So it will be failed when try to create 65536 sub-directorys in this ext4 mountpoint. Change it to create 65536 - used inodes directorys.
--- .../ext4-subdir-limit/ext4_subdir_limit_test.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/ext4_subdir_limit_test.sh +11 -5
@@ -46,6 +46,8 @@ prev_result=$FAIL ext4_run_case() { local dir_name_len= + local free_inode= + local max_directorys=$1 if [ $2 -eq $SHORT_DIR ]; then dir_name_len="short name"
@@ -53,9 +55,6 @@ ext4_run_case() dir_name_len="long name" fi - tst_resm TINFO "Num of dirs to create: $1, Dir name len: $dir_name_len, " \ - "Parent dir: $3, Block size: $4" - # only mkfs if block size has been changed, # or previous case failed if [ $prev_result -ne $PASS -o $4 -ne $prev_block_size ]; then
@@ -80,11 +79,18 @@ ext4_run_case() # create directories mkdir -p $3 2> /dev/null + free_inode=`df -i $EXT4_DEV | awk '{print $4}' | tr -cd "[0-9]"` + if [ "$free_inode" -lt "$1" ]; then + max_directorys=$free_inode + fi + + tst_resm TINFO "Num of dirs to create: $max_directorys, Dir name len: $dir_name_len, " \ + "Parent dir: $3, Block size: $4" if [ $2 -eq $SHORT_DIR ]; then - create_short_dirs $1 $3 + create_short_dirs $max_directorys $3 else - create_long_dirs $1 $3 + create_long_dirs $max_directorys $3 fi if [ $? -ne 0 ]; then
Signature · 1 line
2.18.1