Skip to content

Commit 34e0819

Browse files
ChaitanayaKulkarniChristoph Hellwig
authored andcommitted
nvme-rdma: use nr_phys_segments when map rq to sgl
Use blk_rq_nr_phys_segments() instead of blk_rq_payload_bytes() to check if a command contains data to be mapped. This fixes the case where a struct request contains LBAs, but it has no payload, such as Write Zeroes support. Fixes: 6e02318 ("nvme: add support for the Write Zeroes command") Reported-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Tested-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 77141dc commit 34e0819

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/nvme/host/rdma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ static void nvme_rdma_unmap_data(struct nvme_rdma_queue *queue,
11421142
struct nvme_rdma_device *dev = queue->device;
11431143
struct ib_device *ibdev = dev->dev;
11441144

1145-
if (!blk_rq_payload_bytes(rq))
1145+
if (!blk_rq_nr_phys_segments(rq))
11461146
return;
11471147

11481148
if (req->mr) {
@@ -1265,7 +1265,7 @@ static int nvme_rdma_map_data(struct nvme_rdma_queue *queue,
12651265

12661266
c->common.flags |= NVME_CMD_SGL_METABUF;
12671267

1268-
if (!blk_rq_payload_bytes(rq))
1268+
if (!blk_rq_nr_phys_segments(rq))
12691269
return nvme_rdma_set_sg_null(c);
12701270

12711271
req->sg_table.sgl = req->first_sgl;

0 commit comments

Comments
 (0)