summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2025-06-12 17:41:25 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-06-19 16:28:44 +0300
commit9e263d94593b733b0fc4cb123c31027b37ab5e37 (patch)
tree0f6d6d7489f9234b8e4c824a944e7c157b08e97a /include/linux
parent51c695986fa1eee8279c78351c31a92ab7225ee9 (diff)
downloadlinux-9e263d94593b733b0fc4cb123c31027b37ab5e37.tar.xz
bio: Fix bio_first_folio() for SPARSEMEM without VMEMMAP
[ Upstream commit f826ec7966a63d48e16e0868af4e038bf9a1a3ae ] It is possible for physically contiguous folios to have discontiguous struct pages if SPARSEMEM is enabled and SPARSEMEM_VMEMMAP is not. This is correctly handled by folio_page_idx(), so remove this open-coded implementation. Fixes: 640d1930bef4 (block: Add bio_for_each_folio_all()) Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Link: https://lore.kernel.org/r/20250612144126.2849931-1-willy@infradead.org Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bio.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index b893418c3cc0..f193aef4fac0 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -294,7 +294,7 @@ static inline void bio_first_folio(struct folio_iter *fi, struct bio *bio,
fi->folio = page_folio(bvec->bv_page);
fi->offset = bvec->bv_offset +
- PAGE_SIZE * (bvec->bv_page - &fi->folio->page);
+ PAGE_SIZE * folio_page_idx(fi->folio, bvec->bv_page);
fi->_seg_count = bvec->bv_len;
fi->length = min(folio_size(fi->folio) - fi->offset, fi->_seg_count);
fi->_next = folio_next(fi->folio);