Re: 2.6.0-mm1

From: Jens Axboe
Date: Tue Dec 23 2003 - 11:56:45 EST


On Tue, Dec 23 2003, Jens Axboe wrote:
> On Tue, Dec 23 2003, Pascal Schmidt wrote:
> >
> > On Tue, 23 Dec 2003 06:20:14 +0100, you wrote in linux.kernel:
> >
> > >> +atapi-mo-support.patch
> > >>
> > >> Fix support for ATAPI MO drives (needs updating to reflect the changes
> > >> in mt-ranier-support.patch).
> > > Since the atapi-mo patch is mine, is there something I need to do?
> >
> > I figured it out. ;) This small additional patch on top of mm1 is
> > needed to get MO write support to work.
> >
> >
> > --- linux-2.6.0-mm1/drivers/cdrom/cdrom.c Tue Dec 23 17:26:27 2003
> > +++ linux-2.6.0-mm1-mo/drivers/cdrom/cdrom.c Tue Dec 23 17:11:50 2003
> > @@ -708,6 +708,8 @@ static int cdrom_open_write(struct cdrom
> > ret = cdrom_mrw_open_write(cdi);
> > else if (CDROM_CAN(CDC_DVD_RAM))
> > ret = cdrom_dvdram_open_write(cdi);
> > + else if (CDROM_CAN(CDC_MO_DRIVE))
> > + ret = 0;
>
> Still needs cleanups, as mentioned in the other mail. Let me dig out
> the laptop and fix it up for posting.

A general update patch against 2.6.0-mm1, Andrew can you apply this
for now? Looks like there was a merge error with cdi->use_count as well
in mm1.

Pascal, if you could take care of the mode sense check for RO media (see
comment) that would be perfect.

diff -urp linux-2.6.0-mm1.virgin/drivers/cdrom/cdrom.c linux-2.6.0-mm1/drivers/cdrom/cdrom.c
--- linux-2.6.0-mm1.virgin/drivers/cdrom/cdrom.c 2003-12-23 17:44:54.000000000 +0100
+++ linux-2.6.0-mm1/drivers/cdrom/cdrom.c 2003-12-23 17:50:56.320349076 +0100
@@ -708,6 +708,11 @@ static int cdrom_open_write(struct cdrom
ret = cdrom_mrw_open_write(cdi);
else if (CDROM_CAN(CDC_DVD_RAM))
ret = cdrom_dvdram_open_write(cdi);
+ /*
+ * needs to really check whether media is writeable
+ */
+ else if (CDROM_CAN(CDC_MO_DRIVE))
+ ret = 0;

return ret;
}
@@ -737,7 +742,7 @@ int cdrom_open(struct cdrom_device_info
cdi->use_count++;
ret = -EROFS;
if (fp->f_mode & FMODE_WRITE) {
- if (!(CDROM_CAN(CDC_RAM) || CDROM_CAN(CDC_MO_DRIVE)))
+ if (!CDROM_CAN(CDC_RAM))
goto out;
if (cdrom_open_write(cdi))
goto out;
@@ -750,8 +755,6 @@ int cdrom_open(struct cdrom_device_info
else
ret = open_for_data(cdi);

- if (!ret) cdi->use_count++;
-
cdinfo(CD_OPEN, "Use count for \"/dev/%s\" now %d\n", cdi->name, cdi->use_count);
/* Do this on open. Don't wait for mount, because they might
not be mounting, but opening with O_NONBLOCK */
diff -urp linux-2.6.0-mm1.virgin/drivers/ide/ide-cd.c linux-2.6.0-mm1/drivers/ide/ide-cd.c
--- linux-2.6.0-mm1.virgin/drivers/ide/ide-cd.c 2003-12-23 17:44:54.000000000 +0100
+++ linux-2.6.0-mm1/drivers/ide/ide-cd.c 2003-12-23 17:49:12.404670677 +0100
@@ -790,8 +790,8 @@ static int cdrom_decode_status(ide_drive
* devices will return this error while flushing
* data from cache */
if (!rq->errors)
- info->write_timeout = jiffies + ATAPI_WAIT_BUSY;
- rq->errors = 1;
+ info->write_timeout = jiffies + ATAPI_WAIT_WRITE_BUSY;
+ ++rq->errors;
if (time_after(jiffies, info->write_timeout))
do_end_request = 1;
else {
@@ -2950,6 +2950,7 @@ int ide_cdrom_probe_capabilities (ide_dr

if (drive->media == ide_optical) {
CDROM_CONFIG_FLAGS(drive)->mo_drive = 1;
+ CDROM_CONFIG_FLAGS(drive)->ram = 1;
printk("%s: ATAPI magneto-optical drive\n", drive->name);
return nslots;
}
@@ -3281,9 +3282,7 @@ int ide_cdrom_setup (ide_drive_t *drive)
/*
* set correct block size and read-only for non-ram media
*/
- set_disk_ro(drive->disk,
- !(CDROM_CONFIG_FLAGS(drive)->ram ||
- CDROM_CONFIG_FLAGS(drive)->mo_drive));
+ set_disk_ro(drive->disk, !CDROM_CONFIG_FLAGS(drive)->ram);
blk_queue_hardsect_size(drive->queue, CD_FRAMESIZE);

#if 0
diff -urp linux-2.6.0-mm1.virgin/drivers/ide/ide-cd.h linux-2.6.0-mm1/drivers/ide/ide-cd.h
--- linux-2.6.0-mm1.virgin/drivers/ide/ide-cd.h 2003-12-23 17:44:54.000000000 +0100
+++ linux-2.6.0-mm1/drivers/ide/ide-cd.h 2003-12-23 17:48:19.939386898 +0100
@@ -39,7 +39,7 @@
* typical timeout for packet command
*/
#define ATAPI_WAIT_PC (60 * HZ)
-#define ATAPI_WAIT_BUSY (5 * HZ)
+#define ATAPI_WAIT_WRITE_BUSY (10 * HZ)

/************************************************************************/


--
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/