diff options
author | Jens Axboe <axboe@suse.de> | 2006-07-13 06:37:56 -0400 |
---|---|---|
committer | Jens Axboe <axboe@nelson.home.kernel.dk> | 2006-09-30 14:27:01 -0400 |
commit | 5380a101d33d1d3a32c6b6bd2e17e5dd835842b0 (patch) | |
tree | 26cce0604f8c5860f3616d00bd6af18e11fadaa9 /block | |
parent | 8840faa1eebba22a9e2f86acddc0cf5145937df4 (diff) |
[PATCH] cfq-iosched: remove the crq flag functions/variable
There's just one flag currently (SYNC), and that one can be grabbed from
the request.
Signed-off-by: Jens Axboe <axboe@suse.de>
Diffstat (limited to 'block')
-rw-r--r-- | block/cfq-iosched.c | 58 |
1 files changed, 16 insertions, 42 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 5e4bae7f4158..86f0f4796fdb 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -182,8 +182,6 @@ struct cfq_rq { | |||
182 | 182 | ||
183 | struct cfq_queue *cfq_queue; | 183 | struct cfq_queue *cfq_queue; |
184 | struct cfq_io_context *io_context; | 184 | struct cfq_io_context *io_context; |
185 | |||
186 | unsigned int crq_flags; | ||
187 | }; | 185 | }; |
188 | 186 | ||
189 | enum cfqq_state_flags { | 187 | enum cfqq_state_flags { |
@@ -221,27 +219,6 @@ CFQ_CFQQ_FNS(idle_window); | |||
221 | CFQ_CFQQ_FNS(prio_changed); | 219 | CFQ_CFQQ_FNS(prio_changed); |
222 | #undef CFQ_CFQQ_FNS | 220 | #undef CFQ_CFQQ_FNS |
223 | 221 | ||
224 | enum cfq_rq_state_flags { | ||
225 | CFQ_CRQ_FLAG_is_sync = 0, | ||
226 | }; | ||
227 | |||
228 | #define CFQ_CRQ_FNS(name) \ | ||
229 | static inline void cfq_mark_crq_##name(struct cfq_rq *crq) \ | ||
230 | { \ | ||
231 | crq->crq_flags |= (1 << CFQ_CRQ_FLAG_##name); \ | ||
232 | } \ | ||
233 | static inline void cfq_clear_crq_##name(struct cfq_rq *crq) \ | ||
234 | { \ | ||
235 | crq->crq_flags &= ~(1 << CFQ_CRQ_FLAG_##name); \ | ||
236 | } \ | ||
237 | static inline int cfq_crq_##name(const struct cfq_rq *crq) \ | ||
238 | { \ | ||
239 | return (crq->crq_flags & (1 << CFQ_CRQ_FLAG_##name)) != 0; \ | ||
240 | } | ||
241 | |||
242 | CFQ_CRQ_FNS(is_sync); | ||
243 | #undef CFQ_CRQ_FNS | ||
244 | |||
245 | static struct cfq_queue *cfq_find_cfq_hash(struct cfq_data *, unsigned int, unsigned short); | 222 | static struct cfq_queue *cfq_find_cfq_hash(struct cfq_data *, unsigned int, unsigned short); |
246 | static void cfq_dispatch_insert(request_queue_t *, struct cfq_rq *); | 223 | static void cfq_dispatch_insert(request_queue_t *, struct cfq_rq *); |
247 | static struct cfq_queue *cfq_get_queue(struct cfq_data *cfqd, unsigned int key, struct task_struct *tsk, gfp_t gfp_mask); | 224 | static struct cfq_queue *cfq_get_queue(struct cfq_data *cfqd, unsigned int key, struct task_struct *tsk, gfp_t gfp_mask); |
@@ -290,9 +267,9 @@ cfq_choose_req(struct cfq_data *cfqd, struct cfq_rq *crq1, struct cfq_rq *crq2) | |||
290 | if (crq2 == NULL) | 267 | if (crq2 == NULL) |
291 | return crq1; | 268 | return crq1; |
292 | 269 | ||
293 | if (cfq_crq_is_sync(crq1) && !cfq_crq_is_sync(crq2)) | 270 | if (rq_is_sync(crq1->request) && !rq_is_sync(crq2->request)) |
294 | return crq1; | 271 | return crq1; |
295 | else if (cfq_crq_is_sync(crq2) && !cfq_crq_is_sync(crq1)) | 272 | else if (rq_is_sync(crq2->request) && !rq_is_sync(crq1->request)) |
296 | return crq2; | 273 | return crq2; |
297 | 274 | ||
298 | s1 = crq1->request->sector; | 275 | s1 = crq1->request->sector; |
@@ -477,7 +454,7 @@ static inline void cfq_del_crq_rb(struct cfq_rq *crq) | |||
477 | { | 454 | { |
478 | struct cfq_queue *cfqq = crq->cfq_queue; | 455 | struct cfq_queue *cfqq = crq->cfq_queue; |
479 | struct cfq_data *cfqd = cfqq->cfqd; | 456 | struct cfq_data *cfqd = cfqq->cfqd; |
480 | const int sync = cfq_crq_is_sync(crq); | 457 | const int sync = rq_is_sync(crq->request); |
481 | 458 | ||
482 | BUG_ON(!cfqq->queued[sync]); | 459 | BUG_ON(!cfqq->queued[sync]); |
483 | cfqq->queued[sync]--; | 460 | cfqq->queued[sync]--; |
@@ -495,7 +472,7 @@ static void cfq_add_crq_rb(struct cfq_rq *crq) | |||
495 | struct request *rq = crq->request; | 472 | struct request *rq = crq->request; |
496 | struct request *__alias; | 473 | struct request *__alias; |
497 | 474 | ||
498 | cfqq->queued[cfq_crq_is_sync(crq)]++; | 475 | cfqq->queued[rq_is_sync(rq)]++; |
499 | 476 | ||
500 | /* | 477 | /* |
501 | * looks a little odd, but the first insert might return an alias. | 478 | * looks a little odd, but the first insert might return an alias. |
@@ -508,8 +485,10 @@ static void cfq_add_crq_rb(struct cfq_rq *crq) | |||
508 | static inline void | 485 | static inline void |
509 | cfq_reposition_crq_rb(struct cfq_queue *cfqq, struct cfq_rq *crq) | 486 | cfq_reposition_crq_rb(struct cfq_queue *cfqq, struct cfq_rq *crq) |
510 | { | 487 | { |
511 | elv_rb_del(&cfqq->sort_list, crq->request); | 488 | struct request *rq = crq->request; |
512 | cfqq->queued[cfq_crq_is_sync(crq)]--; | 489 | |
490 | elv_rb_del(&cfqq->sort_list, rq); | ||
491 | cfqq->queued[rq_is_sync(rq)]--; | ||
513 | cfq_add_crq_rb(crq); | 492 | cfq_add_crq_rb(crq); |
514 | } | 493 | } |
515 | 494 | ||
@@ -814,11 +793,11 @@ static void cfq_dispatch_insert(request_queue_t *q, struct cfq_rq *crq) | |||
814 | { | 793 | { |
815 | struct cfq_data *cfqd = q->elevator->elevator_data; | 794 | struct cfq_data *cfqd = q->elevator->elevator_data; |
816 | struct cfq_queue *cfqq = crq->cfq_queue; | 795 | struct cfq_queue *cfqq = crq->cfq_queue; |
817 | struct request *rq; | 796 | struct request *rq = crq->request; |
818 | 797 | ||
819 | cfq_remove_request(crq->request); | 798 | cfq_remove_request(rq); |
820 | cfqq->on_dispatch[cfq_crq_is_sync(crq)]++; | 799 | cfqq->on_dispatch[rq_is_sync(rq)]++; |
821 | elv_dispatch_sort(q, crq->request); | 800 | elv_dispatch_sort(q, rq); |
822 | 801 | ||
823 | rq = list_entry(q->queue_head.prev, struct request, queuelist); | 802 | rq = list_entry(q->queue_head.prev, struct request, queuelist); |
824 | cfqd->last_sector = rq->sector + rq->nr_sectors; | 803 | cfqd->last_sector = rq->sector + rq->nr_sectors; |
@@ -1585,7 +1564,7 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq, | |||
1585 | */ | 1564 | */ |
1586 | if (new_cfqq->slice_left < cfqd->cfq_slice_idle) | 1565 | if (new_cfqq->slice_left < cfqd->cfq_slice_idle) |
1587 | return 0; | 1566 | return 0; |
1588 | if (cfq_crq_is_sync(crq) && !cfq_cfqq_sync(cfqq)) | 1567 | if (rq_is_sync(crq->request) && !cfq_cfqq_sync(cfqq)) |
1589 | return 1; | 1568 | return 1; |
1590 | 1569 | ||
1591 | return 0; | 1570 | return 0; |
@@ -1634,7 +1613,7 @@ cfq_crq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
1634 | struct cfq_io_context *cic = crq->io_context; | 1613 | struct cfq_io_context *cic = crq->io_context; |
1635 | 1614 | ||
1636 | /* | 1615 | /* |
1637 | * check if this request is a better next-serve candidate | 1616 | * check if this request is a better next-serve candidate)) { |
1638 | */ | 1617 | */ |
1639 | cfqq->next_crq = cfq_choose_req(cfqd, cfqq->next_crq, crq); | 1618 | cfqq->next_crq = cfq_choose_req(cfqd, cfqq->next_crq, crq); |
1640 | BUG_ON(!cfqq->next_crq); | 1619 | BUG_ON(!cfqq->next_crq); |
@@ -1643,7 +1622,7 @@ cfq_crq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
1643 | * we never wait for an async request and we don't allow preemption | 1622 | * we never wait for an async request and we don't allow preemption |
1644 | * of an async request. so just return early | 1623 | * of an async request. so just return early |
1645 | */ | 1624 | */ |
1646 | if (!cfq_crq_is_sync(crq)) { | 1625 | if (!rq_is_sync(crq->request)) { |
1647 | /* | 1626 | /* |
1648 | * sync process issued an async request, if it's waiting | 1627 | * sync process issued an async request, if it's waiting |
1649 | * then expire it and kick rq handling. | 1628 | * then expire it and kick rq handling. |
@@ -1709,7 +1688,7 @@ static void cfq_completed_request(request_queue_t *q, struct request *rq) | |||
1709 | struct cfq_rq *crq = RQ_DATA(rq); | 1688 | struct cfq_rq *crq = RQ_DATA(rq); |
1710 | struct cfq_queue *cfqq = crq->cfq_queue; | 1689 | struct cfq_queue *cfqq = crq->cfq_queue; |
1711 | struct cfq_data *cfqd = cfqq->cfqd; | 1690 | struct cfq_data *cfqd = cfqq->cfqd; |
1712 | const int sync = cfq_crq_is_sync(crq); | 1691 | const int sync = rq_is_sync(rq); |
1713 | unsigned long now; | 1692 | unsigned long now; |
1714 | 1693 | ||
1715 | now = jiffies; | 1694 | now = jiffies; |
@@ -1905,11 +1884,6 @@ cfq_set_request(request_queue_t *q, struct request *rq, struct bio *bio, | |||
1905 | crq->cfq_queue = cfqq; | 1884 | crq->cfq_queue = cfqq; |
1906 | crq->io_context = cic; | 1885 | crq->io_context = cic; |
1907 | 1886 | ||
1908 | if (is_sync) | ||
1909 | cfq_mark_crq_is_sync(crq); | ||
1910 | else | ||
1911 | cfq_clear_crq_is_sync(crq); | ||
1912 | |||
1913 | rq->elevator_private = crq; | 1887 | rq->elevator_private = crq; |
1914 | return 0; | 1888 | return 0; |
1915 | } | 1889 | } |