diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/ibmvscsi/ibmvstgt.c | 2 | ||||
-rw-r--r-- | drivers/scsi/libsrp.c | 23 | ||||
-rw-r--r-- | drivers/scsi/scsi_tgt_if.c | 2 | ||||
-rw-r--r-- | drivers/scsi/scsi_tgt_lib.c | 11 |
4 files changed, 20 insertions, 18 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c index 82bcab688b44..d63f11e95abf 100644 --- a/drivers/scsi/ibmvscsi/ibmvstgt.c +++ b/drivers/scsi/ibmvscsi/ibmvstgt.c | |||
@@ -292,7 +292,7 @@ static int ibmvstgt_cmd_done(struct scsi_cmnd *sc, | |||
292 | dprintk("%p %p %x %u\n", iue, target, vio_iu(iue)->srp.cmd.cdb[0], | 292 | dprintk("%p %p %x %u\n", iue, target, vio_iu(iue)->srp.cmd.cdb[0], |
293 | cmd->usg_sg); | 293 | cmd->usg_sg); |
294 | 294 | ||
295 | if (sc->use_sg) | 295 | if (scsi_sg_count(sc)) |
296 | err = srp_transfer_data(sc, &vio_iu(iue)->srp.cmd, ibmvstgt_rdma, 1, 1); | 296 | err = srp_transfer_data(sc, &vio_iu(iue)->srp.cmd, ibmvstgt_rdma, 1, 1); |
297 | 297 | ||
298 | spin_lock_irqsave(&target->lock, flags); | 298 | spin_lock_irqsave(&target->lock, flags); |
diff --git a/drivers/scsi/libsrp.c b/drivers/scsi/libsrp.c index 2ad0a27dbaab..5cff0204227d 100644 --- a/drivers/scsi/libsrp.c +++ b/drivers/scsi/libsrp.c | |||
@@ -192,18 +192,18 @@ static int srp_direct_data(struct scsi_cmnd *sc, struct srp_direct_buf *md, | |||
192 | 192 | ||
193 | if (dma_map) { | 193 | if (dma_map) { |
194 | iue = (struct iu_entry *) sc->SCp.ptr; | 194 | iue = (struct iu_entry *) sc->SCp.ptr; |
195 | sg = sc->request_buffer; | 195 | sg = scsi_sglist(sc); |
196 | 196 | ||
197 | dprintk("%p %u %u %d\n", iue, sc->request_bufflen, | 197 | dprintk("%p %u %u %d\n", iue, scsi_bufflen(sc), |
198 | md->len, sc->use_sg); | 198 | md->len, scsi_sg_count(sc)); |
199 | 199 | ||
200 | nsg = dma_map_sg(iue->target->dev, sg, sc->use_sg, | 200 | nsg = dma_map_sg(iue->target->dev, sg, scsi_sg_count(sc), |
201 | DMA_BIDIRECTIONAL); | 201 | DMA_BIDIRECTIONAL); |
202 | if (!nsg) { | 202 | if (!nsg) { |
203 | printk("fail to map %p %d\n", iue, sc->use_sg); | 203 | printk("fail to map %p %d\n", iue, scsi_sg_count(sc)); |
204 | return 0; | 204 | return 0; |
205 | } | 205 | } |
206 | len = min(sc->request_bufflen, md->len); | 206 | len = min(scsi_bufflen(sc), md->len); |
207 | } else | 207 | } else |
208 | len = md->len; | 208 | len = md->len; |
209 | 209 | ||
@@ -229,10 +229,10 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd, | |||
229 | 229 | ||
230 | if (dma_map || ext_desc) { | 230 | if (dma_map || ext_desc) { |
231 | iue = (struct iu_entry *) sc->SCp.ptr; | 231 | iue = (struct iu_entry *) sc->SCp.ptr; |
232 | sg = sc->request_buffer; | 232 | sg = scsi_sglist(sc); |
233 | 233 | ||
234 | dprintk("%p %u %u %d %d\n", | 234 | dprintk("%p %u %u %d %d\n", |
235 | iue, sc->request_bufflen, id->len, | 235 | iue, scsi_bufflen(sc), id->len, |
236 | cmd->data_in_desc_cnt, cmd->data_out_desc_cnt); | 236 | cmd->data_in_desc_cnt, cmd->data_out_desc_cnt); |
237 | } | 237 | } |
238 | 238 | ||
@@ -268,13 +268,14 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd, | |||
268 | 268 | ||
269 | rdma: | 269 | rdma: |
270 | if (dma_map) { | 270 | if (dma_map) { |
271 | nsg = dma_map_sg(iue->target->dev, sg, sc->use_sg, DMA_BIDIRECTIONAL); | 271 | nsg = dma_map_sg(iue->target->dev, sg, scsi_sg_count(sc), |
272 | DMA_BIDIRECTIONAL); | ||
272 | if (!nsg) { | 273 | if (!nsg) { |
273 | eprintk("fail to map %p %d\n", iue, sc->use_sg); | 274 | eprintk("fail to map %p %d\n", iue, scsi_sg_count(sc)); |
274 | err = -EIO; | 275 | err = -EIO; |
275 | goto free_mem; | 276 | goto free_mem; |
276 | } | 277 | } |
277 | len = min(sc->request_bufflen, id->len); | 278 | len = min(scsi_bufflen(sc), id->len); |
278 | } else | 279 | } else |
279 | len = id->len; | 280 | len = id->len; |
280 | 281 | ||
diff --git a/drivers/scsi/scsi_tgt_if.c b/drivers/scsi/scsi_tgt_if.c index 9815a1a2db24..d2557dbc2dc1 100644 --- a/drivers/scsi/scsi_tgt_if.c +++ b/drivers/scsi/scsi_tgt_if.c | |||
@@ -112,7 +112,7 @@ int scsi_tgt_uspace_send_cmd(struct scsi_cmnd *cmd, u64 itn_id, | |||
112 | memset(&ev, 0, sizeof(ev)); | 112 | memset(&ev, 0, sizeof(ev)); |
113 | ev.p.cmd_req.host_no = shost->host_no; | 113 | ev.p.cmd_req.host_no = shost->host_no; |
114 | ev.p.cmd_req.itn_id = itn_id; | 114 | ev.p.cmd_req.itn_id = itn_id; |
115 | ev.p.cmd_req.data_len = cmd->request_bufflen; | 115 | ev.p.cmd_req.data_len = scsi_bufflen(cmd); |
116 | memcpy(ev.p.cmd_req.scb, cmd->cmnd, sizeof(ev.p.cmd_req.scb)); | 116 | memcpy(ev.p.cmd_req.scb, cmd->cmnd, sizeof(ev.p.cmd_req.scb)); |
117 | memcpy(ev.p.cmd_req.lun, lun, sizeof(ev.p.cmd_req.lun)); | 117 | memcpy(ev.p.cmd_req.lun, lun, sizeof(ev.p.cmd_req.lun)); |
118 | ev.p.cmd_req.attribute = cmd->tag; | 118 | ev.p.cmd_req.attribute = cmd->tag; |
diff --git a/drivers/scsi/scsi_tgt_lib.c b/drivers/scsi/scsi_tgt_lib.c index a91761c3645f..deea3cd5bf49 100644 --- a/drivers/scsi/scsi_tgt_lib.c +++ b/drivers/scsi/scsi_tgt_lib.c | |||
@@ -331,7 +331,7 @@ static void scsi_tgt_cmd_done(struct scsi_cmnd *cmd) | |||
331 | 331 | ||
332 | scsi_tgt_uspace_send_status(cmd, tcmd->itn_id, tcmd->tag); | 332 | scsi_tgt_uspace_send_status(cmd, tcmd->itn_id, tcmd->tag); |
333 | 333 | ||
334 | if (cmd->request_buffer) | 334 | if (scsi_sglist(cmd)) |
335 | scsi_free_sgtable(cmd); | 335 | scsi_free_sgtable(cmd); |
336 | 336 | ||
337 | queue_work(scsi_tgtd, &tcmd->work); | 337 | queue_work(scsi_tgtd, &tcmd->work); |
@@ -365,14 +365,15 @@ static int scsi_tgt_init_cmd(struct scsi_cmnd *cmd, gfp_t gfp_mask) | |||
365 | 365 | ||
366 | cmd->request_bufflen = rq->data_len; | 366 | cmd->request_bufflen = rq->data_len; |
367 | 367 | ||
368 | dprintk("cmd %p cnt %d %lu\n", cmd, cmd->use_sg, rq_data_dir(rq)); | 368 | dprintk("cmd %p cnt %d %lu\n", cmd, scsi_sg_count(cmd), |
369 | count = blk_rq_map_sg(rq->q, rq, cmd->request_buffer); | 369 | rq_data_dir(rq)); |
370 | if (likely(count <= cmd->use_sg)) { | 370 | count = blk_rq_map_sg(rq->q, rq, scsi_sglist(cmd)); |
371 | if (likely(count <= scsi_sg_count(cmd))) { | ||
371 | cmd->use_sg = count; | 372 | cmd->use_sg = count; |
372 | return 0; | 373 | return 0; |
373 | } | 374 | } |
374 | 375 | ||
375 | eprintk("cmd %p cnt %d\n", cmd, cmd->use_sg); | 376 | eprintk("cmd %p cnt %d\n", cmd, scsi_sg_count(cmd)); |
376 | scsi_free_sgtable(cmd); | 377 | scsi_free_sgtable(cmd); |
377 | return -EINVAL; | 378 | return -EINVAL; |
378 | } | 379 | } |