Files
apfstests/tests/generic/558
T

82 lines
1.7 KiB
Bash
Raw Normal View History

2014-04-04 17:17:33 +11:00
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2014 Red Hat Inc. All Rights Reserved.
#
2019-06-28 18:59:09 -04:00
# FS QA Test No. generic/558
2014-04-04 17:17:33 +11:00
#
# Stress test fs by using up all inodes and check fs.
#
# Also a regression test for xfsprogs commit
# d586858 xfs_repair: fix sibling pointer tests in verify_dir2_path()
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
rm -f $tmp.*
}
create_file()
{
local dir=$1
local nr_file=$2
local prefix=$3
local i=0
while [ $i -lt $nr_file ]; do
echo -n > $dir/${prefix}_${i}
let i=$i+1
done
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
# real QA test starts here
2019-06-28 18:59:09 -04:00
_supported_fs generic
2014-04-04 17:17:33 +11:00
_supported_os Linux
2019-06-28 18:59:09 -04:00
_require_inode_limits
2019-11-26 20:16:02 -08:00
_require_scratch
2014-04-04 17:17:33 +11:00
rm -f $seqres.full
echo "Silence is golden"
_scratch_mkfs_sized $((1024 * 1024 * 1024)) >>$seqres.full 2>&1
_scratch_mount
i=0
2014-08-13 11:15:41 +10:00
free_inode=`_get_free_inode $SCRATCH_MNT`
2014-04-04 17:17:33 +11:00
file_per_dir=1000
loop=$((free_inode / file_per_dir + 1))
mkdir -p $SCRATCH_MNT/testdir
echo "Create $((loop * file_per_dir)) files in $SCRATCH_MNT/testdir" >>$seqres.full
while [ $i -lt $loop ]; do
create_file $SCRATCH_MNT/testdir $file_per_dir $i >>$seqres.full 2>&1 &
let i=$i+1
done
wait
# log inode status in $seqres.full for debug purpose
echo "Inode status after taking all inodes" >>$seqres.full
$DF_PROG -i $SCRATCH_MNT >>$seqres.full
_check_scratch_fs
# Check again after removing all the files
rm -rf $SCRATCH_MNT/testdir
echo "Inode status after deleting all test files" >>$seqres.full
$DF_PROG -i $SCRATCH_MNT >>$seqres.full
status=0
exit