common/rc: add _scratch_{u}mount_idmapped() helpers
[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 _require_scratch
35
36 _scratch_mkfs_xfs >/dev/null 2>&1
37 _scratch_mount
38
39 small=$SCRATCH_MNT/small
40 big=$SCRATCH_MNT/big
41
42 # sanity check on a small directory
43 mkdir $small
44 # expect that an empty directory has no extents
45 $XFS_IO_PROG -c "bmap" $small | _filter_scratch
46 # and that we can set an extent size on it
47 $XFS_IO_PROG -c 'extsize 8m' $small
48 # and finally check that the extent size update has taken place
49 $XFS_IO_PROG -c "extsize" $small | _filter_scratch
50
51 # now create a 'big' (with extents) directory
52 mkdir $big
53 for idx in {0..1000}; do
54     touch $big/$idx
55 done
56 $XFS_IO_PROG -c 'bmap -vp' $big | _filter_bmap | \
57     grep -q '^0: .*data'
58 [ $? -eq 0 ] || echo "Can't force allocating extents!" 1>&2
59
60 # expect that we can set the extent size on $big as well
61 $XFS_IO_PROG -c 'extsize 8m' $big | _filter_scratch
62 # and that it took effect
63 $XFS_IO_PROG -c 'extsize' $big | _filter_scratch
64
65 # success, all done
66 status=0
67 exit