2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2015 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test extent pre-allocation (using fallocate) into a region that already has a
8 # pre-allocated extent that ends beyond the file's size. Verify that if the fs
9 # is unmounted immediately after, the file's size and content are not lost.
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
17 status=1 # failure is the default!
23 trap "_cleanup; exit \$status" 0 1 2 3 15
25 # get standard environment, filters and checks
29 # real QA test starts here
33 _require_xfs_io_command "falloc" "-k"
37 _scratch_mkfs >> $seqres.full 2>&1
40 # Create our test file with a pre-allocated extent that doesn't increase the
42 $XFS_IO_PROG -f -c "falloc -k 0 1M" $SCRATCH_MNT/foo
44 # Write some data to our file.
45 $XFS_IO_PROG -c "pwrite -S 0xaa 0 256K" $SCRATCH_MNT/foo | _filter_xfs_io
47 # Now call fallocate again, but allowing it to increase the file's size and
48 # cover a range that is entirely covered by the extent that we previously
50 $XFS_IO_PROG -c "falloc 0 512K" $SCRATCH_MNT/foo
52 # Now ummount and mount again the fs. After this we expect the file's size to
56 # Now check that all data we wrote before are available and the file size is
58 echo "File content after remount:"
59 od -t x1 $SCRATCH_MNT/foo