2 # FS QA Test No. ext4/306
4 # Test that blocks are available to non-extent files after a resize2fs
5 # Regression test for commit:
6 # c5c72d8 ext4: fix online resizing for ext3-compat file systems
8 #-----------------------------------------------------------------------
9 # Copyright (c) 2013 Red Hat, Inc. All Rights Reserved.
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation.
15 # This program is distributed in the hope that it would be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write the Free Software Foundation,
22 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #-----------------------------------------------------------------------
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
30 status=1 # failure is the default!
31 trap "_cleanup; exit \$status" 0 1 2 3 15
38 # get standard environment, filters and checks
42 # real QA test starts here
50 # Make a small ext4 fs with extents disabled & mount it
52 if grep -q 64bit /etc/mke2fs.conf ; then
53 features="^extents,^64bit"
55 $MKFS_EXT4_PROG -F -O "$features" $SCRATCH_DEV 512m >> $seqres.full 2>&1
56 _scratch_mount || _fail "couldn't mount fs"
58 # Create a small non-extent-based file
59 echo "Create 1m testfile1"
60 $XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 0 1m" | _filter_xfs_io
62 # Create a large non-extent-based file filling the fs; this will run out & fail
63 echo "Create testfile2 to fill the fs"
64 $XFS_IO_PROG -f $SCRATCH_MNT/testfile2 -c "pwrite 0 512m" 2>&1 | \
66 df -h $SCRATCH_MNT >> $seqres.full
70 resize2fs $SCRATCH_DEV 1g >> $seqres.full 2>&1 || _fail "Could not resize to 1g"
71 df -h $SCRATCH_MNT >> $seqres.full
73 # See if we can add more blocks to the files
74 echo "append 2m to testfile1"
75 $XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 1m 2m" | _filter_xfs_io
76 echo "append 2m to testfile2"
77 $XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 512m 2m" | _filter_xfs_io