From: Nick Piggin This patch removes ant_stats. Adds some comments where some stats are incremented because they served as nice comments... drivers/block/as-iosched.c | 102 ++++----------------------------------------- 1 files changed, 10 insertions(+), 92 deletions(-) diff -puN drivers/block/as-iosched.c~as-remove-stats drivers/block/as-iosched.c --- 25/drivers/block/as-iosched.c~as-remove-stats 2003-03-24 21:28:33.000000000 -0800 +++ 25-akpm/drivers/block/as-iosched.c 2003-03-24 21:34:05.000000000 -0800 @@ -22,35 +22,6 @@ #include #include -struct ant_stats { - int reads; /* total read requests */ - int writes; /* total write requests */ - int anticipate_starts; - int expired_read_batches; - int expired_write_batches; - int timeouts; - int kblockd_calls; - int anticipate_hits; - int expired_fifo_reads; - int expired_fifo_writes; - int close_requests; - int matching_ids; - int broken_by_write; - int exitted_tasks; - int queued_request; - int dispatched_request; - int big_thinktime; - int bad_ddir; - - int ant_delay_hist[100]; /* milliseconds */ - - /* - * This is a logarithmic (base 2) histogram - */ - int lba_forward_offsets[BITS_PER_LONG]; - int lba_backward_offsets[BITS_PER_LONG]; -} ant_stats; - /* * See Documentation/as-iosched.txt */ @@ -649,8 +620,6 @@ static void as_antic_waitreq(struct as_d { BUG_ON(ad->antic_status == ANTIC_FINISHED); if (ad->antic_status == ANTIC_OFF) { - ant_stats.anticipate_starts++; - if (!ad->as_io_context || ad->aic_finished) as_antic_waitnext(ad); else @@ -684,7 +653,6 @@ static void as_antic_timeout(unsigned lo struct as_data *ad = q->elevator.elevator_data; int status = ad->antic_status; - ant_stats.timeouts++; if (status == ANTIC_WAIT_REQ || status == ANTIC_WAIT_NEXT) { ad->antic_status = ANTIC_FINISHED; kblockd_schedule_work(&ad->antic_work); @@ -735,7 +703,7 @@ static int as_can_break_anticipation(str struct as_io_context *aic; if (rq_data_dir(arq->request) == READ && as_close_req(ad, arq)) { - ant_stats.close_requests++; + /* close request */ return 1; } @@ -744,39 +712,36 @@ static int as_can_break_anticipation(str * In this situation status should really be FINISHED, * however the timer hasn't had the chance to run yet. */ - ant_stats.timeouts++; return 1; } aic = ad->as_io_context; if (aic == arq->as_io_context) { - ant_stats.matching_ids++; - if (rq_data_dir(arq->request) == WRITE) - ant_stats.broken_by_write++; + /* request from same process */ return 1; } if (aic && !test_bit(AS_TASK_RUNNING, &aic->state)) { - ant_stats.exitted_tasks++; + /* process anticipated on has exitted */ return 1; } if (aic && atomic_read(&aic->nr_queued) > 0) { - ant_stats.queued_request++; + /* process has more requests queued */ return 1; } if (aic && atomic_read(&aic->nr_dispatched) > 0) { - ant_stats.dispatched_request++; + /* process has more requests dispatched */ return 1; } if (aic && aic->ttime_mean > ad->antic_expire) { - ant_stats.big_thinktime++; + /* the process thinks too much between requests */ return 1; } if (aic && aic->mean_dir_after_read != READ) { - ant_stats.bad_ddir++; + /* next request from this process will probably be a write */ return 1; } @@ -876,11 +841,6 @@ static void as_update_arq(struct as_data { const int data_dir = rq_data_dir(arq->request); - if (data_dir == READ) - ant_stats.reads++; - else - ant_stats.writes++; - /* keep the next_arq cache up to date */ ad->next_arq[data_dir] = as_choose_req(ad, arq, ad->next_arq[data_dir]); @@ -889,41 +849,10 @@ static void as_update_arq(struct as_data * or does it come from the same process as the one we are anticipating * for? */ - if (ad->batch_data_dir == READ && ad->antic_status != ANTIC_FINISHED - && as_can_break_anticipation(ad, arq)) { - sector_t last = ad->last_sector[data_dir]; - sector_t this = arq->request->sector; - unsigned long delay; - long lba_offset; - int neg; - int log2; - - if (ad->antic_status == ANTIC_WAIT_REQ) - delay = 0; - else - delay = jiffies - ad->antic_start; - - if (data_dir == READ) { - if (delay >= ARRAY_SIZE(ant_stats.ant_delay_hist)) - delay = ARRAY_SIZE(ant_stats.ant_delay_hist)-1; - ant_stats.ant_delay_hist[delay]++; - ant_stats.anticipate_hits++; - - lba_offset = this - last; - neg = 0; - if (lba_offset < 0) { - lba_offset = -lba_offset; - neg = 1; - } - log2 = ffs(lba_offset); - if (neg) - ant_stats.lba_backward_offsets[log2]++; - else - ant_stats.lba_forward_offsets[log2]++; - } - + if (ad->batch_data_dir == READ + && ad->antic_status != ANTIC_FINISHED + && as_can_break_anticipation(ad, arq)) as_antic_stop(ad); - } } /* @@ -1139,13 +1068,6 @@ static int as_dispatch_request(struct as if (!(reads || writes)) return 0; - if (as_batch_expired(ad)) { - if (ad->batch_data_dir == READ) - ant_stats.expired_read_batches++; - else - ant_stats.expired_write_batches++; - } - if (!(reads && writes && as_batch_expired(ad)) ) { /* * batch is still running or no reads or no writes @@ -1217,10 +1139,6 @@ dispatch_request: if (as_fifo_expired(ad, ad->batch_data_dir)) { fifo_expired: - if (ad->batch_data_dir == WRITE) - ant_stats.expired_fifo_writes++; - else - ant_stats.expired_fifo_reads++; arq = list_entry_fifo(ad->fifo_list[ad->batch_data_dir].next); BUG_ON(arq == NULL); } _