X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=block%2Felevator.c;h=e8025b2ec54a508a1bd5db7a23c9ff687e8923b4;hb=0d233681274013a554194ce8e2fe8945cd49979f;hp=39dcccc82ada5b71e3105a8b7e9d8389fc9000b6;hpb=cc918c7ab7da017bfaf9661420bb5c462e057cfb;p=linux-2.6 diff --git a/block/elevator.c b/block/elevator.c index 39dcccc82a..e8025b2ec5 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -64,7 +64,7 @@ inline int elv_rq_merge_ok(struct request *rq, struct bio *bio) } EXPORT_SYMBOL(elv_rq_merge_ok); -inline int elv_try_merge(struct request *__rq, struct bio *bio) +static inline int elv_try_merge(struct request *__rq, struct bio *bio) { int ret = ELEVATOR_NO_MERGE; @@ -80,7 +80,6 @@ inline int elv_try_merge(struct request *__rq, struct bio *bio) return ret; } -EXPORT_SYMBOL(elv_try_merge); static struct elevator_type *elevator_find(const char *name) { @@ -150,6 +149,13 @@ static void elevator_setup_default(void) if (!chosen_elevator[0]) strcpy(chosen_elevator, CONFIG_DEFAULT_IOSCHED); + /* + * Be backwards-compatible with previous kernels, so users + * won't get the wrong elevator. + */ + if (!strcmp(chosen_elevator, "as")) + strcpy(chosen_elevator, "anticipatory"); + /* * If the given scheduler is not available, fall back to no-op. */ @@ -611,23 +617,23 @@ void elv_completed_request(request_queue_t *q, struct request *rq) * request is released from the driver, io must be done */ if (blk_account_rq(rq)) { - struct request *first_rq = list_entry_rq(q->queue_head.next); - q->in_flight--; + if (blk_sorted_rq(rq) && e->ops->elevator_completed_req_fn) + e->ops->elevator_completed_req_fn(q, rq); + } - /* - * Check if the queue is waiting for fs requests to be - * drained for flush sequence. - */ - if (q->ordseq && q->in_flight == 0 && + /* + * Check if the queue is waiting for fs requests to be + * drained for flush sequence. + */ + if (unlikely(q->ordseq)) { + struct request *first_rq = list_entry_rq(q->queue_head.next); + if (q->in_flight == 0 && blk_ordered_cur_seq(q) == QUEUE_ORDSEQ_DRAIN && blk_ordered_req_seq(first_rq) > QUEUE_ORDSEQ_DRAIN) { blk_ordered_complete_seq(q, QUEUE_ORDSEQ_DRAIN, 0); q->request_fn(q); } - - if (blk_sorted_rq(rq) && e->ops->elevator_completed_req_fn) - e->ops->elevator_completed_req_fn(q, rq); } }