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
32 _require_xfs_io_command "falloc" "-k"
36 _scratch_mkfs >> $seqres.full 2>&1
39 # Create our test file with a pre-allocated extent that doesn't increase the
41 $XFS_IO_PROG -f -c "falloc -k 0 1M" $SCRATCH_MNT/foo
43 # Write some data to our file.
44 $XFS_IO_PROG -c "pwrite -S 0xaa 0 256K" $SCRATCH_MNT/foo | _filter_xfs_io
46 # Now call fallocate again, but allowing it to increase the file's size and
47 # cover a range that is entirely covered by the extent that we previously
49 $XFS_IO_PROG -c "falloc 0 512K" $SCRATCH_MNT/foo
51 # Now ummount and mount again the fs. After this we expect the file's size to
55 # Now check that all data we wrote before are available and the file size is
57 echo "File content after remount:"
58 od -t x1 $SCRATCH_MNT/foo