summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2014-06-02 22:56:47 +0900
committerChristoph Hellwig <hch@lst.de>2014-07-17 22:07:30 +0200
commite430cbc8bbd779454516467b2947a97b4003c081 (patch)
treee1433727f4e9787323f16e774219135cb0b43b51 /drivers/scsi/sd.c
parent46f69e6a6bbbf3858617c8729e31895846c15a79 (diff)
downloadtalos-obmc-linux-e430cbc8bbd779454516467b2947a97b4003c081.tar.gz
talos-obmc-linux-e430cbc8bbd779454516467b2947a97b4003c081.zip
sd: use READ_16 or WRITE_16 when transfer length is greater than 0xffff
This change makes the scsi disk driver handle the requests whose transfer length is greater than 0xffff with READ_16 or WRITE_16. However, this is a preparation for extending the data type of max_sectors in struct Scsi_Host and scsi_host_template. So, it is impossible to happen this condition for now, because SCSI low-level drivers can not specify max_sectors greater than 0xffff due to the data type limitation. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 6825eda1114a..14ec8f521ae8 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1042,7 +1042,7 @@ static int sd_init_command(struct scsi_cmnd *SCpnt)
SCpnt->cmnd[29] = (unsigned char) (this_count >> 16) & 0xff;
SCpnt->cmnd[30] = (unsigned char) (this_count >> 8) & 0xff;
SCpnt->cmnd[31] = (unsigned char) this_count & 0xff;
- } else if (sdp->use_16_for_rw) {
+ } else if (sdp->use_16_for_rw || (this_count > 0xffff)) {
SCpnt->cmnd[0] += READ_16 - READ_6;
SCpnt->cmnd[1] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0);
SCpnt->cmnd[2] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0;
@@ -1061,9 +1061,6 @@ static int sd_init_command(struct scsi_cmnd *SCpnt)
} else if ((this_count > 0xff) || (block > 0x1fffff) ||
scsi_device_protection(SCpnt->device) ||
SCpnt->device->use_10_for_rw) {
- if (this_count > 0xffff)
- this_count = 0xffff;
-
SCpnt->cmnd[0] += READ_10 - READ_6;
SCpnt->cmnd[1] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0);
SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff;
OpenPOWER on IntegriCloud