All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 4/9] ide: pass error value to ide_complete_rq()
Date: Mon, 09 Feb 2009 21:01:13 +0100	[thread overview]
Message-ID: <20090209200113.7985.38988.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20090209200042.7985.94247.sendpatchset@localhost.localdomain>

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: pass error value to ide_complete_rq()

Set rq->errors at ide_complete_rq() call sites and then pass
error value to ide_complete_rq().

[ Some rq->errors assignments look really wrong but this patch
  leaves them alone to not introduce too many changes at once. ]

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-atapi.c    |    5 +++--
 drivers/ide/ide-eh.c       |    5 +++--
 drivers/ide/ide-floppy.c   |    2 +-
 drivers/ide/ide-io.c       |   19 +++++++++----------
 drivers/ide/ide-tape.c     |    2 +-
 drivers/ide/ide-taskfile.c |    4 +++-
 include/linux/ide.h        |    2 +-
 7 files changed, 21 insertions(+), 18 deletions(-)

Index: b/drivers/ide/ide-atapi.c
===================================================================
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -390,9 +390,10 @@ static ide_startstop_t ide_pc_intr(ide_d
 		if (uptodate == 0)
 			drive->failed_pc = NULL;
 
-		if (blk_special_request(rq))
+		if (blk_special_request(rq)) {
+			rq->errors = 0;
 			ide_complete_rq(drive, 0);
-		else
+		} else
 			ide_end_request(drive, uptodate, 0);
 
 		return ide_stopped;
Index: b/drivers/ide/ide-eh.c
===================================================================
--- a/drivers/ide/ide-eh.c
+++ b/drivers/ide/ide-eh.c
@@ -123,17 +123,18 @@ ide_startstop_t ide_error(ide_drive_t *d
 
 	/* retry only "normal" I/O: */
 	if (!blk_fs_request(rq)) {
-		rq->errors = 1;
 		if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
 			struct ide_cmd *cmd = rq->special;
 
 			if (cmd)
 				ide_complete_cmd(drive, cmd, stat, err);
 		} else if (blk_pm_request(rq)) {
+			rq->errors = 1;
 			ide_complete_pm_rq(drive, rq);
 			return ide_stopped;
 		}
-		ide_complete_rq(drive, err);
+		rq->errors = err;
+		ide_complete_rq(drive, err ? -EIO : 0);
 		return ide_stopped;
 	}
 
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -260,7 +260,7 @@ static ide_startstop_t ide_floppy_do_req
 			printk(KERN_ERR PFX "%s: I/O error\n", drive->name);
 
 		if (blk_special_request(rq)) {
-			rq->errors = IDE_DRV_ERROR_GENERAL;
+			rq->errors = 0;
 			ide_complete_rq(drive, 0);
 			return ide_stopped;
 		} else
Index: b/drivers/ide/ide-io.c
===================================================================
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -140,17 +140,14 @@ void ide_complete_cmd(ide_drive_t *drive
 		kfree(cmd);
 }
 
-void ide_complete_rq(ide_drive_t *drive, u8 err)
+void ide_complete_rq(ide_drive_t *drive, int error)
 {
 	ide_hwif_t *hwif = drive->hwif;
 	struct request *rq = hwif->rq;
 
 	hwif->rq = NULL;
 
-	rq->errors = err;
-
-	if (unlikely(blk_end_request(rq, (rq->errors ? -EIO : 0),
-				     blk_rq_bytes(rq))))
+	if (unlikely(blk_end_request(rq, error, blk_rq_bytes(rq))))
 		BUG();
 }
 EXPORT_SYMBOL(ide_complete_rq);
@@ -162,13 +159,14 @@ void ide_kill_rq(ide_drive_t *drive, str
 
 	drive->failed_pc = NULL;
 
-	if ((media == ide_floppy && drv_req) || media == ide_tape)
-		rq->errors = IDE_DRV_ERROR_GENERAL;
-
-	if ((media == ide_floppy || media == ide_tape) && drv_req)
+	if ((media == ide_floppy || media == ide_tape) && drv_req) {
+		rq->errors = 0;
 		ide_complete_rq(drive, 0);
-	else
+	} else {
+		if (media == ide_tape)
+			rq->errors = IDE_DRV_ERROR_GENERAL;
 		ide_end_request(drive, 0, 0);
+	}
 }
 
 static void ide_tf_set_specify_cmd(ide_drive_t *drive, struct ide_taskfile *tf)
@@ -308,6 +306,7 @@ static ide_startstop_t execute_drive_cmd
 #ifdef DEBUG
  	printk("%s: DRIVE_CMD (null)\n", drive->name);
 #endif
+	rq->errors = 0;
 	ide_complete_rq(drive, 0);
 
  	return ide_stopped;
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -774,8 +774,8 @@ static ide_startstop_t idetape_do_reques
 		if (rq != postponed_rq) {
 			printk(KERN_ERR "ide-tape: ide-tape.c bug - "
 					"Two DSC requests were queued\n");
-			rq->errors = IDE_DRV_ERROR_GENERAL;
 			drive->failed_pc = NULL;
+			rq->errors = 0;
 			ide_complete_rq(drive, 0);
 			return ide_stopped;
 		}
Index: b/drivers/ide/ide-taskfile.c
===================================================================
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -289,10 +289,12 @@ static void ide_error_cmd(ide_drive_t *d
 
 void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat)
 {
+	struct request *rq = drive->hwif->rq;
 	u8 err = ide_read_error(drive);
 
 	ide_complete_cmd(drive, cmd, stat, err);
-	ide_complete_rq(drive, err);
+	rq->errors = err;
+	ide_complete_rq(drive, err ? -EIO : 0);
 }
 
 /*
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1163,7 +1163,7 @@ extern int ide_devset_execute(ide_drive_
 			      const struct ide_devset *setting, int arg);
 
 void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8);
-void ide_complete_rq(ide_drive_t *, u8);
+void ide_complete_rq(ide_drive_t *, int);
 
 void ide_tf_dump(const char *, struct ide_taskfile *);
 

  parent reply	other threads:[~2009-02-09 20:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-09 20:00 [PATCH 0/9] ide: unify request completion methods Bartlomiej Zolnierkiewicz
2009-02-09 20:00 ` [PATCH 1/9] ide: make ide_special_rq() BUG() on unknown requests Bartlomiej Zolnierkiewicz
2009-02-09 20:00 ` [PATCH 2/9] ide: add ide_end_rq() Bartlomiej Zolnierkiewicz
2009-02-09 20:01 ` [PATCH 3/9] ide: sanitize ide_end_rq() Bartlomiej Zolnierkiewicz
2009-02-09 20:01 ` Bartlomiej Zolnierkiewicz [this message]
2009-02-09 20:01 ` [PATCH 5/9] ide: move rq->errors quirk out from ide_end_request() Bartlomiej Zolnierkiewicz
2009-02-09 20:01 ` [PATCH 6/9] ide: remove BUG() from ide_complete_rq() Bartlomiej Zolnierkiewicz
2009-02-09 20:01 ` [PATCH 7/9] ide: pass number of bytes to complete to ide_complete_rq() Bartlomiej Zolnierkiewicz
2009-02-09 20:01 ` [PATCH 8/9] ide: use ide_end_rq() in ide_complete_rq() Bartlomiej Zolnierkiewicz
2009-02-09 20:01 ` [PATCH 9/9] ide: remove ide_end_request() 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=20090209200113.7985.38988.sendpatchset@localhost.localdomain \
    --to=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.