ext4/306: Add -b blocksize parameter too to avoid failure with DAX config
[xfstests-dev.git] / tests / ext4 / 306
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. ext4/306
6 #
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
10 #
11 . ./common/preamble
12 _begin_fstest auto rw resize quick
13
14 PIDS=""
15
16 # Override the default cleanup function.
17 _cleanup()
18 {
19     _scratch_unmount
20 }
21
22 # Import common functions.
23 . ./common/filter
24
25 # real QA test starts here
26 _supported_fs ext4
27
28 _require_scratch
29 _require_command "$RESIZE2FS_PROG" resize2fs
30
31 # Make a small ext4 fs with extents disabled & mount it
32 features="^extents"
33 if grep -q 64bit /etc/mke2fs.conf ; then
34     features="^extents,^64bit"
35 fi
36
37 blksz=$(get_page_size)
38
39 $MKFS_EXT4_PROG -F -b $blksz -O "$features" $SCRATCH_DEV 512m >> $seqres.full 2>&1
40 _scratch_mount
41
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
45
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 | \
49         _filter_xfs_io_error
50 df -h $SCRATCH_MNT >> $seqres.full
51
52 # Grow fs by 512m
53 echo "Resize to 1g"
54 $RESIZE2FS_PROG $SCRATCH_DEV 1g >> $seqres.full 2>&1 || _fail "Could not resize to 1g"
55 df -h $SCRATCH_MNT >> $seqres.full
56
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
62
63 status=0
64 exit