From: Brian Foster <bfoster@redhat.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-xfs@vger.kernel.org, djwong@kernel.org, hch@infradead.org
Subject: [PATCH v2 5/6] iomap: push non-large folio check into get folio path
Date: Tue, 6 May 2025 09:41:17 -0400 [thread overview]
Message-ID: <20250506134118.911396-6-bfoster@redhat.com> (raw)
In-Reply-To: <20250506134118.911396-1-bfoster@redhat.com>
The len param to __iomap_get_folio() is primarily a folio allocation
hint. iomap_write_begin() already trims its local len variable based
on the provided folio, so move the large folio support check closer
to folio lookup.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
fs/iomap/buffered-io.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 11046a3c60fe..92d7b659db33 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -746,6 +746,9 @@ static struct folio *__iomap_get_folio(struct iomap_iter *iter, size_t len)
const struct iomap_folio_ops *folio_ops = iter->iomap.folio_ops;
loff_t pos = iter->pos;
+ if (!mapping_large_folio_support(iter->inode->i_mapping))
+ len = min_t(size_t, len, PAGE_SIZE - offset_in_page(pos));
+
if (folio_ops && folio_ops->get_folio)
return folio_ops->get_folio(iter, pos, len);
else
@@ -807,9 +810,6 @@ static int iomap_write_begin(struct iomap_iter *iter, size_t len,
if (fatal_signal_pending(current))
return -EINTR;
- if (!mapping_large_folio_support(iter->inode->i_mapping))
- len = min_t(size_t, len, PAGE_SIZE - offset_in_page(pos));
-
folio = __iomap_get_folio(iter, len);
if (IS_ERR(folio))
return PTR_ERR(folio);
--
2.49.0
next prev parent reply other threads:[~2025-05-06 13:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-06 13:41 [PATCH v2 0/6] iomap: misc buffered write path cleanups and prep Brian Foster
2025-05-06 13:41 ` [PATCH v2 1/6] iomap: resample iter->pos after iomap_write_begin() calls Brian Foster
2025-05-06 13:41 ` [PATCH v2 2/6] iomap: drop unnecessary pos param from iomap_write_[begin|end] Brian Foster
2025-05-06 13:41 ` [PATCH v2 3/6] iomap: drop pos param from __iomap_[get|put]_folio() Brian Foster
2025-05-06 13:41 ` [PATCH v2 4/6] iomap: helper to trim pos/bytes to within folio Brian Foster
2025-05-06 13:41 ` Brian Foster [this message]
2025-05-06 13:41 ` [PATCH v2 6/6] iomap: rework iomap_write_begin() to return folio offset and length Brian Foster
2025-05-09 10:36 ` [PATCH v2 0/6] iomap: misc buffered write path cleanups and prep Christian Brauner
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=20250506134118.911396-6-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;
as well as URLs for NNTP newsgroup(s).