diff options
Diffstat (limited to 'block/cfq-iosched.c')
| -rw-r--r-- | block/cfq-iosched.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index ee55019066a1..d0ba50533668 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
| @@ -1699,18 +1699,11 @@ static int cfq_allow_merge(struct request_queue *q, struct request *rq, | |||
| 1699 | 1699 | ||
| 1700 | /* | 1700 | /* |
| 1701 | * Lookup the cfqq that this bio will be queued with and allow | 1701 | * Lookup the cfqq that this bio will be queued with and allow |
| 1702 | * merge only if rq is queued there. This function can be called | 1702 | * merge only if rq is queued there. |
| 1703 | * from plug merge without queue_lock. In such cases, ioc of @rq | ||
| 1704 | * and %current are guaranteed to be equal. Avoid lookup which | ||
| 1705 | * requires queue_lock by using @rq's cic. | ||
| 1706 | */ | 1703 | */ |
| 1707 | if (current->io_context == RQ_CIC(rq)->icq.ioc) { | 1704 | cic = cfq_cic_lookup(cfqd, current->io_context); |
| 1708 | cic = RQ_CIC(rq); | 1705 | if (!cic) |
| 1709 | } else { | 1706 | return false; |
| 1710 | cic = cfq_cic_lookup(cfqd, current->io_context); | ||
| 1711 | if (!cic) | ||
| 1712 | return false; | ||
| 1713 | } | ||
| 1714 | 1707 | ||
| 1715 | cfqq = cic_to_cfqq(cic, cfq_bio_sync(bio)); | 1708 | cfqq = cic_to_cfqq(cic, cfq_bio_sync(bio)); |
| 1716 | return cfqq == RQ_CFQQ(rq); | 1709 | return cfqq == RQ_CFQQ(rq); |
| @@ -1794,7 +1787,7 @@ __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
| 1794 | cfqd->active_queue = NULL; | 1787 | cfqd->active_queue = NULL; |
| 1795 | 1788 | ||
| 1796 | if (cfqd->active_cic) { | 1789 | if (cfqd->active_cic) { |
| 1797 | put_io_context(cfqd->active_cic->icq.ioc, cfqd->queue); | 1790 | put_io_context(cfqd->active_cic->icq.ioc); |
| 1798 | cfqd->active_cic = NULL; | 1791 | cfqd->active_cic = NULL; |
| 1799 | } | 1792 | } |
| 1800 | } | 1793 | } |
| @@ -3117,17 +3110,18 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq, | |||
| 3117 | */ | 3110 | */ |
| 3118 | static void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq) | 3111 | static void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq) |
| 3119 | { | 3112 | { |
| 3113 | enum wl_type_t old_type = cfqq_type(cfqd->active_queue); | ||
| 3114 | |||
| 3120 | cfq_log_cfqq(cfqd, cfqq, "preempt"); | 3115 | cfq_log_cfqq(cfqd, cfqq, "preempt"); |
| 3116 | cfq_slice_expired(cfqd, 1); | ||
| 3121 | 3117 | ||
| 3122 | /* | 3118 | /* |
| 3123 | * workload type is changed, don't save slice, otherwise preempt | 3119 | * workload type is changed, don't save slice, otherwise preempt |
| 3124 | * doesn't happen | 3120 | * doesn't happen |
| 3125 | */ | 3121 | */ |
| 3126 | if (cfqq_type(cfqd->active_queue) != cfqq_type(cfqq)) | 3122 | if (old_type != cfqq_type(cfqq)) |
| 3127 | cfqq->cfqg->saved_workload_slice = 0; | 3123 | cfqq->cfqg->saved_workload_slice = 0; |
| 3128 | 3124 | ||
| 3129 | cfq_slice_expired(cfqd, 1); | ||
| 3130 | |||
| 3131 | /* | 3125 | /* |
| 3132 | * Put the new queue at the front of the of the current list, | 3126 | * Put the new queue at the front of the of the current list, |
| 3133 | * so we know that it will be selected next. | 3127 | * so we know that it will be selected next. |
