From: "Darrick J. Wong" <djwong@kernel.org>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH v2 08/12] dax: advance the iomap_iter on dedupe range
Date: Wed, 19 Feb 2025 14:35:46 -0800 [thread overview]
Message-ID: <20250219223546.GN21808@frogsfrogsfrogs> (raw)
In-Reply-To: <20250219175050.83986-9-bfoster@redhat.com>
On Wed, Feb 19, 2025 at 12:50:46PM -0500, Brian Foster wrote:
> Advance the iter on successful dedupe. Dedupe range uses two iters
> and iterates so long as both have outstanding work, so
> correspondingly this needs to advance both on each iteration. Since
> dax_range_compare_iter() now returns status instead of a byte count,
> update the variable name in the caller as well.
>
> Signed-off-by: Brian Foster <bfoster@redhat.com>
Double iterators, hrhghghggh
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> fs/dax.c | 21 ++++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/fs/dax.c b/fs/dax.c
> index c0fbab8c66f7..c8c0d81122ab 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -2001,12 +2001,13 @@ vm_fault_t dax_finish_sync_fault(struct vm_fault *vmf, unsigned int order,
> }
> EXPORT_SYMBOL_GPL(dax_finish_sync_fault);
>
> -static loff_t dax_range_compare_iter(struct iomap_iter *it_src,
> +static int dax_range_compare_iter(struct iomap_iter *it_src,
> struct iomap_iter *it_dest, u64 len, bool *same)
> {
> const struct iomap *smap = &it_src->iomap;
> const struct iomap *dmap = &it_dest->iomap;
> loff_t pos1 = it_src->pos, pos2 = it_dest->pos;
> + u64 dest_len;
> void *saddr, *daddr;
> int id, ret;
>
> @@ -2014,7 +2015,7 @@ static loff_t dax_range_compare_iter(struct iomap_iter *it_src,
>
> if (smap->type == IOMAP_HOLE && dmap->type == IOMAP_HOLE) {
> *same = true;
> - return len;
> + goto advance;
> }
>
> if (smap->type == IOMAP_HOLE || dmap->type == IOMAP_HOLE) {
> @@ -2037,7 +2038,13 @@ static loff_t dax_range_compare_iter(struct iomap_iter *it_src,
> if (!*same)
> len = 0;
> dax_read_unlock(id);
> - return len;
> +
> +advance:
> + dest_len = len;
> + ret = iomap_iter_advance(it_src, &len);
> + if (!ret)
> + ret = iomap_iter_advance(it_dest, &dest_len);
> + return ret;
>
> out_unlock:
> dax_read_unlock(id);
> @@ -2060,15 +2067,15 @@ int dax_dedupe_file_range_compare(struct inode *src, loff_t srcoff,
> .len = len,
> .flags = IOMAP_DAX,
> };
> - int ret, compared = 0;
> + int ret, status;
>
> while ((ret = iomap_iter(&src_iter, ops)) > 0 &&
> (ret = iomap_iter(&dst_iter, ops)) > 0) {
> - compared = dax_range_compare_iter(&src_iter, &dst_iter,
> + status = dax_range_compare_iter(&src_iter, &dst_iter,
> min(src_iter.len, dst_iter.len), same);
> - if (compared < 0)
> + if (status < 0)
> return ret;
> - src_iter.processed = dst_iter.processed = compared;
> + src_iter.processed = dst_iter.processed = status;
> }
> return ret;
> }
> --
> 2.48.1
>
>
next prev parent reply other threads:[~2025-02-19 22:35 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-19 17:50 [PATCH v2 00/12] iomap: incremental advance conversion -- phase 2 Brian Foster
2025-02-19 17:50 ` [PATCH v2 01/12] iomap: advance the iter directly on buffered read Brian Foster
2025-02-19 22:22 ` Darrick J. Wong
2025-02-19 22:31 ` Darrick J. Wong
2025-02-19 17:50 ` [PATCH v2 02/12] iomap: advance the iter on direct I/O Brian Foster
2025-02-19 22:22 ` Darrick J. Wong
2025-02-19 17:50 ` [PATCH v2 03/12] iomap: convert misc simple ops to incremental advance Brian Foster
2025-02-19 22:24 ` Darrick J. Wong
2025-02-19 22:31 ` Darrick J. Wong
2025-02-19 17:50 ` [PATCH v2 04/12] dax: advance the iomap_iter in the read/write path Brian Foster
2025-02-19 22:33 ` Darrick J. Wong
2025-02-20 14:58 ` Brian Foster
2025-02-19 17:50 ` [PATCH v2 05/12] dax: push advance down into dax_iomap_iter() for read and write Brian Foster
2025-02-19 22:34 ` Darrick J. Wong
2025-02-19 17:50 ` [PATCH v2 06/12] dax: advance the iomap_iter on zero range Brian Foster
2025-02-19 22:34 ` Darrick J. Wong
2025-02-19 17:50 ` [PATCH v2 07/12] dax: advance the iomap_iter on unshare range Brian Foster
2025-02-19 22:35 ` Darrick J. Wong
2025-02-19 17:50 ` [PATCH v2 08/12] dax: advance the iomap_iter on dedupe range Brian Foster
2025-02-19 22:35 ` Darrick J. Wong [this message]
2025-02-19 17:50 ` [PATCH v2 09/12] dax: advance the iomap_iter on pte and pmd faults Brian Foster
2025-02-19 22:36 ` Darrick J. Wong
2025-02-19 17:50 ` [PATCH v2 10/12] iomap: remove unnecessary advance from iomap_iter() Brian Foster
2025-02-19 22:30 ` Darrick J. Wong
2025-02-19 17:50 ` [PATCH v2 11/12] iomap: rename iomap_iter processed field to status Brian Foster
2025-02-19 22:30 ` Darrick J. Wong
2025-02-19 17:50 ` [PATCH v2 12/12] iomap: introduce a full map advance helper Brian Foster
2025-02-19 22:31 ` Darrick J. Wong
2025-02-20 9:10 ` [PATCH v2 00/12] iomap: incremental advance conversion -- phase 2 Christian Brauner
2025-02-20 14:59 ` Brian Foster
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=20250219223546.GN21808@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=bfoster@redhat.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@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;
as well as URLs for NNTP newsgroup(s).