Skip to content

Commit 46930b7

Browse files
Anuj Guptaaxboe
authored andcommitted
block: fix bio-cache for passthru IO
commit <8af870aa5b847> ("block: enable bio caching use for passthru IO") introduced bio-cache for passthru IO. In case when nr_vecs are greater than BIO_INLINE_VECS, bio and bvecs are allocated from mempool (instead of percpu cache) and REQ_ALLOC_CACHE is cleared. This causes the side effect of not freeing bio/bvecs into mempool on completion. This patch lets the passthru IO fallback to allocation using bio_kmalloc when nr_vecs are greater than BIO_INLINE_VECS. The corresponding bio is freed during call to blk_mq_map_bio_put during completion. Cc: stable@vger.kernel.org # 6.1 fixes <8af870aa5b847> ("block: enable bio caching use for passthru IO") Signed-off-by: Anuj Gupta <anuj20.g@samsung.com> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com> Link: https://lore.kernel.org/r/20230523111709.145676-1-anuj20.g@samsung.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent da8d2fe commit 46930b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block/blk-map.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static struct bio *blk_rq_map_bio_alloc(struct request *rq,
248248
{
249249
struct bio *bio;
250250

251-
if (rq->cmd_flags & REQ_ALLOC_CACHE) {
251+
if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) {
252252
bio = bio_alloc_bioset(NULL, nr_vecs, rq->cmd_flags, gfp_mask,
253253
&fs_bio_set);
254254
if (!bio)

0 commit comments

Comments
 (0)