linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Osterlund <petero2@telia.com>
To: linuxer@ever.mine.nu
Cc: linux-kernel@vger.kernel.org
Subject: Re: pktcdvd DVD+RW always writes at max drive speed (not media speed)
Date: 25 Feb 2006 23:43:22 +0100	[thread overview]
Message-ID: <m3y7zz2h6d.fsf@telia.com> (raw)
In-Reply-To: <200602250112.k1P1CCqm009307@rhodes.mine.nu>

linuxer@ever.mine.nu writes:

>  petero@p4.localdomain writes:
>   > 
>   > linuxer@ever.mine.nu writes:
>   > 
>   > > Peter Osterlund <petero2@telia.com> writes:
>   > >   > 
>   > >   > linuxer@ever.mine.nu writes:
>   > >   > 
>   > >   > > In drivers/block/pktcdvd.c it appears that in the case of DVD
>   > >   > > rewriting, pkt_open_write always sets the write speed to pkt_get_max_speed
>   > >   > > (the maximum writing speed reported by the drive). 
>   > >   > > 
>   > >   > > In my case, I have a new drive capable of 8x re-writing. However, all of
>   > >   > > my existing media is rated for only 4x rewrite speed. 
>   > >   > > 
>   > >   > > When attempting to rw mount these disks, pktcdvd reports:
>   > >   > > 
>   > >   > > Feb 18 00:09:52 ever kernel: pktcdvd: write speed 11080kB/s
>   > >   > > Feb 18 00:09:54 ever kernel: pktcdvd: 54 01 00 00 00 00 00 00 00 00 00 00 -
>   > >   > > sense 00.54.9c (No sense)
>   > >   > > Feb 18 00:09:54 ever kernel: pktcdvd: pktcdvd0 Optimum Power Calibration failed
>   > >   > > 
>   > >   > > And then of course a huge heap of I/O errors on the disk. 
>   > >   > 
>   > >   > Have you verified that this is caused by the speed setting, ie does it
>   > >   > work correctly if you hack the driver to write at 4x speed?
>   > > 
>   > > Correct. Adding a hard-coded manual setting of write_speed = 5540 to
>   > > pkt_open_write results in functional operation (at least with 4x rated
>   > > DVD+RW media).
>   > 
>   > Does this patch work for you?
>   > 
>   > 
>   > pktcdvd: Don't try to write faster than the DVD media speed allows.
>   > 
>   > In theory the drive firmware should limit the speed to the fastest
>   > allowed by the currently loaded media, but it doesn't always work in
>   > practice.
...
> Unfortunately, no. It -should- work, but the extra DPRINTK's tell a further
> story of the drives stupidity.
> 
> Upon running 
>  % pktsetup 0 /dev/hde ; mkudffs /dev/pktcdvd/0'
> I get the following output:
> 
> Feb 24 19:30:31 ever kernel: pktcdvd: inserted media is DVD+RW
> Feb 24 19:30:31 ever kernel: pktcdvd: Max drive write speed 11080kB/s
> Feb 24 19:30:31 ever kernel: pktcdvd: Max. media speed: 5540kB/s
> Feb 24 19:30:31 ever kernel: pktcdvd: write speed 5540kB/s
> Feb 24 19:30:48 ever kernel: pktcdvd: 4590208kB available on disc
> 
> All seems well and good. However, upon then issuing 
>  % mount /dev/pktcdvd/0 /mnt/dvdrw -t auto -o noatime,rw
> 
> Feb 24 19:31:28 ever kernel: pktcdvd: inserted media is DVD+RW
> Feb 24 19:31:28 ever kernel: pktcdvd: Max drive write speed 11080kB/s
> Feb 24 19:31:28 ever kernel: pktcdvd: Max. media speed: 11080kB/s
> Feb 24 19:31:28 ever kernel: pktcdvd: write speed 11080kB/s
> Feb 24 19:31:30 ever kernel: pktcdvd: 54 01 00 00 00 00 00 00 00 00 00 00 - sense 00.54.1c (No sense)
> Feb 24 19:31:30 ever kernel: pktcdvd: pktcdvd0 Optimum Power Calibration failed
> Feb 24 19:31:30 ever kernel: pktcdvd: 4590208kB available on disc
> Feb 24 19:31:31 ever kernel: UDF-fs INFO UDF 0.9.8.1 (2004/29/09) Mounting volume 'LinuxUDF', timestamp 2006/02/24 18:30 (1ed4)
> Feb 24 19:31:40 ever kernel: hde: media error (bad sector): status=0x51 { DriveReady SeekComplete Error }
> Feb 24 19:31:40 ever kernel: hde: media error (bad sector): error=0x34 { AbortedCommand LastFailedSense=0x03 }
> Feb 24 19:31:40 ever kernel: ide: failed opcode was: unknown
> Feb 24 19:31:40 ever kernel: end_request: I/O error, dev hde, sector 1088
> Feb 24 19:31:40 ever kernel: hde: command error: status=0x51 { DriveReady SeekComplete Error }
> Feb 24 19:31:40 ever kernel: hde: command error: error=0x54 { AbortedCommand LastFailedSense=0x05 }
> .
> . (and so on)
> 
> I'm somewhat confused as to what could be happening here, but my first
> guess is that after being spun up to high speed for reading in
> pkt_iosched_process_queue, the firmware promptly forgets whatever it knew
> about the media speed. Perhaps it only stores a single speed value
> internally, so calling pkt_set_speed (pd, pd->write_speed, pd->read_speed)
> with a larger value of read_speed sets them both. And afterwards the drive
> reports this as the maximum media speed on future opens?

You could test that theory with a hack like this:

diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 94ff3ac..a0d6687 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -461,6 +461,8 @@ static int pkt_set_speed(struct pktcdvd_
 	struct request_sense sense;
 	int ret;
 
+	read_speed = write_speed;
+
 	init_cdrom_command(&cgc, NULL, 0, CGC_DATA_NONE);
 	cgc.sense = &sense;
 	cgc.cmd[0] = GPCMD_SET_SPEED;
@@ -2028,7 +2030,9 @@ static void pkt_release_dev(struct pktcd
 
 	pkt_lock_door(pd, 0);
 
+#if 0
 	pkt_set_speed(pd, MAX_SPEED, MAX_SPEED);
+#endif
 	bd_release(pd->bdev);
 	blkdev_put(pd->bdev);
 

> If you are curious as to who would curse the market with such a
> buggy product, the drive is a BenQ Q60.

Maybe there is a firmware upgrade available?

-- 
Peter Osterlund - petero2@telia.com
http://web.telia.com/~u89404340

  reply	other threads:[~2006-02-25 22:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-18 20:23 pktcdvd DVD+RW always writes at max drive speed (not media speed) linuxer
2006-02-18 22:19 ` Peter Osterlund
2006-02-18 23:35   ` linuxer
2006-02-19 10:09     ` Peter Osterlund
2006-02-22 22:28     ` Peter Osterlund
2006-02-25  1:12       ` linuxer
2006-02-25 22:43         ` Peter Osterlund [this message]
2006-02-19  6:11 ` Phillip Susi
2006-02-19  6:46   ` linuxer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3y7zz2h6d.fsf@telia.com \
    --to=petero2@telia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxer@ever.mine.nu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).