From 79a76a7b95d7b333d2dbf559332b9af799221617 Mon Sep 17 00:00:00 2001 From: Baolin Wang Date: Wed, 15 Jul 2020 09:22:15 +0800 Subject: [PATCH 1805/2944] alinux: nvme-pci: Improve mapping single segment requests using PRP fix #29327388 Now the blk-mq did not support multi-page bvec, which means each bvec can only contain one page. For simple PRP, it just support one bvec in the bio though the physical segment is only 1, otherwise it can not map the whole request. In future if we support multi-page bvecs, this patch can be dropped. Signed-off-by: Baolin Wang Reviewed-by: Joseph Qi --- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index c8b9547..02c8569 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -852,8 +852,9 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req, if (blk_rq_nr_phys_segments(req) == 1) { struct bio_vec bv = req_bvec(req); + unsigned int bio_pages = bio_pages_all(req->bio); - if (bv.bv_offset + bv.bv_len <= dev->ctrl.page_size * 2) + if (bio_pages == 1 && bv.bv_offset + bv.bv_len <= dev->ctrl.page_size * 2) return nvme_setup_prp_simple(dev, req, &cmnd->rw, &bv); -- 1.8.3.1