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

alinux: nvme: pci: Fix the incorrect ways to calculate the request size

fix #29375191

For NVMe discard request, it will use special_vec to describe the size
of the request, thus it will get an incorrect request size with
blk_rq_bytes() when handling the NVMe discard request.

Thus we should use blk_rq_payload_bytes() to calculate the data transfer
size which can fix this issue.

Fixes: 220741e8c12d ("alios: nvme-pci: Improve mapping single segment requests using SGLs")
Signed-off-by: NBaolin Wang <baolin.wang@linux.alibaba.com>
Acked-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Reviewed-by: NJiufei Xue <jiufei.xue@linux.alibaba.com>
上级 ffae4b1d
......@@ -830,7 +830,7 @@ 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);
unsigned int length = blk_rq_payload_bytes(req);
iod->first_dma = dma_map_page(dev->dev, bv->bv_page, bv->bv_offset,
length, rq_dma_dir(req));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册