From: Brian Foster <bfoster@redhat.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-xfs@vger.kernel.org, Christoph Hellwig <hch@infradead.org>,
"Darrick J . Wong" <djwong@kernel.org>
Subject: [PATCH 02/10] iomap: advance the iter on direct I/O
Date: Wed, 12 Feb 2025 08:57:04 -0500 [thread overview]
Message-ID: <20250212135712.506987-3-bfoster@redhat.com> (raw)
In-Reply-To: <20250212135712.506987-1-bfoster@redhat.com>
Update iomap direct I/O to advance the iter directly rather than via
iter.processed. Since unique subhelpers exist for various mapping
types, advance in the commonly called iomap_dio_iter() function.
Update the switch statement branches to fall out, advance by the
number of bytes processed and return either success or failure.
Signed-off-by: Brian Foster <bfoster@redhat.com>
---
fs/iomap/direct-io.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index b521eb15759e..cb0b0b0f07b3 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -515,22 +515,29 @@ static loff_t iomap_dio_inline_iter(const struct iomap_iter *iomi,
return copied;
}
-static loff_t iomap_dio_iter(const struct iomap_iter *iter,
+static int iomap_dio_iter(struct iomap_iter *iter,
struct iomap_dio *dio)
{
+ loff_t len;
+
switch (iter->iomap.type) {
case IOMAP_HOLE:
if (WARN_ON_ONCE(dio->flags & IOMAP_DIO_WRITE))
return -EIO;
- return iomap_dio_hole_iter(iter, dio);
+ len = iomap_dio_hole_iter(iter, dio);
+ break;
case IOMAP_UNWRITTEN:
if (!(dio->flags & IOMAP_DIO_WRITE))
- return iomap_dio_hole_iter(iter, dio);
- return iomap_dio_bio_iter(iter, dio);
+ len = iomap_dio_hole_iter(iter, dio);
+ else
+ len = iomap_dio_bio_iter(iter, dio);
+ break;
case IOMAP_MAPPED:
- return iomap_dio_bio_iter(iter, dio);
+ len = iomap_dio_bio_iter(iter, dio);
+ break;
case IOMAP_INLINE:
- return iomap_dio_inline_iter(iter, dio);
+ len = iomap_dio_inline_iter(iter, dio);
+ break;
case IOMAP_DELALLOC:
/*
* DIO is not serialised against mmap() access at all, and so
@@ -545,6 +552,10 @@ static loff_t iomap_dio_iter(const struct iomap_iter *iter,
WARN_ON_ONCE(1);
return -EIO;
}
+
+ if (len < 0)
+ return len;
+ return iomap_iter_advance(iter, &len);
}
/*
--
2.48.1
next prev parent reply other threads:[~2025-02-12 13:54 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-12 13:57 [PATCH 00/10] iomap: incremental advance conversion -- phase 2 Brian Foster
2025-02-12 13:57 ` [PATCH 01/10] iomap: advance the iter directly on buffered read Brian Foster
2025-02-13 6:50 ` Christoph Hellwig
2025-02-13 15:24 ` Brian Foster
2025-02-12 13:57 ` Brian Foster [this message]
2025-02-13 6:51 ` [PATCH 02/10] iomap: advance the iter on direct I/O Christoph Hellwig
2025-02-13 15:25 ` Brian Foster
2025-02-12 13:57 ` [PATCH 03/10] iomap: convert misc simple ops to incremental advance Brian Foster
2025-02-13 6:54 ` Christoph Hellwig
2025-02-13 15:26 ` Brian Foster
2025-02-12 13:57 ` [PATCH 04/10] dax: advance the iomap_iter in the read/write path Brian Foster
2025-02-13 6:55 ` Christoph Hellwig
2025-02-13 15:27 ` Brian Foster
2025-02-12 13:57 ` [PATCH 05/10] dax: advance the iomap_iter on zero range Brian Foster
2025-02-13 6:57 ` Christoph Hellwig
2025-02-13 15:27 ` Brian Foster
2025-02-12 13:57 ` [PATCH 06/10] dax: advance the iomap_iter on unshare range Brian Foster
2025-02-12 13:57 ` [PATCH 07/10] dax: advance the iomap_iter on dedupe range Brian Foster
2025-02-12 13:57 ` [PATCH 08/10] dax: advance the iomap_iter on pte and pmd faults Brian Foster
2025-02-12 13:57 ` [PATCH 09/10] iomap: remove unnecessary advance from iomap_iter() Brian Foster
2025-02-13 6:59 ` Christoph Hellwig
2025-02-13 15:27 ` Brian Foster
2025-02-12 13:57 ` [PATCH 10/10] iomap: rename iomap_iter processed field to status Brian Foster
2025-02-13 7:00 ` Christoph Hellwig
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=20250212135712.506987-3-bfoster@redhat.com \
--to=bfoster@redhat.com \
--cc=djwong@kernel.org \
--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