2 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved.
7 # Tests xfs_growfs on the realtime volume to make sure none of it blows up.
8 # This is a regression test for the following patches:
10 # xfs: Set xfs_buf type flag when growing summary/bitmap files
11 # xfs: Set xfs_buf's b_ops member when zeroing bitmap/summary files
12 # xfs: fix realtime bitmap/summary file truncation when growing rt volume
13 # xfs: make xfs_growfs_rt update secondary superblocks
14 # xfs: annotate grabbing the realtime bitmap/summary locks in growfs
17 _begin_fstest auto quick realtime growfs
19 # Override the default cleanup function.
23 _scratch_unmount >> $seqres.full 2>&1
24 test -e "$rtdev" && losetup -d $rtdev >> $seqres.full 2>&1
25 rm -f $tmp.* $TEST_DIR/$seq.rtvol
28 # Import common functions.
31 # real QA test starts here
33 # Note that we don't _require_realtime because we synthesize a rt volume
35 _require_scratch_nocheck
36 _require_no_large_scratch_dev
38 echo "Create fake rt volume"
39 truncate -s 400m $TEST_DIR/$seq.rtvol
40 rtdev=$(_create_loop_device $TEST_DIR/$seq.rtvol)
42 echo "Format and mount 100m rt volume"
43 export USE_EXTERNAL=yes
44 export SCRATCH_RTDEV=$rtdev
45 _scratch_mkfs -r size=100m > $seqres.full
46 _try_scratch_mount || _notrun "Could not mount scratch with synthetic rt volume"
48 testdir=$SCRATCH_MNT/test-$seq
51 echo "Check rt volume stats"
52 _xfs_force_bdev realtime $testdir
53 $XFS_INFO_PROG $SCRATCH_MNT >> $seqres.full
54 before=$(stat -f -c '%b' $testdir)
56 echo "Create some files"
57 _pwrite_byte 0x61 0 1m $testdir/original >> $seqres.full
60 $XFS_GROWFS_PROG $SCRATCH_MNT 2>&1 | _filter_growfs >> $seqres.full
63 echo "Recheck 400m rt volume stats"
64 $XFS_INFO_PROG $SCRATCH_MNT >> $seqres.full
65 after=$(stat -f -c '%b' $testdir)
66 _within_tolerance "rt volume size" $after $((before * 4)) 5% -v
68 echo "Create more copies to make sure the bitmap really works"
69 cp -p $testdir/original $testdir/copy3
71 echo "Check filesystem"