public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Polyakov <appro@fy.chalmers.se>
To: linux-kernel@vger.kernel.org
Cc: Jens Axboe <axboe@suse.de>
Subject: Re: 2.5.69-70 ide-cd to guarantee fault-free CD/DVD burning experience?
Date: Thu, 05 Jun 2003 23:05:01 +0200	[thread overview]
Message-ID: <3EDFB07D.75892CC8@fy.chalmers.se> (raw)
In-Reply-To: 20030604195546.GB477@suse.de

> > > ... accept ... patch which makes it possible to access the
> > > sense data returned by IDE CD/DVD units from user-land with SG_IO ioctl.
> >
> > ... [another] problem discussed here is not specific to DVD-RW
> > recordings. It's generic bug/deficiency. Once a packet commands is
> > terminated with an error condition the whole bio should be purged at
> > once and not only the first chunk as it's currently implemented.
> 
> The *sector* values don't really work well for REQ_BLOCK_PC, ...
> ... a nicer one is probably to make cdrom_end_request return
> ide_end_request ret value, and simply make the error locations kill the
> requests... It's not very nice, but should work.

Well, if *sectors has no meaning in this context, then there is hadrly
a reason to call ide_end_request either... So I figured rq can be
terminated as below. As for postponing HWIF(drive)->ide_dma_off(drive).
Legitimately terminated commands is hardly a reason for switchinf DMA
off. Most notably DVD-RW units terminate WRITE requests every time
internal buffer gets exhausted, which happens all the time...

Cheers. A.
8<--------8<--------8<--------8<--------8<--------8<--------8<--------
--- ./drivers/ide/ide-cd.c.orig	Tue Jun  3 12:21:56 2003
+++ ./drivers/ide/ide-cd.c	Thu Jun  5 22:26:56 2003
@@ -749,12 +749,17 @@
 		   by transferring the semaphore from the packet
 		   command request to the request sense request. */
 
+		rq->flags |= REQ_FAILED;
 		if ((stat & ERR_STAT) != 0) {
 			wait = rq->waiting;
 			rq->waiting = NULL;
+			if (rq->flags&REQ_BLOCK_PC) {
+				cdrom_queue_request_sense(drive, wait,
+							  rq->sense, rq);
+				return 1; /* REQ_BLOCK_PC self-cares */
+			}
 		}
 
-		rq->flags |= REQ_FAILED;
 		cdrom_end_request(drive, 0);
 
 		if ((stat & ERR_STAT) != 0)
@@ -1657,13 +1662,14 @@
 	dma = info->dma;
 	if (dma) {
 		info->dma = 0;
-		if ((dma_error = HWIF(drive)->ide_dma_end(drive))) {
-			printk("ide-cd: dma error\n");
-			HWIF(drive)->ide_dma_off(drive);
-		}
+		dma_error = HWIF(drive)->ide_dma_end(drive);
 	}
 
 	if (cdrom_decode_status(drive, 0, &stat)) {
+		if (stat&ERR_STAT)
+		{	end_that_request_chunk(rq, 0, rq->data_len);
+			goto end_request; /* purge the whole thing... */
+		}
 		end_that_request_chunk(rq, 1, rq->data_len);
 		return ide_stopped;
 	}
@@ -1672,8 +1678,11 @@
 	 * using dma, transfer is complete now
 	 */
 	if (dma) {
-		if (dma_error)
+		if (dma_error) {
+			printk("ide-cd: dma error\n");
+			HWIF(drive)->ide_dma_off(drive);
 			return DRIVER(drive)->error(drive, "dma error", stat);
+		}
 
 		end_that_request_chunk(rq, 1, rq->data_len);
 		rq->data_len = 0;

      reply	other threads:[~2003-06-05 20:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-28  7:41 2.5.69-70 ide-cd to guarantee fault-free CD/DVD burning experience? Andy Polyakov
2003-05-28  7:48 ` Jens Axboe
2003-05-28  7:52   ` Jens Axboe
2003-05-28 16:42   ` Andy Polyakov
2003-05-28 17:03     ` Jens Axboe
2003-05-29 13:50       ` Andy Polyakov
2003-05-29 17:33         ` Jens Axboe
2003-05-28  7:49 ` Jens Axboe
2003-06-04 19:42 ` Andy Polyakov
2003-06-04 19:55   ` Jens Axboe
2003-06-05 21:05     ` Andy Polyakov [this message]

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=3EDFB07D.75892CC8@fy.chalmers.se \
    --to=appro@fy.chalmers.se \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /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