Looks good. Reviewed-by: David Disseldorp <ddiss@xxxxxxx> A few minor nits below... On Wed, 22 Feb 2023 11:30:20 -0800, Boris Burkov wrote: ... > + /* touch the first page of the mapping to bring it into cache */ > + c = ((char *)buf)[0]; > + printf("%u\n", c); > + > + do_dio(argv[2], buf, sz); > +} > diff --git a/tests/generic/708 b/tests/generic/708 > new file mode 100755 > index 00000000..ff2e162b > --- /dev/null > +++ b/tests/generic/708 > @@ -0,0 +1,48 @@ > +#! /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 iompap direct_io partial write codepath. s/iompap/iomap > +# > +. ./common/preamble > +_begin_fstest quick auto > +_fixed_by_kernel_commit XXXX 'btrfs: fix dio continue after short write due to buffer page fault' > + > +# Override the default cleanup function. > +_cleanup() > +{ > + cd / > + rm -r -f $tmp.* There's some whitespace damage on the two lines above. > + rm -f $TEST_DIR/dio-buf-fault.* > +} > + > +# Import common functions. > +. ./common/filter > + > +# real QA test starts here > + > +# Modify as appropriate. > +_supported_fs generic > +_require_test > +_require_odirect > +_require_test_program dio-buf-fault > +src=$TEST_DIR/dio-buf-fault.src > +dst=$TEST_DIR/dio-buf-fault.dst > + > +echo "Silence is golden" > + > +$XFS_IO_PROG -fc "pwrite -q 0 $((2 * 1024 * 1024))" $src > +sync > +$here/src/dio-buf-fault $src $dst >> $seqres.full || _fail "failed doing the dio copy" Any reason for redirecting the single character to the 708.full file? It doesn't appear useful for debugging so can probably go to /dev/null