Re: [PATCH] btrfs: test checksum handling for clone, dedupe and swap on NOCOW files
Qu Wenruo <[email protected]>
| Newsgroups | org.kernel.vger.linux-btrfs |
|---|---|
| Message-ID | <[email protected]> |
在 2026/7/13 16:42, Daan De Meyer 写道: > > I strongly doubt if you have run the test btrfs/348. > > I did actually run the test, I just forgot to open the upstream PR for > btrfs-progs with the necessary changes. Will push that PR to btrfs-progs > now. No, considering there is no compat/incompat bit to indicate this change, your progs update will prevent it from detecting real missing or unexpected csums problems on older kernels. As I replied in another thread to Neal, the if you want to implement this feature, it is not a simple just-allow-reflink-from-datasum-to-nodatasum change. You have to change the current per-inode csum flags into a per-extent csum flags. Or please tell me how to distinguish missing/unexpected csums? Furthermore, considering how bad you completely ignored all previous notification on the regression caused by 32bit compatible ioctl, and you have no consideration of any compatibility on older kernels, I am not a fan of this feature at all. > > Daan > > On Mon, Jul 13, 2026 at 12:01 AM Qu Wenruo <[email protected] > <mailto:[email protected]>> wrote: > > > > 在 2026/7/13 00:07, Daan De Meyer via B4 Relay 写道: > > From: Daan De Meyer <[email protected] <mailto:[email protected]>> > > > > Add two tests covering how checksummed and NOCOW extents interact. > > > > btrfs/348 verifies that checksummed extents can be cloned and > > deduplicated into NOCOW files, and that the reverse direction stays > > rejected because NOCOW extents do not have checksums. > > I strongly doubt if you have run the test btrfs/348. > > As a very basic reflink clone from a datasum inode into nodatasum inode > will cause btrfs check errors, with your kernel patch applied: > > # mkfs.btrfs -f $dev > # mount $dev $mnt > # xfs_io -f -c "pwrite 0 64k" -c sync $mnt/file1 > # mount -o remount,nodatasum $mnt > # touch $mnt/file2 > # xfs_io -c "reflink $mnt/file1" $mnt/file2 > # umount $mnt > # btrfs check $dev > Opening filesystem to check... > Checking filesystem on /dev/test/scratch1 > UUID: efcb3cdd-5dd9-416d-89ac-33071c59c9e7 > [1/8] checking log skipped (none written) > [2/8] checking root items > [3/8] checking extents > [4/8] checking free space tree > [5/8] checking fs roots > root 5 inode 258 errors 800, odd csum item > ERROR: errors found in fs roots > found 229376 bytes used, error(s) found > > > > > btrfs/349 verifies that a NOCOW swap file containing a checksummed > > extent is rejected even after the checksummed source is deleted > and the > > extent is no longer shared. > > > > Signed-off-by: Daan De Meyer <[email protected] > <mailto:[email protected]>> > > --- > > These tests cover the kernel series available at: > > https://lore.kernel.org/linux-btrfs/20260712-reflink-into- > [email protected]/ <https://lore.kernel.org/ > linux-btrfs/20260712-reflink-into-nodatasum- > [email protected]/> > > --- > > tests/btrfs/348 | 180 +++++++++++++++++++++++++++++++++++++ > +++++++++++++++ > > tests/btrfs/348.out | 2 + > > tests/btrfs/349 | 73 +++++++++++++++++++++ > > tests/btrfs/349.out | 2 + > > 4 files changed, 257 insertions(+) > > > > diff --git a/tests/btrfs/348 b/tests/btrfs/348 > > new file mode 100755 > > index 00000000..4faf994e > > --- /dev/null > > +++ b/tests/btrfs/348 > > @@ -0,0 +1,180 @@ > > +#! /bin/bash > > +# SPDX-License-Identifier: GPL-2.0 > > +# Copyright (c) 2026 Daan De Meyer. All Rights Reserved. > > +# > > +# FS QA Test 348 > > +# > > +# Verify that checksummed extents can be cloned and deduplicated > into NOCOW > > +# files. The reverse direction must remain rejected because > NOCOW extents do > > +# not have checksums. > > +# > > +. ./common/preamble > > +_begin_fstest auto quick clone dedupe scrub > > + > > +. ./common/reflink > > + > > +_require_scratch_reflink > > +_require_scratch_dedupe > > +_require_chattr C > > +_require_btrfs_no_nodatacow > > +_require_btrfs_no_nodatasum > > +_require_btrfs_command inspect-internal dump-tree > > + > > +_fixed_by_kernel_commit 28ce1d263f4d \ > > + "btrfs: allow reflinking from checksummed files into > nodatasum files" > > Nope, this is not a fix, nor the commit is upstreamed. > > A proper test case should detect older kernels and skip if it doesn't > support a new feature. >