2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Red Hat, Inc. All Rights Reserved.
7 # Use the bstat utility to verify bulkstat finds all inodes in a filesystem.
8 # Test under various inode counts, inobt record layouts and bulkstat batch
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
17 status=1 # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
26 # print the number of inodes counted by bulkstat
30 ./src/bstat $SCRATCH_MNT $batchsize | grep ino | wc -l
33 # print bulkstat counts using varied batch sizes
36 expect=`find $SCRATCH_MNT -print | wc -l`
44 # get standard environment, filters and checks
50 # real QA test starts here
58 INOCOUNT=$((2048 / DIRCOUNT))
60 _scratch_mkfs "-d agcount=$DIRCOUNT" >> $seqres.full 2>&1 || _fail "mkfs failed"
63 # create a set of directories and fill each with a fixed number of files
64 for dir in $(seq 1 $DIRCOUNT); do
65 mkdir -p $SCRATCH_MNT/$dir
66 for i in $(seq 1 $INOCOUNT); do
67 touch $SCRATCH_MNT/$dir/$i
72 # remove every other file from each dir
73 for dir in $(seq 1 $DIRCOUNT); do
74 for i in $(seq 2 2 $INOCOUNT); do
75 rm -f $SCRATCH_MNT/$dir/$i
80 # remove the entire second half of files
81 for dir in $(seq 1 $DIRCOUNT); do
82 for i in $(seq $((INOCOUNT / 2)) $INOCOUNT); do
83 rm -f $SCRATCH_MNT/$dir/$i
88 # remove all regular files
89 for dir in $(seq 1 $DIRCOUNT); do
90 rm -f $SCRATCH_MNT/$dir/*