mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daan De Meyer via B4 Relay <devnull+daan.amutable.com@kernel.org>
To: Chris Mason <clm@fb.com>, David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Daan De Meyer <daan@amutable.com>
Subject: [PATCH 0/2] btrfs: allow reflinks into NODATASUM files
Date: Sun, 12 Jul 2026 16:25:12 +0200	[thread overview]
Message-ID: <20260712-reflink-into-nodatasum-v1-0-9f27ef836073@amutable.com> (raw)

The primary use case for this series is building a NOCOW VM image from
individual partition images that are COW and checksummed. Today those
partitions cannot be cloned into the NODATACOW and NODATASUM destination,
so tools fall back to a full copy. This makes provisioning slower and
duplicates all of the image data up front.

Allow cloning and deduplication from a checksummed file into a NODATASUM
file. The VM image can then share extents with the partition images.
Existing checksummed extents are COWed once when modified, protecting the
source checksums, while newly allocated extents use the destination's
normal NOCOW behavior.

The reverse direction remains rejected because the destination would
expect checksums that do not exist.

Patch 1 prevents swap activation from bypassing the COW protection when a
NODATASUM file references checksummed extents. Patch 2 relaxes the reflink
restriction in the safe direction.

The xfstests branch is available at:
https://github.com/kdave/xfstests/pull/6

Signed-off-by: Daan De Meyer <daan@amutable.com>
---
Daan De Meyer (2):
      btrfs: reject swapfile activation if any extent has checksums
      btrfs: allow reflinking from checksummed files into nodatasum files

 fs/btrfs/inode.c   | 29 +++++++++++++++++++++++++++++
 fs/btrfs/reflink.c | 18 ++++++++++++++----
 2 files changed, 43 insertions(+), 4 deletions(-)
---
base-commit: cab9e339cfbc1a4e075e53e281dfb00391e1a6bb
change-id: 20260712-reflink-into-nodatasum-aff962f3794e

Best regards,
--  
Daan De Meyer <daan@amutable.com>



             reply	other threads:[~2026-07-12 14:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-12 14:25 Daan De Meyer via B4 Relay [this message]
2026-07-12 14:25 ` [PATCH 1/2] btrfs: reject swapfile activation if any extent has checksums Daan De Meyer via B4 Relay
2026-07-12 14:25 ` [PATCH 2/2] btrfs: allow reflinking from checksummed files into nodatasum files Daan De Meyer via B4 Relay
2026-07-12 15:06 ` [PATCH 0/2] btrfs: allow reflinks into NODATASUM files Neal Gompa
2026-07-12 22:18   ` Qu Wenruo
2026-07-13  2:45     ` Neal Gompa
2026-07-12 21:42 ` Qu Wenruo

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=20260712-reflink-into-nodatasum-v1-0-9f27ef836073@amutable.com \
    --to=devnull+daan.amutable.com@kernel.org \
    --cc=clm@fb.com \
    --cc=daan@amutable.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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