Skip to content

Commit c0f8658

Browse files
Brian Fosterbrauner
authored andcommitted
iomap: push non-large folio check into get folio path
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 <[email protected]> Link: https://lore.kernel.org/[email protected] Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent c4f9a1b commit c0f8658

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/iomap/buffered-io.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,9 @@ static struct folio *__iomap_get_folio(struct iomap_iter *iter, size_t len)
746746
const struct iomap_folio_ops *folio_ops = iter->iomap.folio_ops;
747747
loff_t pos = iter->pos;
748748

749+
if (!mapping_large_folio_support(iter->inode->i_mapping))
750+
len = min_t(size_t, len, PAGE_SIZE - offset_in_page(pos));
751+
749752
if (folio_ops && folio_ops->get_folio)
750753
return folio_ops->get_folio(iter, pos, len);
751754
else
@@ -807,9 +810,6 @@ static int iomap_write_begin(struct iomap_iter *iter, size_t len,
807810
if (fatal_signal_pending(current))
808811
return -EINTR;
809812

810-
if (!mapping_large_folio_support(iter->inode->i_mapping))
811-
len = min_t(size_t, len, PAGE_SIZE - offset_in_page(pos));
812-
813813
folio = __iomap_get_folio(iter, len);
814814
if (IS_ERR(folio))
815815
return PTR_ERR(folio);

0 commit comments

Comments
 (0)