mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
a860a167d8
fstests only supports Linux, so get rid of this unnecessary predicate. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
96 lines
1.8 KiB
Bash
Executable File
96 lines
1.8 KiB
Bash
Executable File
#! /bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (c) 2014 Red Hat, Inc. All Rights Reserved.
|
|
#
|
|
# FS QA Test No. 062
|
|
#
|
|
# Use the bstat utility to verify bulkstat finds all inodes in a filesystem.
|
|
# Test under various inode counts, inobt record layouts and bulkstat batch
|
|
# sizes.
|
|
#
|
|
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.*
|
|
}
|
|
|
|
# print the number of inodes counted by bulkstat
|
|
_bstat_count()
|
|
{
|
|
batchsize=$1
|
|
$here/src/bstat $SCRATCH_MNT $batchsize | grep ino | wc -l
|
|
}
|
|
|
|
# print bulkstat counts using varied batch sizes
|
|
_bstat_test()
|
|
{
|
|
expect=`find $SCRATCH_MNT -print | wc -l`
|
|
echo "expect $expect"
|
|
|
|
_bstat_count 4096
|
|
_bstat_count 32
|
|
_bstat_count 1
|
|
}
|
|
|
|
# get standard environment, filters and checks
|
|
. ./common/rc
|
|
. ./common/filter
|
|
|
|
_require_scratch
|
|
|
|
# real QA test starts here
|
|
|
|
_supported_fs xfs
|
|
|
|
rm -f $seqres.full
|
|
|
|
DIRCOUNT=8
|
|
INOCOUNT=$((2048 / DIRCOUNT))
|
|
|
|
_scratch_mkfs "-d agcount=$DIRCOUNT" >> $seqres.full 2>&1 || _fail "mkfs failed"
|
|
_scratch_mount
|
|
|
|
# create a set of directories and fill each with a fixed number of files
|
|
for dir in $(seq 1 $DIRCOUNT); do
|
|
mkdir -p $SCRATCH_MNT/$dir
|
|
for i in $(seq 1 $INOCOUNT); do
|
|
touch $SCRATCH_MNT/$dir/$i
|
|
done
|
|
done
|
|
_bstat_test
|
|
|
|
# remove every other file from each dir
|
|
for dir in $(seq 1 $DIRCOUNT); do
|
|
for i in $(seq 2 2 $INOCOUNT); do
|
|
rm -f $SCRATCH_MNT/$dir/$i
|
|
done
|
|
done
|
|
_bstat_test
|
|
|
|
# remove the entire second half of files
|
|
for dir in $(seq 1 $DIRCOUNT); do
|
|
for i in $(seq $((INOCOUNT / 2)) $INOCOUNT); do
|
|
rm -f $SCRATCH_MNT/$dir/$i
|
|
done
|
|
done
|
|
_bstat_test
|
|
|
|
# remove all regular files
|
|
for dir in $(seq 1 $DIRCOUNT); do
|
|
rm -f $SCRATCH_MNT/$dir/*
|
|
done
|
|
_bstat_test
|
|
|
|
# success, all done
|
|
status=0
|
|
exit
|