aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/cfq-iosched.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index a8437042e28a..f089eeecdf32 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -752,7 +752,7 @@ __cfq_set_active_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq)
752 */ 752 */
753static void 753static void
754__cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq, 754__cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq,
755 int preempted, int timed_out) 755 int timed_out)
756{ 756{
757 if (cfq_cfqq_wait_request(cfqq)) 757 if (cfq_cfqq_wait_request(cfqq))
758 del_timer(&cfqd->idle_slice_timer); 758 del_timer(&cfqd->idle_slice_timer);
@@ -761,8 +761,7 @@ __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq,
761 cfq_clear_cfqq_wait_request(cfqq); 761 cfq_clear_cfqq_wait_request(cfqq);
762 762
763 /* 763 /*
764 * store what was left of this slice, if the queue idled out 764 * store what was left of this slice, if the queue idled/timed out
765 * or was preempted
766 */ 765 */
767 if (timed_out && !cfq_cfqq_slice_new(cfqq)) 766 if (timed_out && !cfq_cfqq_slice_new(cfqq))
768 cfqq->slice_resid = cfqq->slice_end - jiffies; 767 cfqq->slice_resid = cfqq->slice_end - jiffies;
@@ -780,13 +779,12 @@ __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq,
780 cfqd->dispatch_slice = 0; 779 cfqd->dispatch_slice = 0;
781} 780}
782 781
783static inline void cfq_slice_expired(struct cfq_data *cfqd, int preempted, 782static inline void cfq_slice_expired(struct cfq_data *cfqd, int timed_out)
784 int timed_out)
785{ 783{
786 struct cfq_queue *cfqq = cfqd->active_queue; 784 struct cfq_queue *cfqq = cfqd->active_queue;
787 785
788 if (cfqq) 786 if (cfqq)
789 __cfq_slice_expired(cfqd, cfqq, preempted, timed_out); 787 __cfq_slice_expired(cfqd, cfqq, timed_out);
790} 788}
791 789
792/* 790/*
@@ -995,7 +993,7 @@ static struct cfq_queue *cfq_select_queue(struct cfq_data *cfqd)
995 } 993 }
996 994
997expire: 995expire:
998 cfq_slice_expired(cfqd, 0, 0); 996 cfq_slice_expired(cfqd, 0);
999new_queue: 997new_queue:
1000 cfqq = cfq_set_active_queue(cfqd); 998 cfqq = cfq_set_active_queue(cfqd);
1001keep_queue: 999keep_queue:
@@ -1049,7 +1047,7 @@ __cfq_dispatch_requests(struct cfq_data *cfqd, struct cfq_queue *cfqq,
1049 cfqd->dispatch_slice >= cfq_prio_to_maxrq(cfqd, cfqq)) || 1047 cfqd->dispatch_slice >= cfq_prio_to_maxrq(cfqd, cfqq)) ||
1050 cfq_class_idle(cfqq))) { 1048 cfq_class_idle(cfqq))) {
1051 cfqq->slice_end = jiffies + 1; 1049 cfqq->slice_end = jiffies + 1;
1052 cfq_slice_expired(cfqd, 0, 0); 1050 cfq_slice_expired(cfqd, 0);
1053 } 1051 }
1054 1052
1055 return dispatched; 1053 return dispatched;
@@ -1083,7 +1081,7 @@ static int cfq_forced_dispatch(struct cfq_data *cfqd)
1083 dispatched += __cfq_forced_dispatch_cfqq(cfqq); 1081 dispatched += __cfq_forced_dispatch_cfqq(cfqq);
1084 } 1082 }
1085 1083
1086 cfq_slice_expired(cfqd, 0, 0); 1084 cfq_slice_expired(cfqd, 0);
1087 1085
1088 BUG_ON(cfqd->busy_queues); 1086 BUG_ON(cfqd->busy_queues);
1089 1087
@@ -1153,7 +1151,7 @@ static void cfq_put_queue(struct cfq_queue *cfqq)
1153 BUG_ON(cfq_cfqq_on_rr(cfqq)); 1151 BUG_ON(cfq_cfqq_on_rr(cfqq));
1154 1152
1155 if (unlikely(cfqd->active_queue == cfqq)) { 1153 if (unlikely(cfqd->active_queue == cfqq)) {
1156 __cfq_slice_expired(cfqd, cfqq, 0, 0); 1154 __cfq_slice_expired(cfqd, cfqq, 0);
1157 cfq_schedule_dispatch(cfqd); 1155 cfq_schedule_dispatch(cfqd);
1158 } 1156 }
1159 1157
@@ -1210,7 +1208,7 @@ static void cfq_free_io_context(struct io_context *ioc)
1210static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq) 1208static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq)
1211{ 1209{
1212 if (unlikely(cfqq == cfqd->active_queue)) { 1210 if (unlikely(cfqq == cfqd->active_queue)) {
1213 __cfq_slice_expired(cfqd, cfqq, 0, 0); 1211 __cfq_slice_expired(cfqd, cfqq, 0);
1214 cfq_schedule_dispatch(cfqd); 1212 cfq_schedule_dispatch(cfqd);
1215 } 1213 }
1216 1214
@@ -1683,7 +1681,7 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
1683 */ 1681 */
1684static void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq) 1682static void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq)
1685{ 1683{
1686 cfq_slice_expired(cfqd, 1, 1); 1684 cfq_slice_expired(cfqd, 1);
1687 1685
1688 /* 1686 /*
1689 * Put the new queue at the front of the of the current list, 1687 * Put the new queue at the front of the of the current list,
@@ -1784,7 +1782,7 @@ static void cfq_completed_request(request_queue_t *q, struct request *rq)
1784 cfq_clear_cfqq_slice_new(cfqq); 1782 cfq_clear_cfqq_slice_new(cfqq);
1785 } 1783 }
1786 if (cfq_slice_used(cfqq)) 1784 if (cfq_slice_used(cfqq))
1787 cfq_slice_expired(cfqd, 0, 1); 1785 cfq_slice_expired(cfqd, 1);
1788 else if (sync && RB_EMPTY_ROOT(&cfqq->sort_list)) 1786 else if (sync && RB_EMPTY_ROOT(&cfqq->sort_list))
1789 cfq_arm_slice_timer(cfqd); 1787 cfq_arm_slice_timer(cfqd);
1790 } 1788 }
@@ -1979,7 +1977,7 @@ static void cfq_idle_slice_timer(unsigned long data)
1979 } 1977 }
1980 } 1978 }
1981expire: 1979expire:
1982 cfq_slice_expired(cfqd, 0, timed_out); 1980 cfq_slice_expired(cfqd, timed_out);
1983out_kick: 1981out_kick:
1984 cfq_schedule_dispatch(cfqd); 1982 cfq_schedule_dispatch(cfqd);
1985out_cont: 1983out_cont:
@@ -2025,7 +2023,7 @@ static void cfq_exit_queue(elevator_t *e)
2025 spin_lock_irq(q->queue_lock); 2023 spin_lock_irq(q->queue_lock);
2026 2024
2027 if (cfqd->active_queue) 2025 if (cfqd->active_queue)
2028 __cfq_slice_expired(cfqd, cfqd->active_queue, 0, 0); 2026 __cfq_slice_expired(cfqd, cfqd->active_queue, 0);
2029 2027
2030 while (!list_empty(&cfqd->cic_list)) { 2028 while (!list_empty(&cfqd->cic_list)) {
2031 struct cfq_io_context *cic = list_entry(cfqd->cic_list.next, 2029 struct cfq_io_context *cic = list_entry(cfqd->cic_list.next,