diff options
author | Christoph Hellwig <hch@lst.de> | 2018-02-22 10:24:10 -0500 |
---|---|---|
committer | Keith Busch <keith.busch@intel.com> | 2018-02-22 03:45:34 -0500 |
commit | 796b0b8d8dea191d9f64e0be8ab58d8f3586bcde (patch) | |
tree | 4b4b613090424bade84d393a61caff75cdd9d938 | |
parent | 0d30992395b1ed0e006960de1651b44cd51be791 (diff) |
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: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
-rw-r--r-- | drivers/nvme/target/loop.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c index 7991ec3a17db..861d1509b22b 100644 --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c | |||
@@ -184,7 +184,7 @@ static blk_status_t nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx, | |||
184 | return BLK_STS_OK; | 184 | return BLK_STS_OK; |
185 | } | 185 | } |
186 | 186 | ||
187 | if (blk_rq_bytes(req)) { | 187 | if (blk_rq_payload_bytes(req)) { |
188 | iod->sg_table.sgl = iod->first_sgl; | 188 | iod->sg_table.sgl = iod->first_sgl; |
189 | if (sg_alloc_table_chained(&iod->sg_table, | 189 | if (sg_alloc_table_chained(&iod->sg_table, |
190 | blk_rq_nr_phys_segments(req), | 190 | blk_rq_nr_phys_segments(req), |
@@ -193,7 +193,7 @@ static blk_status_t nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx, | |||
193 | 193 | ||
194 | iod->req.sg = iod->sg_table.sgl; | 194 | iod->req.sg = iod->sg_table.sgl; |
195 | iod->req.sg_cnt = blk_rq_map_sg(req->q, req, iod->sg_table.sgl); | 195 | iod->req.sg_cnt = blk_rq_map_sg(req->q, req, iod->sg_table.sgl); |
196 | iod->req.transfer_len = blk_rq_bytes(req); | 196 | iod->req.transfer_len = blk_rq_payload_bytes(req); |
197 | } | 197 | } |
198 | 198 | ||
199 | blk_mq_start_request(req); | 199 | blk_mq_start_request(req); |