Skip to content

Commit 3a4c5db

Browse files
Matthew Wilcox (Oracle)Sasha Levin
authored andcommitted
bio: Fix bio_first_folio() for SPARSEMEM without VMEMMAP
[ Upstream commit f826ec7 ] 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: 640d193 (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>
1 parent 6bca2ac commit 3a4c5db

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/bio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ static inline void bio_first_folio(struct folio_iter *fi, struct bio *bio,
291291

292292
fi->folio = page_folio(bvec->bv_page);
293293
fi->offset = bvec->bv_offset +
294-
PAGE_SIZE * (bvec->bv_page - &fi->folio->page);
294+
PAGE_SIZE * folio_page_idx(fi->folio, bvec->bv_page);
295295
fi->_seg_count = bvec->bv_len;
296296
fi->length = min(folio_size(fi->folio) - fi->offset, fi->_seg_count);
297297
fi->_next = folio_next(fi->folio);

0 commit comments

Comments
 (0)