fstests: convert remaining tests to SPDX license tags
[xfstests-dev.git] / tests / xfs / 069
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Google Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 069
6 #
7 # Determine whether the extent size hint can be set on directories
8 # with allocated extents correctly.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21     cd /
22     rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28 . ./common/punch
29
30 # real QA test starts here
31
32 # Modify as appropriate.
33 _supported_fs xfs
34 _supported_os Linux
35 _require_scratch
36
37 _scratch_mkfs_xfs >/dev/null 2>&1
38 _scratch_mount
39
40 small=$SCRATCH_MNT/small
41 big=$SCRATCH_MNT/big
42
43 # sanity check on a small directory
44 mkdir $small
45 # expect that an empty directory has no extents
46 $XFS_IO_PROG -c "bmap" $small | _filter_scratch
47 # and that we can set an extent size on it
48 $XFS_IO_PROG -c 'extsize 8m' $small
49 # and finally check that the extent size update has taken place
50 $XFS_IO_PROG -c "extsize" $small | _filter_scratch
51
52 # now create a 'big' (with extents) directory
53 mkdir $big
54 for idx in {0..1000}; do
55     touch $big/$idx
56 done
57 $XFS_IO_PROG -c 'bmap -vp' $big | _filter_bmap | \
58     grep -q '^0: .*data'
59 [ $? -eq 0 ] || echo "Can't force allocating extents!" 1>&2
60
61 # expect that we can set the extent size on $big as well
62 $XFS_IO_PROG -c 'extsize 8m' $big | _filter_scratch
63 # and that it took effect
64 $XFS_IO_PROG -c 'extsize' $big | _filter_scratch
65
66 # success, all done
67 status=0
68 exit