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 _begin_fstest auto quick log replay
16 # Import common functions.
18 . ./common/dmlogwrites
20 # real QA test starts here
22 # Modify as appropriate.
26 _require_xfs_io_command "sync_range"
28 _log_writes_init $SCRATCH_DEV
29 _log_writes_mkfs "-O ^no-holes" >> $seqres.full 2>&1
31 # There's not a straightforward way to commit the transaction without also
32 # flushing dirty pages, so shorten the commit interval to 1 so we're sure to get
33 # a commit with our broken file
34 _log_writes_mount -o commit=1
36 $XFS_IO_PROG -f -c "pwrite 0 5m" $SCRATCH_MNT/file | _filter_xfs_io
37 $XFS_IO_PROG -f -c "sync_range -abw 4m 1m" $SCRATCH_MNT/file | _filter_xfs_io
39 # Now wait for a transaction commit to happen, wait 2x just to be super sure
45 cur=$(_log_writes_find_next_fua 0)
46 echo "cur=$cur" >> $seqres.full
47 while [ ! -z "$cur" ]; do
48 _log_writes_replay_log_range $cur $SCRATCH_DEV >> $seqres.full
50 # We only care about the fs consistency, so just run fsck, we don't have
51 # to mount the fs to validate it
54 cur=$(_log_writes_find_next_fua $(($cur + 1)))