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
51 $MKFS_EXT4_PROG -F -O ^extents,^64bit $SCRATCH_DEV 512m >> $seqres.full 2>&1
52 _scratch_mount || _fail "couldn't mount fs"
54 # Create a small non-extent-based file
55 echo "Create 1m testfile1"
56 $XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 0 1m" | _filter_xfs_io
58 # Create a large non-extent-based file filling the fs; this will run out & fail
59 echo "Create testfile2 to fill the fs"
60 $XFS_IO_PROG -f $SCRATCH_MNT/testfile2 -c "pwrite 0 512m" | _filter_xfs_io
61 df -h $SCRATCH_MNT >> $seqres.full
65 resize2fs $SCRATCH_DEV 1g >> $seqres.full 2>&1 || _fail "Could not resize to 1g"
66 df -h $SCRATCH_MNT >> $seqres.full
68 # See if we can add more blocks to the files
69 echo "append 2m to testfile1"
70 $XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 1m 2m" | _filter_xfs_io
71 echo "append 2m to testfile2"
72 $XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 512m 2m" | _filter_xfs_io