[7605] in linux-scsi channel archive
ten byte writes/reads
daemon@ATHENA.MIT.EDU (Jens Axboe)
Thu Dec 2 15:00:03 1999
Date: Thu, 2 Dec 1999 20:52:34 +0000
From: Jens Axboe <axboe@image.dk>
To: linux-scsi@vger.rutgers.edu
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Message-ID: <19991202205234.A693@image.dk>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="6TrnltStXW4iwmi0"
--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=us-ascii
Hi,
After having battled with a DVD-RAM that does not (properly
at least) support WRITE_6 for some time, I started looking at
the 10/6 byte command logic in sd. It is not clear what the
intended effect of the 'ten' flag is.
sd_init_onedisk() unconditionally sets the 'ten' flag and
requests are queued as READ_10/WRITE_10 if it is set _and_
we want to transfer more than 256 blocks or go beyond
a block size that fits in the _6 variants.
The overhead of using a 10 byte command data block versus
the 6 byte equivalent is not worth worrying about IMHO.
Therefore I propose the following change to be made:
Always use WRITE_10/READ_10 when the 'ten' flag is set.
For devices that do not support it, the behaviour will
be to reverse to WRITE_6/READ_6 upon the first failed
read/write. An alternative solution would be to probe
the device in sd_init_onedisk() and set the flag conditionally.
Attached patch is against 2.2.14-pre9.
--
* Jens Axboe <axboe@image.dk>
* Linux CD-ROM Maintainer
* http://www.kernel.dk
--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="sd_ten.diff"
--- linux-2.2.14-pre9/drivers/scsi/sd.c Wed Dec 1 22:02:17 1999
+++ linux/drivers/scsi/sd.c Thu Dec 2 20:32:19 1999
@@ -483,13 +483,17 @@
* would be a ten byte read where only a six byte read was supported.
* Also, on a system where READ CAPACITY failed, we have have read
* past the end of the disk.
+ *
+ * Don't screw with the ten byte flag unless we are certain that
+ * the drive does not understand the command /axboe
*/
if (SCpnt->sense_buffer[2] == ILLEGAL_REQUEST) {
- if (rscsi_disks[DEVICE_NR(SCpnt->request.rq_dev)].ten) {
+ if (rscsi_disks[DEVICE_NR(SCpnt->request.rq_dev)].ten &&
+ SCpnt->sense_buffer[12] == 0x20) {
rscsi_disks[DEVICE_NR(SCpnt->request.rq_dev)].ten = 0;
- requeue_sd_request(SCpnt);
- result = 0;
+ requeue_sd_request(SCpnt);
+ result = 0;
} else {
/* ???? */
}
@@ -1016,7 +1020,7 @@
this_count = this_count << 1;
}
- if (((this_count > 0xff) || (block > 0x1fffff)) && rscsi_disks[dev].ten)
+ if (((this_count > 0xff) || (block > 0x1fffff)) || rscsi_disks[dev].ten)
{
if (this_count > 0xffff)
this_count = 0xffff;
--6TrnltStXW4iwmi0--
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu