generic/233,270: unlimit the max locked memory size for io_uring
[xfstests-dev.git] / tests / xfs / 062
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 062
6 #
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
9 # sizes.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22     cd /
23     rm -f $tmp.*
24 }
25
26 # print the number of inodes counted by bulkstat
27 _bstat_count()
28 {
29         batchsize=$1
30         $here/src/bstat $SCRATCH_MNT $batchsize | grep ino | wc -l
31 }
32
33 # print bulkstat counts using varied batch sizes
34 _bstat_test()
35 {
36         expect=`find $SCRATCH_MNT -print | wc -l`
37         echo "expect $expect"
38
39         _bstat_count 4096
40         _bstat_count 32
41         _bstat_count 1
42 }
43
44 # get standard environment, filters and checks
45 . ./common/rc
46 . ./common/filter
47
48 _require_scratch
49
50 # real QA test starts here
51
52 _supported_fs xfs
53
54 rm -f $seqres.full
55
56 DIRCOUNT=8
57 INOCOUNT=$((2048 / DIRCOUNT))
58
59 _scratch_mkfs "-d agcount=$DIRCOUNT" >> $seqres.full 2>&1 || _fail "mkfs failed"
60 _scratch_mount
61
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
67         done
68 done
69 _bstat_test
70
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
75         done
76 done
77 _bstat_test
78
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
83         done
84 done
85 _bstat_test
86
87 # remove all regular files
88 for dir in $(seq 1 $DIRCOUNT); do
89         rm -f $SCRATCH_MNT/$dir/*
90 done
91 _bstat_test
92
93 # success, all done
94 status=0
95 exit