diff options
author | FUJITA Tomonori <tomof@acm.org> | 2008-02-19 04:41:30 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-04-07 13:15:36 -0400 |
commit | 7e23ea488488400127a2da19c0d89f1723117504 (patch) | |
tree | 7af7e6ec222b8bd1c1f01555a23e7af6a8a7a95e | |
parent | cff2680643f9288a1cd4e27c241e1da51f476d66 (diff) |
[SCSI] ips: sg chaining support to the path to non I/O commands
I overlooked ips_scmd_buf_write and ips_scmd_buf_read when I converted
ips to use the data buffer accessors.
ips is unlikely to use sg chaining (especially in this path) since a)
this path is used only for non I/O commands (with little data
transfer), b) ips's sg_tablesize is set to just 17.
Thanks to Tim Pepper for testing this patch.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Mark Salyzyn <Mark_Salyzyn@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r-- | drivers/scsi/ips.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 7ed568f180ae..e5467a4c225b 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c | |||
@@ -3510,15 +3510,16 @@ ips_scmd_buf_write(struct scsi_cmnd *scmd, void *data, unsigned int count) | |||
3510 | struct scatterlist *sg = scsi_sglist(scmd); | 3510 | struct scatterlist *sg = scsi_sglist(scmd); |
3511 | 3511 | ||
3512 | for (i = 0, xfer_cnt = 0; | 3512 | for (i = 0, xfer_cnt = 0; |
3513 | (i < scsi_sg_count(scmd)) && (xfer_cnt < count); i++) { | 3513 | (i < scsi_sg_count(scmd)) && (xfer_cnt < count); |
3514 | min_cnt = min(count - xfer_cnt, sg[i].length); | 3514 | i++, sg = sg_next(sg)) { |
3515 | min_cnt = min(count - xfer_cnt, sg->length); | ||
3515 | 3516 | ||
3516 | /* kmap_atomic() ensures addressability of the data buffer.*/ | 3517 | /* kmap_atomic() ensures addressability of the data buffer.*/ |
3517 | /* local_irq_save() protects the KM_IRQ0 address slot. */ | 3518 | /* local_irq_save() protects the KM_IRQ0 address slot. */ |
3518 | local_irq_save(flags); | 3519 | local_irq_save(flags); |
3519 | buffer = kmap_atomic(sg_page(&sg[i]), KM_IRQ0) + sg[i].offset; | 3520 | buffer = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; |
3520 | memcpy(buffer, &cdata[xfer_cnt], min_cnt); | 3521 | memcpy(buffer, &cdata[xfer_cnt], min_cnt); |
3521 | kunmap_atomic(buffer - sg[i].offset, KM_IRQ0); | 3522 | kunmap_atomic(buffer - sg->offset, KM_IRQ0); |
3522 | local_irq_restore(flags); | 3523 | local_irq_restore(flags); |
3523 | 3524 | ||
3524 | xfer_cnt += min_cnt; | 3525 | xfer_cnt += min_cnt; |
@@ -3543,15 +3544,16 @@ ips_scmd_buf_read(struct scsi_cmnd *scmd, void *data, unsigned int count) | |||
3543 | struct scatterlist *sg = scsi_sglist(scmd); | 3544 | struct scatterlist *sg = scsi_sglist(scmd); |
3544 | 3545 | ||
3545 | for (i = 0, xfer_cnt = 0; | 3546 | for (i = 0, xfer_cnt = 0; |
3546 | (i < scsi_sg_count(scmd)) && (xfer_cnt < count); i++) { | 3547 | (i < scsi_sg_count(scmd)) && (xfer_cnt < count); |
3547 | min_cnt = min(count - xfer_cnt, sg[i].length); | 3548 | i++, sg = sg_next(sg)) { |
3549 | min_cnt = min(count - xfer_cnt, sg->length); | ||
3548 | 3550 | ||
3549 | /* kmap_atomic() ensures addressability of the data buffer.*/ | 3551 | /* kmap_atomic() ensures addressability of the data buffer.*/ |
3550 | /* local_irq_save() protects the KM_IRQ0 address slot. */ | 3552 | /* local_irq_save() protects the KM_IRQ0 address slot. */ |
3551 | local_irq_save(flags); | 3553 | local_irq_save(flags); |
3552 | buffer = kmap_atomic(sg_page(&sg[i]), KM_IRQ0) + sg[i].offset; | 3554 | buffer = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; |
3553 | memcpy(&cdata[xfer_cnt], buffer, min_cnt); | 3555 | memcpy(&cdata[xfer_cnt], buffer, min_cnt); |
3554 | kunmap_atomic(buffer - sg[i].offset, KM_IRQ0); | 3556 | kunmap_atomic(buffer - sg->offset, KM_IRQ0); |
3555 | local_irq_restore(flags); | 3557 | local_irq_restore(flags); |
3556 | 3558 | ||
3557 | xfer_cnt += min_cnt; | 3559 | xfer_cnt += min_cnt; |