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 3/9] ide: sanitize ide_end_rq()
Date: Mon, 09 Feb 2009 21:01:05 +0100 [thread overview]
Message-ID: <20090209200105.7985.54457.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20090209200042.7985.94247.sendpatchset@localhost.localdomain>
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: sanitize ide_end_rq()
* Move 'uptodate' quirk from ide_end_rq() to its users.
* Move quirks for blk_noretry_request() and !blk_fs_request()
requests from ide_end_rq() to ide_end_request().
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 2 +-
drivers/ide/ide-io.c | 34 ++++++++++++++++------------------
2 files changed, 17 insertions(+), 19 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -266,7 +266,7 @@ static void cdrom_end_request(ide_drive_
if (blk_fs_request(failed)) {
BUG_ON(!blk_rq_started(rq));
- if (ide_end_rq(drive, failed, 0,
+ if (ide_end_rq(drive, failed, -EIO,
failed->hard_nr_sectors << 9))
BUG();
} else {
Index: b/drivers/ide/ide-io.c
===================================================================
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -54,24 +54,9 @@
#include <asm/uaccess.h>
#include <asm/io.h>
-int ide_end_rq(ide_drive_t *drive, struct request *rq, int uptodate,
+int ide_end_rq(ide_drive_t *drive, struct request *rq, int error,
unsigned int nr_bytes)
{
- int error = 0;
-
- if (uptodate <= 0)
- error = uptodate ? uptodate : -EIO;
-
- /*
- * if failfast is set on a request, override number of sectors and
- * complete the whole request right now
- */
- if (blk_noretry_request(rq) && error)
- nr_bytes = rq->hard_nr_sectors << 9;
-
- if (!blk_fs_request(rq) && error && !rq->errors)
- rq->errors = -EIO;
-
/*
* decide whether to reenable DMA -- 3 is a random magic for now,
* if we DMA timeout more than 3 times, just stay in PIO
@@ -101,7 +86,7 @@ int ide_end_request (ide_drive_t *drive,
{
unsigned int nr_bytes = nr_sectors << 9;
struct request *rq = drive->hwif->rq;
- int rc;
+ int rc, error = 0;
if (!nr_bytes) {
if (blk_pc_request(rq))
@@ -110,7 +95,20 @@ int ide_end_request (ide_drive_t *drive,
nr_bytes = rq->hard_cur_sectors << 9;
}
- rc = ide_end_rq(drive, rq, uptodate, nr_bytes);
+ /*
+ * if failfast is set on a request, override number of sectors
+ * and complete the whole request right now
+ */
+ if (blk_noretry_request(rq) && uptodate <= 0)
+ nr_bytes = rq->hard_nr_sectors << 9;
+
+ if (blk_fs_request(rq) == 0 && uptodate <= 0 && rq->errors == 0)
+ rq->errors = -EIO;
+
+ if (uptodate <= 0)
+ error = uptodate ? uptodate : -EIO;
+
+ rc = ide_end_rq(drive, rq, error, nr_bytes);
if (rc == 0)
drive->hwif->rq = NULL;
next prev parent reply other threads:[~2009-02-09 19:59 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 ` Bartlomiej Zolnierkiewicz [this message]
2009-02-09 20:01 ` [PATCH 4/9] ide: pass error value to ide_complete_rq() Bartlomiej Zolnierkiewicz
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=20090209200105.7985.54457.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 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).