[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1241751256-17435-13-git-send-email-tj@kernel.org>
Date: Fri, 8 May 2009 11:54:10 +0900
From: Tejun Heo <tj@...nel.org>
To: linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org,
linux-ide@...r.kernel.org, rusty@...tcorp.com.au,
James.Bottomley@...senPartnership.com, mike.miller@...com,
donari75@...il.com, paul.clements@...eleye.com, tim@...erelk.net,
Geert.Uytterhoeven@...ycom.com, davem@...emloft.net,
Laurent@...vier.info, jgarzik@...ox.com, jeremy@...source.com,
grant.likely@...retlab.ca, adrian@...en.demon.co.uk,
sfr@...b.auug.org.au, bzolnier@...il.com, petkovbb@...glemail.com,
sshtylyov@...mvista.com, oakad@...oo.com, drzeus@...eus.cx,
dwmw2@...radead.org, Markus.Lidel@...dowconnect.com,
wein@...ibm.com, schwidefsky@...ibm.com, zaitcev@...hat.com,
fujita.tomonori@....ntt.co.jp, axboe@...nel.dk
Cc: Tejun Heo <tj@...nel.org>
Subject: [PATCH 12/18] xd: dequeue in-flight request
xd processes requests one-by-one synchronously and can be easily
converted to dequeueing model. Convert it.
While at it, use rq_cur_bytes instead of rq_bytes when checking for
sector overflow. This is for for consistency and better behavior for
merged requests.
[ Impact: dequeue in-flight request ]
Signed-off-by: Tejun Heo <tj@...nel.org>
---
drivers/block/xd.c | 29 +++++++++++++++++------------
1 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/drivers/block/xd.c b/drivers/block/xd.c
index 4ef8801..d4c4352 100644
--- a/drivers/block/xd.c
+++ b/drivers/block/xd.c
@@ -305,26 +305,31 @@ static void do_xd_request (struct request_queue * q)
if (xdc_busy)
return;
- while ((req = elv_next_request(q)) != NULL) {
+ req = elv_next_request(q);
+ if (req)
+ blkdev_dequeue_request(req);
+
+ while (req) {
unsigned block = blk_rq_pos(req);
- unsigned count = blk_rq_sectors(req);
+ unsigned count = blk_rq_cur_sectors(req);
XD_INFO *disk = req->rq_disk->private_data;
- int res = 0;
+ int res = -EIO;
int retry;
- if (!blk_fs_request(req)) {
- __blk_end_request_cur(req, -EIO);
- continue;
- }
- if (block + count > get_capacity(req->rq_disk)) {
- __blk_end_request_cur(req, -EIO);
- continue;
- }
+ if (!blk_fs_request(req))
+ goto done;
+ if (block + count > get_capacity(req->rq_disk))
+ goto done;
for (retry = 0; (retry < XD_RETRIES) && !res; retry++)
res = xd_readwrite(rq_data_dir(req), disk, req->buffer,
block, count);
+ done:
/* wrap up, 0 = success, -errno = fail */
- __blk_end_request_cur(req, res);
+ if (!__blk_end_request_cur(req, res)) {
+ req = elv_next_request(q);
+ if (req)
+ blkdev_dequeue_request(req);
+ }
}
}
--
1.6.0.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists