From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: Tejun Heo <tj@kernel.org>
Cc: 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.com, paul.clements@steeleye.com, tim@cyberelk.net,
Geert.Uytterhoeven@sonycom.com, davem@davemloft.net,
Laurent@lvivier.info, jgarzik@pobox.com, jeremy@xensource.com,
grant.likely@secretlab.ca, adrian@mcmen.demon.co.uk,
sfr@canb.auug.org.au, bzolnier@gmail.com,
petkovbb@googlemail.com, oakad@yahoo.com, drzeus@drzeus.cx,
dwmw2@infradead.org, Markus.Lidel@shadowconnect.com,
wein@de.ibm.com, schwidefsky@de.ibm.com, zaitcev@redhat.com,
fujita.tomonori@lab.ntt.co.jp, axboe@kernel.dk
Subject: Re: [PATCH 11/18] swim: dequeue in-flight request
Date: Sat, 16 May 2009 17:42:05 +0400 [thread overview]
Message-ID: <4A0EC2AD.20704@ru.mvista.com> (raw)
In-Reply-To: <1241751256-17435-12-git-send-email-tj@kernel.org>
Hello.
Tejun Heo wrote:
> swim processes requests one-by-one synchronously and can easily be
> converted to dequeuing model. Convert it.
>
> [ Impact: dequeue in-flight request ]
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Laurent Vivier <Laurent@lvivier.info>
> ---
> drivers/block/swim.c | 47 +++++++++++++++++++++++------------------------
> 1 files changed, 23 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/block/swim.c b/drivers/block/swim.c
> index fc6a1c3..dedd489 100644
> --- a/drivers/block/swim.c
> +++ b/drivers/block/swim.c
> @@ -514,7 +514,7 @@ static int floppy_read_sectors(struct floppy_state *fs,
> ret = swim_read_sector(fs, side, track, sector,
> buffer);
> if (try-- == 0)
> - return -1;
> + return -EIO;
> } while (ret != 512);
>
> buffer += ret;
> @@ -528,38 +528,37 @@ static void redo_fd_request(struct request_queue *q)
> struct request *req;
> struct floppy_state *fs;
>
> - while ((req = elv_next_request(q))) {
> + req = elv_next_request(q);
> + if (req)
> + blkdev_dequeue_request(req);
> +
> + while (req) {
> + int err = -EIO;
>
> fs = req->rq_disk->private_data;
> - if (blk_rq_pos(req) >= fs->total_secs) {
> - __blk_end_request_cur(req, -EIO);
> - continue;
> - }
> - if (!fs->disk_in) {
> - __blk_end_request_cur(req, -EIO);
> - continue;
> - }
> - if (rq_data_dir(req) == WRITE) {
> - if (fs->write_protected) {
> - __blk_end_request_cur(req, -EIO);
> - continue;
> - }
> - }
> + if (blk_rq_pos(req) >= fs->total_secs)
> + goto done;
> + if (!fs->disk_in)
> + goto done;
> + if (rq_data_dir(req) == WRITE && fs->write_protected)
> + goto done;
> +
> switch (rq_data_dir(req)) {
> case WRITE:
> /* NOT IMPLEMENTED */
> - __blk_end_request_cur(req, -EIO);
> break;
> case READ:
> - if (floppy_read_sectors(fs, blk_rq_pos(req),
> - blk_rq_cur_sectors(req),
> - req->buffer)) {
> - __blk_end_request_cur(req, -EIO);
> - continue;
> - }
> - __blk_end_request_cur(req, 0);
> + err = floppy_read_sectors(fs, blk_rq_pos(req),
> + blk_rq_cur_sectors(req),
> + req->buffer);
> break;
> }
> + done:
> + if (!__blk_end_request_cur(req, err)) {
> + req = elv_next_request(q);
> + if (req)
> + blkdev_dequeue_request(req);
> + }
> }
> }
And without duplication:
@@ -528,38 +528,37 @@
static void redo_fd_request(struct request_queue *q)
{
- struct request *req;
struct floppy_state *fs;
- while ((req = elv_next_request(q))) {
+ while (1) {
+ struct request *req = elv_next_request(q);
+ int err;
+
+ if (req == NULL)
+ break;
+ blkdev_dequeue_request(req);
+again:
+ err = -EIO;
fs = req->rq_disk->private_data;
- if (blk_rq_pos(req) >= fs->total_secs) {
- __blk_end_request_cur(req, -EIO);
- continue;
- }
- if (!fs->disk_in) {
- __blk_end_request_cur(req, -EIO);
- continue;
- }
- if (rq_data_dir(req) == WRITE) {
- if (fs->write_protected) {
- __blk_end_request_cur(req, -EIO);
- continue;
- }
- }
+ if (blk_rq_pos(req) >= fs->total_secs)
+ goto done;
+ if (!fs->disk_in)
+ goto done;
+ if (rq_data_dir(req) == WRITE && fs->write_protected)
+ goto done;
+
switch (rq_data_dir(req)) {
case WRITE:
/* NOT IMPLEMENTED */
- __blk_end_request_cur(req, -EIO);
break;
case READ:
- if (floppy_read_sectors(fs, blk_rq_pos(req),
- blk_rq_cur_sectors(req),
- req->buffer)) {
- __blk_end_request_cur(req, -EIO);
- continue;
- }
- __blk_end_request_cur(req, 0);
+ err = floppy_read_sectors(fs, blk_rq_pos(req),
+ blk_rq_cur_sectors(req),
+ req->buffer);
break;
}
+ done:
+ if (__blk_end_request_cur(req, err))
+ goto again;
}
}
MBR, Sergei
next prev parent reply other threads:[~2009-05-16 13:42 UTC|newest]
Thread overview: 52+ 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 ` Tejun Heo
2009-05-08 2:53 ` [PATCH 01/18] ide: dequeue in-flight request Tejun Heo
2009-05-08 2:53 ` 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 ` 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 ` Tejun Heo
2009-05-08 2:54 ` [PATCH 04/18] hd: " Tejun Heo
2009-05-08 2:54 ` Tejun Heo
2009-05-08 2:54 ` [PATCH 05/18] ataflop: " Tejun Heo
2009-05-08 2:54 ` Tejun Heo
2009-05-08 2:54 ` [PATCH 06/18] swim3: dequeue " Tejun Heo
2009-05-08 2:54 ` Tejun Heo
2009-05-08 2:54 ` [PATCH 07/18] xsysace: " Tejun Heo
2009-05-08 2:54 ` Tejun Heo
2009-05-08 2:54 ` [PATCH 08/18] paride: " Tejun Heo
2009-05-08 2:54 ` Tejun Heo
2009-05-08 2:54 ` [PATCH 09/18] ps3disk: " Tejun Heo
2009-05-08 2:54 ` Tejun Heo
2009-05-08 2:54 ` [PATCH 10/18] amiflop: " Tejun Heo
2009-05-08 2:54 ` Tejun Heo
2009-05-08 2:54 ` [PATCH 11/18] swim: " Tejun Heo
2009-05-08 2:54 ` Tejun Heo
2009-05-16 13:42 ` Sergei Shtylyov [this message]
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 ` Tejun Heo
2009-05-08 2:54 ` [PATCH 13/18] mtd_blkdevs: " Tejun Heo
2009-05-08 2:54 ` Tejun Heo
2009-05-08 2:54 ` [PATCH 14/18] jsflash: " Tejun Heo
2009-05-08 2:54 ` Tejun Heo
2009-05-08 2:54 ` [PATCH 15/18] z2ram: " Tejun Heo
2009-05-08 2:54 ` 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 2:54 ` 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 ` Tejun Heo
2009-05-08 2:54 ` [PATCH 18/18] block: implement and enforce request peek/start/fetch Tejun Heo
2009-05-08 2:54 ` 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-10 11:28 ` 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=4A0EC2AD.20704@ru.mvista.com \
--to=sshtylyov@ru.mvista.com \
--cc=Geert.Uytterhoeven@sonycom.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=Laurent@lvivier.info \
--cc=Markus.Lidel@shadowconnect.com \
--cc=adrian@mcmen.demon.co.uk \
--cc=axboe@kernel.dk \
--cc=bzolnier@gmail.com \
--cc=davem@davemloft.net \
--cc=donari75@gmail.com \
--cc=drzeus@drzeus.cx \
--cc=dwmw2@infradead.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=grant.likely@secretlab.ca \
--cc=jeremy@xensource.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mike.miller@hp.com \
--cc=oakad@yahoo.com \
--cc=paul.clements@steeleye.com \
--cc=petkovbb@googlemail.com \
--cc=rusty@rustcorp.com.au \
--cc=schwidefsky@de.ibm.com \
--cc=sfr@canb.auug.org.au \
--cc=tim@cyberelk.net \
--cc=tj@kernel.org \
--cc=wein@de.ibm.com \
--cc=zaitcev@redhat.com \
/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.