Skip to content

Commit 1bd293f

Browse files
Kundan Kumarkeithbusch
authored andcommitted
nvme: adjust multiples of NVME_CTRL_PAGE_SIZE in offset
bio_vec start offset may be relatively large particularly when large folio gets added to the bio. A bigger offset will result in avoiding the single-segment mapping optimization and end up using expensive mempool_alloc further. Rather than using absolute value, adjust bv_offset by NVME_CTRL_PAGE_SIZE while checking if segment can be fitted into one/two PRP entries. Suggested-by: Christoph Hellwig <[email protected]> Signed-off-by: Kundan Kumar <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 64e3d02 commit 1bd293f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/nvme/host/pci.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,8 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,
778778
struct bio_vec bv = req_bvec(req);
779779

780780
if (!is_pci_p2pdma_page(bv.bv_page)) {
781-
if (bv.bv_offset + bv.bv_len <= NVME_CTRL_PAGE_SIZE * 2)
781+
if ((bv.bv_offset & (NVME_CTRL_PAGE_SIZE - 1)) +
782+
bv.bv_len <= NVME_CTRL_PAGE_SIZE * 2)
782783
return nvme_setup_prp_simple(dev, req,
783784
&cmnd->rw, &bv);
784785

0 commit comments

Comments
 (0)