Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 796b0b8d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Keith Busch
Browse files

nvmet-loop: use blk_rq_payload_bytes for sgl selection



blk_rq_bytes does the wrong thing for special payloads like discards and
might cause the driver to not set up a SGL.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarKeith Busch <keith.busch@intel.com>
parent 0d309923
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ static blk_status_t nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx,
		return BLK_STS_OK;
	}

	if (blk_rq_bytes(req)) {
	if (blk_rq_payload_bytes(req)) {
		iod->sg_table.sgl = iod->first_sgl;
		if (sg_alloc_table_chained(&iod->sg_table,
				blk_rq_nr_phys_segments(req),
@@ -193,7 +193,7 @@ static blk_status_t nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx,

		iod->req.sg = iod->sg_table.sgl;
		iod->req.sg_cnt = blk_rq_map_sg(req->q, req, iod->sg_table.sgl);
		iod->req.transfer_len = blk_rq_bytes(req);
		iod->req.transfer_len = blk_rq_payload_bytes(req);
	}

	blk_mq_start_request(req);