From: Tejun Heo <tj@kernel.org>
To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-ide@vger.kernel.org, rusty@rustcorp.com.au,
James.Bottomley@HansenPartnership.com, mike.miller@hp.com,
donari75@gmail.c
Cc: Tejun Heo <tj@kernel.org>
Subject: [PATCH 08/18] paride: dequeue in-flight request
Date: Fri, 8 May 2009 11:54:06 +0900 [thread overview]
Message-ID: <1241751256-17435-9-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1241751256-17435-1-git-send-email-tj@kernel.org>
pd/pf/pcd have track in-flight request by pd/pf/pcd_req. They can be
converted to dequeueing model by updating fetching and completion
paths. Convert them.
Note that removal of elv_next_request() call from pf_next_buf()
doesn't make any functional difference. The path is traveled only
during partial completion of a request and elv_next_request() call
must return the same request anyway.
[ Impact: dequeue in-flight request ]
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Tim Waugh <tim@cyberelk.net>
---
drivers/block/paride/pcd.c | 18 ++++++++++++------
drivers/block/paride/pd.c | 14 +++++++++-----
drivers/block/paride/pf.c | 14 +++++++-------
3 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 2d5dc0a..425f815 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -719,9 +719,12 @@ static void do_pcd_request(struct request_queue * q)
if (pcd_busy)
return;
while (1) {
- pcd_req = elv_next_request(q);
- if (!pcd_req)
- return;
+ if (!pcd_req) {
+ pcd_req = elv_next_request(q);
+ if (!pcd_req)
+ return;
+ blkdev_dequeue_request(pcd_req);
+ }
if (rq_data_dir(pcd_req) == READ) {
struct pcd_unit *cd = pcd_req->rq_disk->private_data;
@@ -734,8 +737,10 @@ static void do_pcd_request(struct request_queue * q)
pcd_busy = 1;
ps_set_intr(do_pcd_read, NULL, 0, nice);
return;
- } else
- __blk_end_request_cur(pcd_req, -EIO);
+ } else {
+ __blk_end_request_all(pcd_req, -EIO);
+ pcd_req = NULL;
+ }
}
}
@@ -744,7 +749,8 @@ static inline void next_request(int err)
unsigned long saved_flags;
spin_lock_irqsave(&pcd_lock, saved_flags);
- __blk_end_request_cur(pcd_req, err);
+ if (!__blk_end_request_cur(pcd_req, err))
+ pcd_req = NULL;
pcd_busy = 0;
do_pcd_request(pcd_queue);
spin_unlock_irqrestore(&pcd_lock, saved_flags);
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index 9ec5d4a..d2ca3f5 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -410,11 +410,14 @@ static void run_fsm(void)
pd_claimed = 0;
phase = NULL;
spin_lock_irqsave(&pd_lock, saved_flags);
- __blk_end_request_cur(pd_req,
- res == Ok ? 0 : -EIO);
- pd_req = elv_next_request(pd_queue);
- if (!pd_req)
- stop = 1;
+ if (!__blk_end_request_cur(pd_req,
+ res == Ok ? 0 : -EIO)) {
+ pd_req = elv_next_request(pd_queue);
+ if (!pd_req)
+ stop = 1;
+ else
+ blkdev_dequeue_request(pd_req);
+ }
spin_unlock_irqrestore(&pd_lock, saved_flags);
if (stop)
return;
@@ -706,6 +709,7 @@ static void do_pd_request(struct request_queue * q)
pd_req = elv_next_request(q);
if (!pd_req)
return;
+ blkdev_dequeue_request(pd_req);
schedule_fsm();
}
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index e88c889..d6f7bd8 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -752,10 +752,8 @@ static struct request_queue *pf_queue;
static void pf_end_request(int err)
{
- if (pf_req) {
- __blk_end_request_cur(pf_req, err);
+ if (pf_req && !__blk_end_request_cur(pf_req, err))
pf_req = NULL;
- }
}
static void do_pf_request(struct request_queue * q)
@@ -763,9 +761,12 @@ static void do_pf_request(struct request_queue * q)
if (pf_busy)
return;
repeat:
- pf_req = elv_next_request(q);
- if (!pf_req)
- return;
+ if (!pf_req) {
+ pf_req = elv_next_request(q);
+ if (!pf_req)
+ return;
+ blkdev_dequeue_request(pf_req);
+ }
pf_current = pf_req->rq_disk->private_data;
pf_block = blk_rq_pos(pf_req);
@@ -806,7 +807,6 @@ static int pf_next_buf(void)
if (!pf_count) {
spin_lock_irqsave(&pf_spin_lock, saved_flags);
pf_end_request(0);
- pf_req = elv_next_request(pf_queue);
spin_unlock_irqrestore(&pf_spin_lock, saved_flags);
if (!pf_req)
return 1;
--
1.6.0.2
next prev parent reply other threads:[~2009-05-08 2:56 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-08 2:53 [GIT PATCH] block: unify request processing model and implement peek/fetch Tejun Heo
2009-05-08 2:53 ` [PATCH 01/18] ide: dequeue in-flight request Tejun Heo
2009-05-09 6:56 ` Borislav Petkov
2009-05-09 15:58 ` Bartlomiej Zolnierkiewicz
2009-05-08 2:54 ` [PATCH 02/18] mg_disk: fix queue hang / infinite retry on !fs requests Tejun Heo
2009-05-08 2:54 ` [PATCH 03/18] mg_disk: dequeue and track in-flight request Tejun Heo
2009-05-08 2:54 ` [PATCH 04/18] hd: " Tejun Heo
2009-05-08 2:54 ` [PATCH 05/18] ataflop: " Tejun Heo
2009-05-08 2:54 ` [PATCH 06/18] swim3: dequeue " Tejun Heo
2009-05-08 2:54 ` [PATCH 07/18] xsysace: " Tejun Heo
2009-05-08 2:54 ` Tejun Heo [this message]
2009-05-08 2:54 ` [PATCH 09/18] ps3disk: " Tejun Heo
2009-05-08 2:54 ` [PATCH 10/18] amiflop: " Tejun Heo
2009-05-08 2:54 ` [PATCH 11/18] swim: " Tejun Heo
2009-05-16 13:42 ` Sergei Shtylyov
2009-05-16 14:37 ` Tejun Heo
2009-05-16 19:56 ` Sergei Shtylyov
2009-05-16 22:18 ` Tejun Heo
2009-05-08 2:54 ` [PATCH 12/18] xd: " Tejun Heo
2009-05-08 2:54 ` [PATCH 13/18] mtd_blkdevs: " Tejun Heo
2009-05-08 2:54 ` [PATCH 14/18] jsflash: " Tejun Heo
2009-05-08 2:54 ` [PATCH 15/18] z2ram: " Tejun Heo
2009-05-16 12:54 ` Sergei Shtylyov
2009-05-16 19:58 ` Sergei Shtylyov
2009-05-08 2:54 ` [PATCH 16/18] gdrom: " Tejun Heo
2009-05-08 19:53 ` Adrian McMenamin
2009-05-08 23:43 ` Tejun Heo
2009-05-08 2:54 ` [PATCH 17/18] block: convert to dequeueing model (easy ones) Tejun Heo
2009-05-08 2:54 ` [PATCH 18/18] block: implement and enforce request peek/start/fetch Tejun Heo
2009-05-10 21:52 ` Bartlomiej Zolnierkiewicz
2009-05-10 11:28 ` [GIT PATCH] block: unify request processing model and implement peek/fetch Tejun Heo
2009-05-11 7:52 ` Jens Axboe
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=1241751256-17435-9-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=donari75@gmail.c \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mike.miller@hp.com \
--cc=rusty@rustcorp.com.au \
/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).