Skip to contentSkip to conversation

Allow random write for PDT 5 profile 2 Removable Disk

PATCH Jens Axboe 1 participant 1 message Feb 12, 2004 1 message not in the archive SCSI

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Jens Axboe

author
#1 lore raw
Quoted 25 lines · John McKell

Jens,

I see linux-2.6.2 extends the list of writable PDT x05 DVD/CD devices to include MRW, not just DVD-RAM and MO.

With that change in place, this small further patch allows write through to PDT 0x05 DVD/CD for profile x0002 Removable Disk:

a) if feature x0020 "Random Writable" present (no matter if current or not) at plug-in time, and...

b) if feature x0024 "Hardware Defect Management" present (no matter if current or not) at plug-in time, and...

c) if both features "current" at /dev/* open time (e.g., mount time), and ...

d) the device in question is not any of MRW, MRW_W, DVD_RAM, CD_R, CD_RW, DVD, DVD_R

Since 1999 MMC-2, MMC says these tests in combination say this device writes at random like DVD-RAM: no load balancing (aka wear leveling) required and blocks of the size the x0020 feature reports (64 KiB if like CD, 32 KiB if like DVD).

Quoted 8 lines

This composite version of this patch includes the already posted patch:

Subject:[PATCH] DVD-R capability flag set incorrectly, /proc
formatting fix
http://marc.theaimsgroup.com/?l=linux-scsi&m=107637086904512&w=2

Please let me know if you'd rather have an incremental patch.

I need an incremental patch, your previous one is already included in mainline BK tree.

A few small comments, only nitpicks (as the general patch looks fine). Since you need to rediff it anyways, can you fix these up? Then it can be submitted. Thanks!

include/linux/cdrom.h struct request_sense { · line 726

Quoted 10 lines
include/linux/cdrom.h +3 -1
@@ -721,7 +721,9 @@ struct request_sense {
 /*
  * feature profile
  */
-#define CDF_MRW		0x28
+#define CDF_RWRT	0x0020
+#define CDF_HWDM	0x0024
+#define CDF_MRW		0x0028

Tabs

include/linux/cdrom.h struct request_sense {

Quoted 5 lines
include/linux/cdrom.h +5 -0
+	if (!cdrom_is_random_writable(cdi, &ram_write)) {
+		if (ram_write) {
+			CDROM_CONFIG_FLAGS(drive)->ram = 1;
+		}
+	}

Brace styling

Quoted 15 lines
include/linux/cdrom.h +0 -0
 	if (cap.lock == 0)
 		CDROM_CONFIG_FLAGS(drive)->no_doorlock = 1;
 	if (cap.eject)
drivers/scsi/sr.c +1 -1
@@ -693,7 +693,7 @@ Enomem:
 static void get_capabilities(struct scsi_cd *cd)
 {
 	unsigned char *buffer;
-	int rc, n, mrw_write = 0, mrw = 1;
+	int rc, n, mrw_write = 0, mrw = 1,ram_write=0;
 	struct scsi_mode_data data;
 	struct scsi_request *SRpnt;
 	unsigned char cmd[MAX_COMMAND_SIZE];

drivers/scsi/sr.c static void get_capabilities(struct scsi · line 782

Quoted 8 lines
drivers/scsi/sr.c +5 -0
@@ -775,6 +775,12 @@ static void get_capabilities(struct scsi
 	if (!mrw_write)
 		cd->cdi.mask |= CDC_MRW_W;
 
+	if (cdrom_is_random_writable(&cd->cdi, &ram_write)) {
+		cd->cdi.mask |= CDC_RAM;
+	}
+	if (!ram_write)
+		cd->cdi.mask |= CDC_RAM;

Brace styling again

drivers/cdrom/cdrom.c static int cdrom_mrw_set_lba_space(struc · line 645

Quoted 8 lines
drivers/cdrom/cdrom.c +2 -0
@@ -641,6 +641,80 @@ static int cdrom_mrw_set_lba_space(struc
 	return 0;
 }
 
+int cdrom_get_random_writable(struct cdrom_device_info *cdi, 
+			      struct rwrt_feature_desc *rfd)

Little detail - but you have several lines with extra white space at the end. You can probably make your editor high light these for you.

Signature · 1 line
Jens Axboe