Message ID | 20240704070357.1993-2-kundan.kumar@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | block: add larger order folio instead of pages | expand |
I'd say folio-ized, in the subject (also for the next patch), but I'm not a native speaker and this is all pretty odd terminology anyway.. > index e9e809a63c59..c10f5fa0ba27 100644 > --- a/block/bio.c > +++ b/block/bio.c > @@ -952,6 +952,23 @@ bool bvec_try_merge_hw_page(struct request_queue *q, struct bio_vec *bv, > struct page *page, unsigned len, unsigned offset, > bool *same_page) > { > + struct folio *folio = page_folio(page); > + > + return bvec_try_merge_hw_folio(q, bv, folio, len, > + ((size_t)folio_page_idx(folio, page) << PAGE_SHIFT) + > + offset, same_page); > +} > + > +/* > + * Try to merge a folio into a segment, while obeying the hardware segment > + * size limit. This is not for normal read/write bios, but for passthrough > + * or Zone Append operations that we can't split. > + */ > +bool bvec_try_merge_hw_folio(struct request_queue *q, struct bio_vec *bv, > + struct folio *folio, size_t len, size_t offset, > + bool *same_page) Placing the wrapper above the guts of the implementation is a bit odd. Can you reorder these? Otherwise looks good: Reviewed-by: Christoph Hellwig <hch@lst.de>
diff --git a/block/bio.c b/block/bio.c index e9e809a63c59..c10f5fa0ba27 100644 --- a/block/bio.c +++ b/block/bio.c @@ -952,6 +952,23 @@ bool bvec_try_merge_hw_page(struct request_queue *q, struct bio_vec *bv, struct page *page, unsigned len, unsigned offset, bool *same_page) { + struct folio *folio = page_folio(page); + + return bvec_try_merge_hw_folio(q, bv, folio, len, + ((size_t)folio_page_idx(folio, page) << PAGE_SHIFT) + + offset, same_page); +} + +/* + * Try to merge a folio into a segment, while obeying the hardware segment + * size limit. This is not for normal read/write bios, but for passthrough + * or Zone Append operations that we can't split. + */ +bool bvec_try_merge_hw_folio(struct request_queue *q, struct bio_vec *bv, + struct folio *folio, size_t len, size_t offset, + bool *same_page) +{ + struct page *page = folio_page(folio, 0); unsigned long mask = queue_segment_boundary(q); phys_addr_t addr1 = page_to_phys(bv->bv_page) + bv->bv_offset; phys_addr_t addr2 = page_to_phys(page) + offset + len - 1; diff --git a/block/blk.h b/block/blk.h index 47dadd2439b1..17478657c5ef 100644 --- a/block/blk.h +++ b/block/blk.h @@ -94,6 +94,10 @@ bool bvec_try_merge_hw_page(struct request_queue *q, struct bio_vec *bv, struct page *page, unsigned len, unsigned offset, bool *same_page); +bool bvec_try_merge_hw_folio(struct request_queue *q, struct bio_vec *bv, + struct folio *folio, size_t len, size_t offset, + bool *same_page); + static inline bool biovec_phys_mergeable(struct request_queue *q, struct bio_vec *vec1, struct bio_vec *vec2) {
Added new function bvec_try_merge_hw_folio(). This is a prep patch. Signed-off-by: Kundan Kumar <kundan.kumar@samsung.com> --- block/bio.c | 17 +++++++++++++++++ block/blk.h | 4 ++++ 2 files changed, 21 insertions(+)