From: Matthias Goergens <matthias.goergens@gmail.com>
To: linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk,
brauner@kernel.org, jack@suse.cz
Cc: linux-kernel@vger.kernel.org, hch@infradead.org,
djwong@kernel.org, david@fromorbit.com, amir73il@gmail.com,
ansgar.loesser@kom.tu-darmstadt.de,
Matthias Goergens <matthias.goergens@gmail.com>
Subject: [PATCH v4 0/2] vfs: add FILE_DEDUPE_RANGE_REPORT_PROGRESS flag to FIDEDUPERANGE
Date: Fri, 18 Sep 2026 18:37:36 +0800 [thread overview]
Message-ID: <cover.1789653814.git.matthias.goergens@gmail.com> (raw)
In-Reply-To: <aoQcvGw4UmkMKmUz@infradead.org>
Christoph, fair enough, and sorry for the delay. v4 follows with the
changelog rewritten to start from the callers: dedupe tools advance
their file offsets by bytes_deduped, the kernel can shorten a request to
a block boundary but reports the requested length, and rmlint on an
ordinary invocation therefore reports a pair as fully deduplicated with
the last 1696 bytes of it not shared.
Checking the v4 text against the code turned up two changes of
substance.
The DIFFERS advance hint from v3 is gone. The comparison covers the
whole shortened range and stops at the first mismatch anywhere in it,
so on DIFFERS the kernel has no mismatch offset to report; a one-block
hint would tell a caller to skip a block that may match. v4
reports 0 on DIFFERS and leaves subdividing to the caller, which is
what rmlint already does. Darrick, on your sketch specifically: that is
why I dropped it; if you still want a hint there, I would rather it be
the compared length than one block.
Patch 1 is new: dax_dedupe_file_range_compare() returns the positive
iomap_iter() count instead of the comparison error, and XFS passes that
up as the remap result. Today the ioctl masks it by reporting the
requested length; with the flag it would surface as a successful
one-byte dedupe, so it needs fixing first.
Also corrected from v3: its text described the flags field as a union
with the old reserved2 name, but the diff was a plain rename. v4 has the
union; both spellings compile and the struct size is unchanged. And the
changelog now attributes the shortening to generic_remap_checks(), which
runs before the comparison; v3 named generic_remap_check_len(), which
runs after it.
Two things I looked at and left alone, so that they are on record:
ocfs2 returns 0 after copying inline data for a whole-file request, so
under the flag that case reports SAME with 0 (FICLONERANGE already gets
-EINVAL there today); and kernels before 4.5 ignored the reserved
field in the btrfs ioctl, so only 4.5 and later reject the flag.
The fstests test for the flag (generic/806 v2 on the fstests list) was
written for the v3 semantics and needs a v3 of its own; that and the
ioctl_fideduperange(2) man-page update follow once this settles.
Changes since v3
(https://lore.kernel.org/linux-fsdevel/20260817115609.3586664-2-matthias.goergens@gmail.com/):
- Changelog rewritten to start from the callers and the measured rmlint
case (Christoph).
- DIFFERS no longer carries an advance hint; bytes_deduped is 0 there.
- New patch 1 fixing the DAX comparator's return value.
- The flags field is an anonymous union with reserved2, as the v3 text
already claimed; v3's diff was a plain rename.
- Shortening attributed to generic_remap_checks(); v3 named
generic_remap_check_len(), which runs after the comparison.
Matthias Goergens (2):
dax: return the comparison error from dax_dedupe_file_range_compare()
vfs: add FILE_DEDUPE_RANGE_REPORT_PROGRESS flag to FIDEDUPERANGE
fs/dax.c | 2 +-
fs/remap_range.c | 4 +++-
include/uapi/linux/fs.h | 8 +++++++-
3 files changed, 11 insertions(+), 3 deletions(-)
--
2.55.0
next prev parent reply other threads:[~2026-09-18 10:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 7:14 [PATCH 0/2] vfs: report truthful FIDEDUPERANGE progress safely Matthias Goergens
2026-08-05 7:14 ` [PATCH 1/2] vfs: fail dedupe requests that cannot make progress Matthias Goergens
2026-08-05 7:14 ` [PATCH 2/2] vfs: report the amount of bytes actually deduplicated Matthias Goergens
2026-08-12 7:46 ` [PATCH 0/2] vfs: report truthful FIDEDUPERANGE progress safely Christian Brauner
2026-08-13 15:33 ` Amir Goldstein
2026-08-13 20:09 ` Darrick J. Wong
2026-08-14 8:23 ` [PATCH v2 0/1] vfs: add FILE_DEDUPE_RANGE_REPORT_PROGRESS flag to FIDEDUPERANGE Matthias Goergens
2026-08-14 8:23 ` [PATCH v2] " Matthias Goergens
2026-08-14 16:16 ` Darrick J. Wong
2026-08-17 11:56 ` [PATCH v3 0/1] " Matthias Goergens
2026-08-17 11:56 ` [PATCH v3] " Matthias Goergens
2026-08-18 8:50 ` Christoph Hellwig
2026-09-18 10:37 ` Matthias Goergens [this message]
2026-09-18 10:37 ` [PATCH v4 1/2] dax: return the comparison error from dax_dedupe_file_range_compare() Matthias Goergens
2026-09-18 10:37 ` [PATCH v4 2/2] vfs: add FILE_DEDUPE_RANGE_REPORT_PROGRESS flag to FIDEDUPERANGE Matthias Goergens
2026-09-18 11:21 ` Amir Goldstein
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=cover.1789653814.git.matthias.goergens@gmail.com \
--to=matthias.goergens@gmail.com \
--cc=amir73il@gmail.com \
--cc=ansgar.loesser@kom.tu-darmstadt.de \
--cc=brauner@kernel.org \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®