Try #3: Use SCSI read/write(16) with > 32-bit LBA drives
PATCH 1/1 Try #3: Use SCSI read/write(16) with > 32-bit LBA drives
From: "Jason J. Herne" <[email protected]>
Force large capacity (> 0xFFFFFFFF blocks) drives to use READ/WRITE(16) instead of READ/WRITE(10). Some(most/all?) USB enclosures do not like READ(10) commands when a large capacity drive is installed. This issue was reported and discussed
here: http://marc.info/?l=linux-usb&m=135247705222324&w=2
--- drivers/scsi/sd.c | 4 +++- include/scsi/scsi_device.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/sd.c +3 -1
@@ -887,7 +887,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) 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 (block >0xffffffff ) { + }else if (sdp->use_16_for_rw) { 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 ;
@@ -2054,6 +2054,8 @@ got_data: } } + sdp->use_16_for_rw = (sdkp->capacity >0xffffffff ); +/* Rescale capacity to 512-byte units */ if (sector_size ==4096 ) sdkp->capacity <<=3 ;
include/scsi/scsi_device.h +1 -0
@@ -135,6 +135,7 @@ struct scsi_device {* because we did a bus reset. */ unsigned use_10_for_rw:1; /* first try 10-byte read / write */ unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */ + unsigned use_16_for_rw:1; /* Use read/write(16) over read/write(10) */ unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */ unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */ unsigned skip_vpd_pages:1; /* do not read VPD pages */
Signature · 1 line
1.7.9.5
Hello.
Quoted 1 line · Jason J. Herne
From: "Jason J. Herne" <[email protected]>
You have already posted Try #3. And preferrably, information about patch
version should be included with [PATCH] prefix like this [PATCH v4].
Quoted 6 lines
Force large capacity (>
0xFFFFFFFFblocks) drives to use READ/WRITE(16) instead of READ/WRITE(10). Some(most/all?) USB enclosures do not like READ(10) commands when a large capacity drive is installed. This issue was reported and discussed
here: http://marc.info/?l=linux-usb&m=135247705222324&w=2Signed-off-by Jason J. Herne <[email protected]>
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 12 lines · Sergei Shtylyov
Hello.
Quoted 1 line · Jason J. Herne
From: "Jason J. Herne" <[email protected]>
You have already posted Try #3. And preferrably, information about patch
version should be included with [PATCH] prefix like this [PATCH v4].
Noted for future submissions. Any idea how I get git send-email to generate the patch tag
like that?
Also, do I need to resubmit this patch because of this semi-faulty subject line? I would
assume that to be unnecessary.
--
- Jason J. Herne ([email protected]) --
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi,
Quoted 14 lines · Jason J. Herne
Quoted 12 lines · Sergei Shtylyov
Hello.
Quoted 1 line · Jason J. Herne
From: "Jason J. Herne" <[email protected]>
You have already posted Try #3. And preferrably, information about patch
version should be included with [PATCH] prefix like this [PATCH v4].
Quoted 7 lines
Noted for future submissions. Any idea how I get git send-email to generate the patch tag
like that?Also, do I need to resubmit this patch because of this semi-faulty subject line? I would
assume that to be unnecessary.
$ git send-email --subject-prefix="PATCH v4" HEAD ^origin/master
if you want to generate the patch file before sending, pass --subject-prefix to git format-patch instead.
Signature · 1 line
balbi
Quoted 6 lines · Jason J. Herne
From: "Jason J. Herne" <[email protected]>
Force large capacity (>
0xFFFFFFFFblocks) drives to use READ/WRITE(16) instead of READ/WRITE(10). Some(most/all?) USB enclosures do not like READ(10) commands when a large capacity drive is installed. This issue was reported and discussed
here: http://marc.info/?l=linux-usb&m=135247705222324&w=2
Is there any reason not to simply use the 16 byte command unconditionally for large devices?
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · Christoph Hellwig
Quoted 6 lines · Jason J. Herne
From: "Jason J. Herne" <[email protected]>
Force large capacity (>
0xFFFFFFFFblocks) drives to use READ/WRITE(16) instead of READ/WRITE(10). Some(most/all?) USB enclosures do not like READ(10) commands when a large capacity drive is installed. This issue was reported and discussed
here: http://marc.info/?l=linux-usb&m=135247705222324&w=2Is there any reason not to simply use the 16 byte command unconditionally for large devices?
What you are suggesting is exactly what this patch is doing. Code was added to sd_read_capacity()
to turn on the new bit if the device has more than 2^32 blocks.
--
- Jason J. Herne ([email protected]) --
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html