summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorAnuj Gupta <anuj20.g@samsung.com>2023-05-23 14:17:09 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-06-05 10:26:21 +0300
commitefc8ec1636fa962acf709741fce1e4d0a974e70a (patch)
treee7cb68fc7852b46c493fc68bfffb057ca5db07bc /block
parent5d08604754e843bad0eeb6ea2dd03ca4a2278752 (diff)
downloadlinux-efc8ec1636fa962acf709741fce1e4d0a974e70a.tar.xz
block: fix bio-cache for passthru IO
commit 46930b7cc7727271c9c27aac1fdc97a8645e2d00 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'block')
-rw-r--r--block/blk-map.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/blk-map.c b/block/blk-map.c
index 34735626b00f..66da9e2b19ab 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -246,7 +246,7 @@ static struct bio *blk_rq_map_bio_alloc(struct request *rq,
{
struct bio *bio;
- if (rq->cmd_flags & REQ_POLLED) {
+ if (rq->cmd_flags & REQ_POLLED && (nr_vecs <= BIO_INLINE_VECS)) {
blk_opf_t opf = rq->cmd_flags | REQ_ALLOC_CACHE;
bio = bio_alloc_bioset(NULL, nr_vecs, opf, gfp_mask,