2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2020 Facebook. All Rights Reserved.
7 # Validate that without no-holes we do not get an i_size that is after a gap in
8 # the file extents on disk. This is fixed by the following patches
10 # btrfs: use the file extent tree infrastructure
11 # btrfs: replace all uses of btrfs_ordered_update_i_size
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
19 status=1 # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
28 # get standard environment, filters and checks
31 . ./common/dmlogwrites
33 # remove previous $seqres.full before test
36 # real QA test starts here
38 # Modify as appropriate.
42 _require_xfs_io_command "sync_range"
44 _log_writes_init $SCRATCH_DEV
45 _log_writes_mkfs "-O ^no-holes" >> $seqres.full 2>&1
47 # There's not a straightforward way to commit the transaction without also
48 # flushing dirty pages, so shorten the commit interval to 1 so we're sure to get
49 # a commit with our broken file
50 _log_writes_mount -o commit=1
52 $XFS_IO_PROG -f -c "pwrite 0 5m" $SCRATCH_MNT/file | _filter_xfs_io
53 $XFS_IO_PROG -f -c "sync_range -abw 4m 1m" $SCRATCH_MNT/file | _filter_xfs_io
55 # Now wait for a transaction commit to happen, wait 2x just to be super sure
61 cur=$(_log_writes_find_next_fua 0)
62 echo "cur=$cur" >> $seqres.full
63 while [ ! -z "$cur" ]; do
64 _log_writes_replay_log_range $cur $SCRATCH_DEV >> $seqres.full
66 # We only care about the fs consistency, so just run fsck, we don't have
67 # to mount the fs to validate it
70 cur=$(_log_writes_find_next_fua $(($cur + 1)))