From 2b3b3233d55f596c8b208161e0c85cb5546baad1 Mon Sep 17 00:00:00 2001 From: Tatyana Brokhman Date: Wed, 4 Sep 2013 22:13:47 +0300 Subject: [PATCH] Revert "block: Add URGENT request notification support to CFQ scheduler" This reverts commit b410a82118cdaa1dc92759e7995c20dcce0d1f1a. The reverted commit was identified as the cause of the FS error mentioned in the CR bellow. It's reverted till further annalists of the root cause of FS error. Change-Id: Ia75216de8012a2491b87f33e8c21f75592d87c80 CRs-fixed: 531257 Signed-off-by: Tatyana Brokhman --- block/blk-core.c | 4 +- block/cfq-iosched.c | 122 -------------------------------------------- block/elevator.c | 1 + 3 files changed, 4 insertions(+), 123 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 40d9b352e2a..123f79a9a9a 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -2058,8 +2058,10 @@ struct request *blk_peek_request(struct request_queue *q) * not be passed by new incoming requests */ rq->cmd_flags |= REQ_STARTED; - if (rq->cmd_flags & REQ_URGENT) + if (rq->cmd_flags & REQ_URGENT) { + WARN_ON(q->dispatched_urgent); q->dispatched_urgent = true; + } trace_block_rq_issue(q, rq); } diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index b4711cbfb49..32629e28a63 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -239,9 +239,6 @@ struct cfq_data { unsigned long workload_expires; struct cfq_group *serving_group; - unsigned int nr_urgent_pending; - unsigned int nr_urgent_in_flight; - /* * Each priority tree is sorted by next_request position. These * trees are used when determining if two or more queues are @@ -2094,14 +2091,6 @@ static void cfq_dispatch_insert(struct request_queue *q, struct request *rq) (RQ_CFQG(rq))->dispatched++; elv_dispatch_sort(q, rq); - if (rq->cmd_flags & REQ_URGENT) { - if (!cfqd->nr_urgent_pending) - WARN_ON(1); - else - cfqd->nr_urgent_pending--; - cfqd->nr_urgent_in_flight++; - } - cfqd->rq_in_flight[cfq_cfqq_sync(cfqq)]++; cfqq->nr_sectors += blk_rq_sectors(rq); cfq_blkiocg_update_dispatch_stats(&cfqq->cfqg->blkg, blk_rq_bytes(rq), @@ -3205,69 +3194,6 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq, } } -/* - * Called when a request (rq) is reinserted (to cfqq). Check if there's - * something we should do about it - */ -static void -cfq_rq_requeued(struct cfq_data *cfqd, struct cfq_queue *cfqq, - struct request *rq) -{ - struct cfq_io_cq *cic = RQ_CIC(rq); - - cfqd->rq_queued++; - if (rq->cmd_flags & REQ_PRIO) - cfqq->prio_pending++; - - cfqq->dispatched--; - (RQ_CFQG(rq))->dispatched--; - - cfqd->rq_in_flight[cfq_cfqq_sync(cfqq)]--; - - cfq_update_io_thinktime(cfqd, cfqq, cic); - cfq_update_io_seektime(cfqd, cfqq, rq); - cfq_update_idle_window(cfqd, cfqq, cic); - - cfqq->last_request_pos = blk_rq_pos(rq) + blk_rq_sectors(rq); - - if (cfqq == cfqd->active_queue) { - if (cfq_cfqq_wait_request(cfqq)) { - if (blk_rq_bytes(rq) > PAGE_CACHE_SIZE || - cfqd->busy_queues > 1) { - cfq_del_timer(cfqd, cfqq); - cfq_clear_cfqq_wait_request(cfqq); - } else { - cfq_blkiocg_update_idle_time_stats( - &cfqq->cfqg->blkg); - cfq_mark_cfqq_must_dispatch(cfqq); - } - } - } else if (cfq_should_preempt(cfqd, cfqq, rq)) { - cfq_preempt_queue(cfqd, cfqq); - } -} - -static int cfq_reinsert_request(struct request_queue *q, struct request *rq) -{ - struct cfq_data *cfqd = q->elevator->elevator_data; - struct cfq_queue *cfqq = RQ_CFQQ(rq); - - if (!cfqq || cfqq->cfqd != cfqd) - return -EIO; - - cfq_log_cfqq(cfqd, cfqq, "re-insert_request"); - list_add(&rq->queuelist, &cfqq->fifo); - cfq_add_rq_rb(rq); - - cfq_rq_requeued(cfqd, cfqq, rq); - if (rq->cmd_flags & REQ_URGENT) { - if (cfqd->nr_urgent_in_flight) - cfqd->nr_urgent_in_flight--; - cfqd->nr_urgent_pending++; - } - return 0; -} - static void cfq_insert_request(struct request_queue *q, struct request *rq) { struct cfq_data *cfqd = q->elevator->elevator_data; @@ -3282,45 +3208,7 @@ static void cfq_insert_request(struct request_queue *q, struct request *rq) cfq_blkiocg_update_io_add_stats(&(RQ_CFQG(rq))->blkg, &cfqd->serving_group->blkg, rq_data_dir(rq), rq_is_sync(rq)); - cfq_rq_enqueued(cfqd, cfqq, rq); - - if (rq->cmd_flags & REQ_URGENT) { - WARN_ON(1); - blk_dump_rq_flags(rq, ""); - rq->cmd_flags &= ~REQ_URGENT; - } - - /* Request is considered URGENT if: - * 1. The queue being served is of a lower IO priority then the new - * request - * OR: - * 2. The workload being performed is ASYNC - * Only READ requests may be considered as URGENT - */ - if ((cfqd->active_queue && - cfqq->ioprio_class < cfqd->active_queue->ioprio_class) || - (cfqd->serving_type == ASYNC_WORKLOAD && - rq_data_dir(rq) == READ)) { - rq->cmd_flags |= REQ_URGENT; - cfqd->nr_urgent_pending++; - } -} - - -/** - * cfq_urgent_pending() - Return TRUE if there is an urgent - * request on scheduler - * @q: requests queue - */ -static bool cfq_urgent_pending(struct request_queue *q) -{ - struct cfq_data *cfqd = q->elevator->elevator_data; - - if (cfqd->nr_urgent_pending && !cfqd->nr_urgent_in_flight) - return true; - - return false; } /* @@ -3404,14 +3292,6 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq) const int sync = rq_is_sync(rq); unsigned long now; - if (rq->cmd_flags & REQ_URGENT) { - if (!cfqd->nr_urgent_in_flight) - WARN_ON(1); - else - cfqd->nr_urgent_in_flight--; - rq->cmd_flags &= ~REQ_URGENT; - } - now = jiffies; cfq_log_cfqq(cfqd, cfqq, "complete rqnoidle %d", !!(rq->cmd_flags & REQ_NOIDLE)); @@ -3979,8 +3859,6 @@ static struct elevator_type iosched_cfq = { .elevator_bio_merged_fn = cfq_bio_merged, .elevator_dispatch_fn = cfq_dispatch_requests, .elevator_add_req_fn = cfq_insert_request, - .elevator_reinsert_req_fn = cfq_reinsert_request, - .elevator_is_urgent_fn = cfq_urgent_pending, .elevator_activate_req_fn = cfq_activate_request, .elevator_deactivate_req_fn = cfq_deactivate_request, .elevator_completed_req_fn = cfq_completed_request, diff --git a/block/elevator.c b/block/elevator.c index 55f1f1e5b2d..44193a8645e 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -842,6 +842,7 @@ void elv_completed_request(struct request_queue *q, struct request *rq) if (rq->cmd_flags & REQ_URGENT) { q->notified_urgent = false; + WARN_ON(!q->dispatched_urgent); q->dispatched_urgent = false; } /*