2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc. All Rights Reserved.
5 # FS QA Test No. ext4/306
7 # Test that blocks are available to non-extent files after a resize2fs
8 # Regression test for commit:
9 # c5c72d8 ext4: fix online resizing for ext3-compat file systems
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
28 # real QA test starts here
32 _require_command "$RESIZE2FS_PROG" resize2fs
36 # Make a small ext4 fs with extents disabled & mount it
38 if grep -q 64bit /etc/mke2fs.conf ; then
39 features="^extents,^64bit"
41 $MKFS_EXT4_PROG -F -O "$features" $SCRATCH_DEV 512m >> $seqres.full 2>&1
44 # Create a small non-extent-based file
45 echo "Create 1m testfile1"
46 $XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 0 1m" | _filter_xfs_io
48 # Create a large non-extent-based file filling the fs; this will run out & fail
49 echo "Create testfile2 to fill the fs"
50 $XFS_IO_PROG -f $SCRATCH_MNT/testfile2 -c "pwrite 0 512m" 2>&1 | \
52 df -h $SCRATCH_MNT >> $seqres.full
56 $RESIZE2FS_PROG $SCRATCH_DEV 1g >> $seqres.full 2>&1 || _fail "Could not resize to 1g"
57 df -h $SCRATCH_MNT >> $seqres.full
59 # See if we can add more blocks to the files
60 echo "append 2m to testfile1"
61 $XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 1m 2m" | _filter_xfs_io
62 echo "append 2m to testfile2"
63 $XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 512m 2m" | _filter_xfs_io