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 _begin_fstest auto ioctl quick
14 # print the number of inodes counted by bulkstat
18 $here/src/bstat $SCRATCH_MNT $batchsize | grep ino | wc -l
21 # print bulkstat counts using varied batch sizes
24 expect=`find $SCRATCH_MNT -print | wc -l`
32 # Import common functions.
37 # real QA test starts here
42 INOCOUNT=$((2048 / DIRCOUNT))
44 _scratch_mkfs "-d agcount=$DIRCOUNT" >> $seqres.full 2>&1 || _fail "mkfs failed"
47 # create a set of directories and fill each with a fixed number of files
48 for dir in $(seq 1 $DIRCOUNT); do
49 mkdir -p $SCRATCH_MNT/$dir
50 for i in $(seq 1 $INOCOUNT); do
51 touch $SCRATCH_MNT/$dir/$i
56 # remove every other file from each dir
57 for dir in $(seq 1 $DIRCOUNT); do
58 for i in $(seq 2 2 $INOCOUNT); do
59 rm -f $SCRATCH_MNT/$dir/$i
64 # remove the entire second half of files
65 for dir in $(seq 1 $DIRCOUNT); do
66 for i in $(seq $((INOCOUNT / 2)) $INOCOUNT); do
67 rm -f $SCRATCH_MNT/$dir/$i
72 # remove all regular files
73 for dir in $(seq 1 $DIRCOUNT); do
74 rm -f $SCRATCH_MNT/$dir/*