4 # Test extent pre-allocation (using fallocate) into a region that already has a
5 # pre-allocated extent that ends beyond the file's size. Verify that if the fs
6 # is unmounted immediately after, the file's size and content are not lost.
8 #-----------------------------------------------------------------------
9 # Copyright (C) 2015 SUSE Linux Products GmbH. All Rights Reserved.
10 # Author: Filipe Manana <fdmanana@suse.com>
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #-----------------------------------------------------------------------
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
33 status=1 # failure is the default!
39 trap "_cleanup; exit \$status" 0 1 2 3 15
41 # get standard environment, filters and checks
45 # real QA test starts here
50 _require_xfs_io_command "falloc"
54 _scratch_mkfs >> $seqres.full 2>&1
57 # Create our test file with a pre-allocated extent that doesn't increase the
59 $XFS_IO_PROG -f -c "falloc -k 0 1M" $SCRATCH_MNT/foo
61 # Write some data to our file.
62 $XFS_IO_PROG -c "pwrite -S 0xaa 0 256K" $SCRATCH_MNT/foo | _filter_xfs_io
64 # Now call fallocate again, but allowing it to increase the file's size and
65 # cover a range that is entirely covered by the extent that we previously
67 $XFS_IO_PROG -c "falloc 0 512K" $SCRATCH_MNT/foo
69 # Now ummount and mount again the fs. After this we expect the file's size to
73 # Now check that all data we wrote before are available and the file size is
75 echo "File content after remount:"
76 od -t x1 $SCRATCH_MNT/foo