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 _begin_fstest auto rw resize quick
16 # Override the default cleanup function.
22 # Import common functions.
25 # real QA test starts here
29 _require_command "$RESIZE2FS_PROG" resize2fs
31 # Make a small ext4 fs with extents disabled & mount it
33 if grep -q 64bit /etc/mke2fs.conf ; then
34 features="^extents,^64bit"
37 blksz=$(get_page_size)
39 $MKFS_EXT4_PROG -F -b $blksz -O "$features" $SCRATCH_DEV 512m >> $seqres.full 2>&1
42 # Create a small non-extent-based file
43 echo "Create 1m testfile1"
44 $XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 0 1m" | _filter_xfs_io
46 # Create a large non-extent-based file filling the fs; this will run out & fail
47 echo "Create testfile2 to fill the fs"
48 $XFS_IO_PROG -f $SCRATCH_MNT/testfile2 -c "pwrite 0 512m" 2>&1 | \
50 df -h $SCRATCH_MNT >> $seqres.full
54 $RESIZE2FS_PROG $SCRATCH_DEV 1g >> $seqres.full 2>&1 || _fail "Could not resize to 1g"
55 df -h $SCRATCH_MNT >> $seqres.full
57 # See if we can add more blocks to the files
58 echo "append 2m to testfile1"
59 $XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 1m 2m" | _filter_xfs_io
60 echo "append 2m to testfile2"
61 $XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 512m 2m" | _filter_xfs_io