From: Dave Chinner <david@fromorbit.com>
To: Zach Brown <zab@redhat.com>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] generic/326: basic copy_file_range() correctness
Date: Mon, 4 May 2015 16:39:52 +1000 [thread overview]
Message-ID: <20150504063952.GG15810@dastard> (raw)
In-Reply-To: <1428709268-27499-1-git-send-email-zab@redhat.com>
On Fri, Apr 10, 2015 at 04:41:08PM -0700, Zach Brown wrote:
> Add basic tests for the copy_file_range() syscall that's being
> developed. This relies on having added copy_file_range() support to
> xfs_io in xfsprogs.
>
> This is a very rough draft. Feedback welcome!
>
> Signed-off-by: Zach Brown <zab@redhat.com>
> ---
> tests/generic/326 | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/generic/group | 1 +
Missing the golden output file.
> +
> +# real QA test starts here
> +
> +_supported_fs generic
> +_supported_os Linux
> +_require_test
_require_xfs_io_command copy_file_range
> +
> +src="$TEST_DIR/src"
> +dst="$TEST_DIR/dst"
Seeing this is on the test device, the files may already exist so
you should remove them to give us a known good starting point.
Also, add $seq to the filename so that we know what test created the
files.
> +$XFS_IO_PROG -ftc "pwrite -S 0x12 0 128k" "$src" | _filter_xfs_io
Add a "-c fsync" to ensure the file is on disk.
> +od -x "$src"
I'd just md5sum the file; if there's a mismatch, the dev can then
look at it in more detail...
> +echo "extend destination file"
> +$XFS_IO_PROG -ftc "copy_file_range -i $src -s 0 -t 0 $((128 * 1024))" "$dst" \
> + | _filter_xfs_io
-t 0 128k ?
Also, the truncate of the destination file is not obvious here,
which is another good reason to rm -rf to begin with.
> +od -x "$dst"
> +echo "copy into previously written region"
> +$XFS_IO_PROG -ft -c "pwrite -S 0xef 0 128k" "$dst" \
> + -c "copy_file_range -i $src -s 0 -t 0 $((128 * 1024))" \
> + | _filter_xfs_io
> +od -x "$dst"
The truncate makes this a write into a delalloc region.
Add a fsync after the write to make it a copy into a written region.
> +echo "copy into fallocate"
> +$XFS_IO_PROG -ft -c "falloc 0 128k" "$dst" \
> + -c "copy_file_range -i $src -s 0 -t 0 $((128 * 1024))" \
> + | _filter_xfs_io
> +od -x "$dst"
"copy into preallocated region"
> +echo "copy from likely sparse source"
> +$XFS_IO_PROG -ft -c "pwrite -S 0x56 96k 32k" "$src" \
> + -c "pwrite -S 0x34 0 32k" | _filter_xfs_io
fsync.
> +$XFS_IO_PROG -ftc "copy_file_range -i $src -s 0 -t 0 $((128 * 1024))" "$dst" \
> + | _filter_xfs_io
> +od -x "$dst"
> +
> +echo "source at eof"
> +$XFS_IO_PROG -ftc \
> + "copy_file_range -i $src -s $((128 * 1024)) -t 0 $((128 * 1024))" \
> + "$dst" | _filter_xfs_io
What is this supposed to leave? An empty file? If so, md5sum will
still verify that...
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
prev parent reply other threads:[~2015-05-04 6:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-10 23:41 [PATCH] generic/326: basic copy_file_range() correctness Zach Brown
2015-05-04 6:39 ` Dave Chinner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150504063952.GG15810@dastard \
--to=david@fromorbit.com \
--cc=fstests@vger.kernel.org \
--cc=zab@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox