Skip to content

Commit b21ffd2

Browse files
Baolin Wangcasparant
authored andcommitted
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: Baolin Wang <baolin.wang@linux.alibaba.com> Acked-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com> Reviewed-by: Jiufei Xue <jiufei.xue@linux.alibaba.com>
1 parent ffae4b1 commit b21ffd2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/nvme/host/pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ static blk_status_t nvme_setup_sgl_simple(struct nvme_dev *dev,
830830
struct bio_vec *bv)
831831
{
832832
struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
833-
unsigned int length = blk_rq_bytes(req);
833+
unsigned int length = blk_rq_payload_bytes(req);
834834

835835
iod->first_dma = dma_map_page(dev->dev, bv->bv_page, bv->bv_offset,
836836
length, rq_dma_dir(req));

0 commit comments

Comments
 (0)