blob: 53bb0ee4b310734656f1af5840af0ace4179b511 [file] [log] [blame]
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2023 Meta Platforms, Inc. All Rights Reserved.
#
# FS QA Test 708
#
# Test iomap direct_io partial writes.
#
# Create a reasonably large file, then run a program which mmaps it,
# touches the first page, then dio writes it to a second file. This
# can result in a page fault reading from the mmapped dio write buffer and
# thus the iomap direct_io partial write codepath.
#
. ./common/preamble
_begin_fstest quick auto
[ $FSTYP == "btrfs" ] && \
_fixed_by_kernel_commit b73a6fd1b1ef \
"btrfs: split partial dio bios before submit"
_require_test
_require_odirect
_require_test_program dio-buf-fault
src=$TEST_DIR/dio-buf-fault-$seq.src
dst=$TEST_DIR/dio-buf-fault-$seq.dst
rm -rf "$src" "$dst"
echo "Silence is golden"
$XFS_IO_PROG -fc "pwrite -q -S 0xcd 0 $((2 * 1024 * 1024))" $src
$here/src/dio-buf-fault $src $dst > /dev/null || _fail "failed doing the dio copy"
diff $src $dst
# success, all done
status=$?
exit