summaryrefslogtreecommitdiff
path: root/tests/ext4/306
blob: 715732a76ec8758a0017454e11cda685eeb0a570 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2013 Red Hat, Inc.  All Rights Reserved.
#
# FS QA Test No. ext4/306
#
# Test that blocks are available to non-extent files after a resize2fs
# Regression test for commit:
# c5c72d8 ext4: fix online resizing for ext3-compat file systems
#
. ./common/preamble
_begin_fstest auto rw resize quick

PIDS=""

# Override the default cleanup function.
_cleanup()
{
    _scratch_unmount
}

# Import common functions.
. ./common/filter

# real QA test starts here
_supported_fs ext4

_require_scratch
_require_command "$RESIZE2FS_PROG" resize2fs

# Make a small ext4 fs with extents disabled & mount it
features="^extents"
if grep -q 64bit /etc/mke2fs.conf ; then
    features+=",^64bit"
fi
if echo "${MOUNT_OPTIONS}" | grep -q 'test_dummy_encryption' ; then
    features+=",encrypt"
fi

blksz=$(_get_page_size)

$MKFS_EXT4_PROG -F -b $blksz -O "$features" $SCRATCH_DEV 512m >> $seqres.full 2>&1
_scratch_mount

# Create a small non-extent-based file
echo "Create 1m testfile1"
$XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 0 1m" | _filter_xfs_io

# Create a large non-extent-based file filling the fs; this will run out & fail
echo "Create testfile2 to fill the fs"
$XFS_IO_PROG -f $SCRATCH_MNT/testfile2 -c "pwrite 0 512m" 2>&1 | \
	_filter_xfs_io_error
df -h $SCRATCH_MNT >> $seqres.full

# Grow fs by 512m
echo "Resize to 1g"
$RESIZE2FS_PROG $SCRATCH_DEV 1g >> $seqres.full 2>&1 || _fail "Could not resize to 1g"
df -h $SCRATCH_MNT >> $seqres.full

# See if we can add more blocks to the files
echo "append 2m to testfile1"
$XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 1m 2m" | _filter_xfs_io
echo "append 2m to testfile2"
$XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 512m 2m" | _filter_xfs_io

status=0
exit