提交 add0d5e4 编写于 作者: B Baolin Wang 提交者: Caspar Zhang

alinux: nvme-pci: Improve mapping single segment requests using SGLs

fix #29327388

Now the blk-mq did not support multi-page bvec, which means each bvec
can only contain one page. Though the physical segment is 1 in one bio,
the bio still can contains multiple bvecs which are physically contiguous,
so we can not use one bvec length to map the request, instead we should
use the full length of the request to mapping the request, when the
physical segment is 1 in a request.

In future if we support multi-page bvecs, this patch can be dropped.
Signed-off-by: NBaolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
上级 79a76a7b
......@@ -830,11 +830,13 @@ static blk_status_t nvme_setup_sgl_simple(struct nvme_dev *dev,
struct bio_vec *bv)
{
struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
unsigned int length = blk_rq_bytes(req);
iod->first_dma = dma_map_bvec(dev->dev, bv, rq_dma_dir(req), 0);
iod->first_dma = dma_map_page(dev->dev, bv->bv_page, bv->bv_offset,
length, rq_dma_dir(req));
if (dma_mapping_error(dev->dev, iod->first_dma))
return BLK_STS_RESOURCE;
iod->dma_len = bv->bv_len;
iod->dma_len = length;
cmnd->flags = NVME_CMD_SGL_METABUF;
cmnd->dptr.sgl.addr = cpu_to_le64(iod->first_dma);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册