]> www.infradead.org Git - users/hch/misc.git/commit
block: remove the same_page output argument from bvec_try_merge_page
authorChristoph Hellwig <hch@lst.de>
Sat, 10 May 2025 03:58:01 +0000 (05:58 +0200)
committerChristoph Hellwig <hch@lst.de>
Sun, 11 May 2025 03:26:46 +0000 (05:26 +0200)
commitd4ede40925016dcf5c1515cc4175249bfb1935a2
tree9ad17404a3e07fa9f80497464e13522fe2368e8a
parent3ee7d9496342246f4353716f6bbf64c945ff6e2d
block: remove the same_page output argument from bvec_try_merge_page

bvec_try_merge_page currently returns if the added page fragment is
within the same page as the last page in the last current bio_vec.

This information is used by __bio_iov_iter_get_pages so that we always
have a single folio pin per page even when the page is split over
multiple __bio_iov_iter_get_pages calls.

Threading this through the entire lowlevel add page to bio logic is
annoying and inefficient and leads to less code sharing than otherwise
possible.  Instead add code to __bio_iov_iter_get_pages that checks
if the the bio_vecs did not change and thus a merge into the last
segment must have happened, and if there is an offset into the page
for the currently added fragment, because if yes we must have already
had a previous fragment of the same page in the last bio_vec.  While
this is still a bit ugly, it keeps the logic in the one place that
needs it and allows for more code sharing.

Signed-off-by: Christoph Hellwig <hch@lst.de>
block/bio-integrity.c
block/bio.c
block/blk.h