From: Jens Axboe <axboe@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Jens Axboe <axboe@suse.de>
Subject: [PATCH] 10/15 as-iosched: remove arq->is_sync member
Date: Thu, 13 Jul 2006 14:46:33 +0200 [thread overview]
Message-ID: <11527947981715-git-send-email-axboe@suse.de> (raw)
In-Reply-To: <11527947982769-git-send-email-axboe@suse.de>
We can track this in struct request.
Signed-off-by: Jens Axboe <axboe@suse.de>
---
block/as-iosched.c | 36 ++++++++++++++----------------------
include/linux/blkdev.h | 5 +++++
2 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/block/as-iosched.c b/block/as-iosched.c
index 13d8d91..3fbb56d 100644
--- a/block/as-iosched.c
+++ b/block/as-iosched.c
@@ -151,7 +151,6 @@ struct as_rq {
struct io_context *io_context; /* The submitting task */
- unsigned int is_sync;
enum arq_state state;
};
@@ -241,7 +240,7 @@ static void as_put_io_context(struct as_
aic = arq->io_context->aic;
- if (arq->is_sync == REQ_SYNC && aic) {
+ if (rq_is_sync(arq->request) && aic) {
spin_lock(&aic->lock);
set_bit(AS_TASK_IORUNNING, &aic->state);
aic->last_end_request = jiffies;
@@ -254,14 +253,13 @@ static void as_put_io_context(struct as_
/*
* rb tree support functions
*/
-#define ARQ_RB_ROOT(ad, arq) (&(ad)->sort_list[(arq)->is_sync])
+#define RQ_RB_ROOT(ad, rq) (&(ad)->sort_list[rq_is_sync((rq))])
static void as_add_arq_rb(struct as_data *ad, struct request *rq)
{
- struct as_rq *arq = RQ_DATA(rq);
struct request *alias;
- while ((unlikely(alias = elv_rb_add(ARQ_RB_ROOT(ad, arq), rq)))) {
+ while ((unlikely(alias = elv_rb_add(RQ_RB_ROOT(ad, rq), rq)))) {
as_move_to_dispatch(ad, RQ_DATA(alias));
as_antic_stop(ad);
}
@@ -269,7 +267,7 @@ static void as_add_arq_rb(struct as_data
static inline void as_del_arq_rb(struct as_data *ad, struct request *rq)
{
- elv_rb_del(ARQ_RB_ROOT(ad, RQ_DATA(rq)), rq);
+ elv_rb_del(RQ_RB_ROOT(ad, rq), rq);
}
/*
@@ -300,13 +298,13 @@ as_choose_req(struct as_data *ad, struct
if (arq2 == NULL)
return arq1;
- data_dir = arq1->is_sync;
+ data_dir = rq_is_sync(arq1->request);
last = ad->last_sector[data_dir];
s1 = arq1->request->sector;
s2 = arq2->request->sector;
- BUG_ON(data_dir != arq2->is_sync);
+ BUG_ON(data_dir != rq_is_sync(arq2->request));
/*
* Strict one way elevator _except_ in the case where we allow
@@ -377,7 +375,7 @@ static struct as_rq *as_find_next_arq(st
if (rbnext)
next = RQ_DATA(rb_entry_rq(rbnext));
else {
- const int data_dir = arq->is_sync;
+ const int data_dir = rq_is_sync(last);
rbnext = rb_first(&ad->sort_list[data_dir]);
if (rbnext && rbnext != &last->rb_node)
@@ -538,8 +536,7 @@ static void as_update_seekdist(struct as
static void as_update_iohist(struct as_data *ad, struct as_io_context *aic,
struct request *rq)
{
- struct as_rq *arq = RQ_DATA(rq);
- int data_dir = arq->is_sync;
+ int data_dir = rq_is_sync(rq);
unsigned long thinktime = 0;
sector_t seek_dist;
@@ -674,7 +671,7 @@ static int as_can_break_anticipation(str
return 1;
}
- if (arq && arq->is_sync == REQ_SYNC && as_close_req(ad, aic, arq)) {
+ if (arq && rq_is_sync(arq->request) && as_close_req(ad, aic, arq)) {
/*
* Found a close request that is not one of ours.
*
@@ -758,7 +755,7 @@ static int as_can_anticipate(struct as_d
*/
static void as_update_arq(struct as_data *ad, struct as_rq *arq)
{
- const int data_dir = arq->is_sync;
+ const int data_dir = rq_is_sync(arq->request);
/* keep the next_arq cache up to date */
ad->next_arq[data_dir] = as_choose_req(ad, arq, ad->next_arq[data_dir]);
@@ -835,7 +832,7 @@ static void as_completed_request(request
* actually serviced. This should help devices with big TCQ windows
* and writeback caches
*/
- if (ad->new_batch && ad->batch_data_dir == arq->is_sync) {
+ if (ad->new_batch && ad->batch_data_dir == rq_is_sync(rq)) {
update_write_batch(ad);
ad->current_batch_expires = jiffies +
ad->batch_expire[REQ_SYNC];
@@ -868,7 +865,7 @@ out:
static void as_remove_queued_request(request_queue_t *q, struct request *rq)
{
struct as_rq *arq = RQ_DATA(rq);
- const int data_dir = arq->is_sync;
+ const int data_dir = rq_is_sync(rq);
struct as_data *ad = q->elevator->elevator_data;
WARN_ON(arq->state != AS_RQ_QUEUED);
@@ -941,7 +938,7 @@ static inline int as_batch_expired(struc
static void as_move_to_dispatch(struct as_data *ad, struct as_rq *arq)
{
struct request *rq = arq->request;
- const int data_dir = arq->is_sync;
+ const int data_dir = rq_is_sync(rq);
BUG_ON(RB_EMPTY_NODE(&rq->rb_node));
@@ -1156,12 +1153,7 @@ static void as_add_request(request_queue
arq->state = AS_RQ_NEW;
- if (rq_data_dir(arq->request) == READ
- || (arq->request->flags & REQ_RW_SYNC))
- arq->is_sync = 1;
- else
- arq->is_sync = 0;
- data_dir = arq->is_sync;
+ data_dir = rq_is_sync(rq);
arq->io_context = as_get_io_context();
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index e296719..78808a0 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -513,6 +513,11 @@ #define list_entry_rq(ptr) list_entry((p
#define rq_data_dir(rq) ((rq)->flags & 1)
+/*
+ * We regard a request as sync, if it's a READ or a SYNC write.
+ */
+#define rq_is_sync(rq) (rq_data_dir((rq)) == READ || (rq)->flags & REQ_RW_SYNC)
+
static inline int blk_queue_full(struct request_queue *q, int rw)
{
if (rw == READ)
--
1.4.1.ged0e0
next prev parent reply other threads:[~2006-07-13 12:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-13 12:46 [PATCHSET] 0/15 IO scheduler improvements Jens Axboe
2006-07-13 12:46 ` [PATCH] 1/15 elevator: move the backmerging logic into the elevator core Jens Axboe
2006-07-13 12:46 ` [PATCH] 2/15 rbtree: fixed reversed RB_EMPTY_NODE and rb_next/prev Jens Axboe
2006-07-13 12:46 ` [PATCH] 3/15 elevator: abstract out the rbtree sort handling Jens Axboe
2006-07-13 12:46 ` [PATCH] 4/15 as-iosched: migrate to using the elevator rb functions Jens Axboe
2006-07-13 12:46 ` [PATCH] 5/15 cfq-iosched: " Jens Axboe
2006-07-13 12:46 ` [PATCH] 6/15 deadline-iosched: " Jens Axboe
2006-07-13 12:46 ` [PATCH] 7/15 elevator: introduce a way to reuse rq for internal FIFO handling Jens Axboe
2006-07-13 12:46 ` [PATCH] 8/15 cfq-iosched: convert to using the FIFO elevator defines Jens Axboe
2006-07-13 12:46 ` [PATCH] 9/15 as-iosched: reuse rq for fifo Jens Axboe
2006-07-13 12:46 ` Jens Axboe [this message]
2006-07-13 12:46 ` [PATCH] 11/15 deadline-iosched: remove elevator private drq request type Jens Axboe
2006-07-13 12:46 ` [PATCH] 12/15 cfq-iosched: remove the crq flag functions/variable Jens Axboe
2006-07-13 12:46 ` [PATCH] 13/15 Add one more pointer to struct request for IO scheduler usage Jens Axboe
2006-07-13 12:46 ` [PATCH] 14/15 cfq-iosched: kill crq Jens Axboe
2006-07-13 12:46 ` [PATCH] 15/15 as-iosched: kill arq 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=11527947981715-git-send-email-axboe@suse.de \
--to=axboe@suse.de \
--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