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 $here/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
57 INOCOUNT=$((2048 / DIRCOUNT))
59 _scratch_mkfs "-d agcount=$DIRCOUNT" >> $seqres.full 2>&1 || _fail "mkfs failed"
62 # create a set of directories and fill each with a fixed number of files
63 for dir in $(seq 1 $DIRCOUNT); do
64 mkdir -p $SCRATCH_MNT/$dir
65 for i in $(seq 1 $INOCOUNT); do
66 touch $SCRATCH_MNT/$dir/$i
71 # remove every other file from each dir
72 for dir in $(seq 1 $DIRCOUNT); do
73 for i in $(seq 2 2 $INOCOUNT); do
74 rm -f $SCRATCH_MNT/$dir/$i
79 # remove the entire second half of files
80 for dir in $(seq 1 $DIRCOUNT); do
81 for i in $(seq $((INOCOUNT / 2)) $INOCOUNT); do
82 rm -f $SCRATCH_MNT/$dir/$i
87 # remove all regular files
88 for dir in $(seq 1 $DIRCOUNT); do
89 rm -f $SCRATCH_MNT/$dir/*