diff mbox series

[v2,04/12] dax: advance the iomap_iter in the read/write path

Message ID 20250219175050.83986-5-bfoster@redhat.com (mailing list archive)
State New
Headers show
Series iomap: incremental advance conversion -- phase 2 | expand

Commit Message

Brian Foster Feb. 19, 2025, 5:50 p.m. UTC
DAX reads and writes flow through dax_iomap_iter(), which has one or
more subtleties in terms of how it processes a range vs. what is
specified in the iomap_iter. To keep things simple and remove the
dependency on iomap_iter() advances, convert a positive return from
dax_iomap_iter() to the new advance and status return semantics. The
advance can be pushed further down in future patches.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 fs/dax.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Darrick J. Wong Feb. 19, 2025, 10:33 p.m. UTC | #1
On Wed, Feb 19, 2025 at 12:50:42PM -0500, Brian Foster wrote:
> DAX reads and writes flow through dax_iomap_iter(), which has one or
> more subtleties in terms of how it processes a range vs. what is
> specified in the iomap_iter. To keep things simple and remove the
> dependency on iomap_iter() advances, convert a positive return from
> dax_iomap_iter() to the new advance and status return semantics. The
> advance can be pushed further down in future patches.
> 
> Signed-off-by: Brian Foster <bfoster@redhat.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Not sure why this and the next patch are split up but it's fsdax so meh.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fs/dax.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/dax.c b/fs/dax.c
> index 21b47402b3dc..296f5aa18640 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -1585,8 +1585,12 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
>  	if (iocb->ki_flags & IOCB_NOWAIT)
>  		iomi.flags |= IOMAP_NOWAIT;
>  
> -	while ((ret = iomap_iter(&iomi, ops)) > 0)
> +	while ((ret = iomap_iter(&iomi, ops)) > 0) {
>  		iomi.processed = dax_iomap_iter(&iomi, iter);
> +		if (iomi.processed > 0)
> +			iomi.processed = iomap_iter_advance(&iomi,
> +							    &iomi.processed);
> +	}
>  
>  	done = iomi.pos - iocb->ki_pos;
>  	iocb->ki_pos = iomi.pos;
> -- 
> 2.48.1
> 
>
Brian Foster Feb. 20, 2025, 2:58 p.m. UTC | #2
On Wed, Feb 19, 2025 at 02:33:44PM -0800, Darrick J. Wong wrote:
> On Wed, Feb 19, 2025 at 12:50:42PM -0500, Brian Foster wrote:
> > DAX reads and writes flow through dax_iomap_iter(), which has one or
> > more subtleties in terms of how it processes a range vs. what is
> > specified in the iomap_iter. To keep things simple and remove the
> > dependency on iomap_iter() advances, convert a positive return from
> > dax_iomap_iter() to the new advance and status return semantics. The
> > advance can be pushed further down in future patches.
> > 
> > Signed-off-by: Brian Foster <bfoster@redhat.com>
> > Reviewed-by: Christoph Hellwig <hch@lst.de>
> 
> Not sure why this and the next patch are split up but it's fsdax so meh.
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
> 

Heh.. mainly just out of caution and bisectability. The subsequent patch
took a bit of fighting for me to get right and this patch served as a
nice baseline to isolate changes in the DAX I/O path from the functional
iomap change, since this patch is relatively trivial.

Thanks for the reviews..

Brian

> --D
> 
> > ---
> >  fs/dax.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/dax.c b/fs/dax.c
> > index 21b47402b3dc..296f5aa18640 100644
> > --- a/fs/dax.c
> > +++ b/fs/dax.c
> > @@ -1585,8 +1585,12 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
> >  	if (iocb->ki_flags & IOCB_NOWAIT)
> >  		iomi.flags |= IOMAP_NOWAIT;
> >  
> > -	while ((ret = iomap_iter(&iomi, ops)) > 0)
> > +	while ((ret = iomap_iter(&iomi, ops)) > 0) {
> >  		iomi.processed = dax_iomap_iter(&iomi, iter);
> > +		if (iomi.processed > 0)
> > +			iomi.processed = iomap_iter_advance(&iomi,
> > +							    &iomi.processed);
> > +	}
> >  
> >  	done = iomi.pos - iocb->ki_pos;
> >  	iocb->ki_pos = iomi.pos;
> > -- 
> > 2.48.1
> > 
> > 
>
diff mbox series

Patch

diff --git a/fs/dax.c b/fs/dax.c
index 21b47402b3dc..296f5aa18640 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1585,8 +1585,12 @@  dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
 	if (iocb->ki_flags & IOCB_NOWAIT)
 		iomi.flags |= IOMAP_NOWAIT;
 
-	while ((ret = iomap_iter(&iomi, ops)) > 0)
+	while ((ret = iomap_iter(&iomi, ops)) > 0) {
 		iomi.processed = dax_iomap_iter(&iomi, iter);
+		if (iomi.processed > 0)
+			iomi.processed = iomap_iter_advance(&iomi,
+							    &iomi.processed);
+	}
 
 	done = iomi.pos - iocb->ki_pos;
 	iocb->ki_pos = iomi.pos;