linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: IDE/ATA development list <linux-ide@vger.kernel.org>,
	Borislav Petkov <petkovbb@googlemail.com>
Subject: Re: bug in use-ide_pio_bytes patch?
Date: Mon, 23 Mar 2009 12:43:50 +0100	[thread overview]
Message-ID: <200903231243.51078.bzolnier@gmail.com> (raw)
In-Reply-To: <49C7680D.6070108@kernel.org>

On Monday 23 March 2009, Tejun Heo wrote:
> Hi,
> 
> Bartlomiej Zolnierkiewicz wrote:
> >> It completes ide_floppy requests in the DMA handling block; however,
> >> those requests are gonna be completed again later in the regular
> >> completion path again.  I think the above part can be simply dropped?
> > 
> > I'm not sure I get it -- could you point me to the other completion path?
> 
> static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
> {
> ....	
> 	if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
> ....
> 		if (rc || (drive->media == ide_tape && (stat & ATA_ERR))) {
> 			if (drive->media == ide_floppy)
> 				printk(KERN_ERR "%s: DMA %s error\n",
> 					drive->name, rq_data_dir(pc->rq)
> 						     ? "write" : "read");
> 			pc->flags |= PC_FLAG_DMA_ERROR;
> 		} else {
> 			pc->xferred = pc->req_xfer;
> 			if (drive->pc_update_buffers)
> 				drive->pc_update_buffers(drive, pc);
> 
> 			if (drive->media == ide_floppy)
> 1:				ide_complete_rq(drive, 0, blk_rq_bytes(rq));
> 		}
> 		debug_log("%s: DMA finished\n", drive->name);
> 	}
> 
> 	/* No more interrupts */
> 	if ((stat & ATA_DRQ) == 0) {
> ...
> 		/* Command finished - Call the callback function */
> 		uptodate = drive->pc_callback(drive, dsc);
> 
> 		if (uptodate == 0)
> 			drive->failed_pc = NULL;
> 
> 		if (blk_special_request(rq)) {
> 			rq->errors = 0;
> 2:			ide_complete_rq(drive, 0, blk_rq_bytes(rq));
> 		} else {
> 			unsigned int done;
> 
> 			if (blk_fs_request(rq) == 0 && uptodate <= 0) {
> 				if (rq->errors == 0)
> 					rq->errors = -EIO;
> 			}
> 
> 			if (drive->media == ide_tape)
> 				done = ide_rq_bytes(rq); /* FIXME */
> 			else
> 				done = blk_rq_bytes(rq);
> 
> 3:			ide_complete_rq(drive, uptodate ? 0 : -EIO, done);
> 		}
> 
> 		return ide_stopped;
> 	}
> ...
> }
> 
> #1 completely completes the request after which it shouldn't be
> accessed, but rq is accessed afterwards and #2 or #3 will be called on
> the rq again.  Am I missing something?

Thanks for explanation.

[ IIRC "1:" was always there but in the form of partial completions loop
  inside ->pc_update_buffers callback... ]

It seems like we really should remove "1:" but it would be best to retest
ide-floppy with this change.  Borislav, could you add this to your queue?

Thanks,
Bart

  reply	other threads:[~2009-03-23 11:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-23  6:28 bug in use-ide_pio_bytes patch? Tejun Heo
2009-03-23 10:27 ` Bartlomiej Zolnierkiewicz
2009-03-23 10:44   ` Tejun Heo
2009-03-23 11:43     ` Bartlomiej Zolnierkiewicz [this message]
2009-03-25  9:15       ` Borislav Petkov
2009-03-26 20:19         ` Bartlomiej Zolnierkiewicz

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=200903231243.51078.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=petkovbb@googlemail.com \
    --cc=tj@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;
as well as URLs for NNTP newsgroup(s).