diff options
author | Alan D. Brunelle <alan.brunelle@hp.com> | 2009-02-12 08:01:42 -0500 |
---|---|---|
committer | Alan D. Brunelle <alan.brunelle@hp.com> | 2009-02-12 08:01:42 -0500 |
commit | 52481561c1f0cdc6fa76a15d800b2b228fda7877 (patch) | |
tree | 6dcb9e58069b494692e63a476938942e1e197814 | |
parent | 3b552a2d1ff8ecccbbb82668f73d1cb134fca1e9 (diff) | |
download | blktrace-52481561c1f0cdc6fa76a15d800b2b228fda7877.tar.gz blktrace-52481561c1f0cdc6fa76a15d800b2b228fda7877.tar.bz2 |
Cleaned up devs that have no data
Working around an issue with older kernels (pre-2.6.19): remaps did not
include device-from, so the pad field is being used for a device which
never has any Q or Ds done to it (it's an invalid ID). This code removes
all such devices before output processing.
Signed-off-by: Alan D. Brunelle <alan.brunelle@hp.com>
-rw-r--r-- | btt/bt_timeline.c | 2 | ||||
-rw-r--r-- | btt/devs.c | 52 | ||||
-rw-r--r-- | btt/globals.h | 1 |
3 files changed, 37 insertions, 18 deletions
diff --git a/btt/bt_timeline.c b/btt/bt_timeline.c index dda4622..9c6ab94 100644 --- a/btt/bt_timeline.c +++ b/btt/bt_timeline.c @@ -117,6 +117,8 @@ int process(void) io_release(iop); gettimeofday(&tve, NULL); + dip_cleanup(); + if (verbose) { double tps, dt_input = tv2dbl(&tve) - tv2dbl(&tvs); @@ -73,29 +73,33 @@ struct d_info *__dip_find(__u32 device) return NULL; } +void __dip_exit(struct d_info *dip) +{ + list_del(&dip->all_head); + __destroy_heads(dip->heads); + region_exit(&dip->regions); + seeki_exit(dip->seek_handle); + seeki_exit(dip->q2q_handle); + aqd_exit(dip->aqd_handle); + plat_exit(dip->q2d_plat_handle); + plat_exit(dip->q2c_plat_handle); + plat_exit(dip->d2c_plat_handle); + bno_dump_exit(dip->bno_dump_handle); + unplug_hist_exit(dip->unplug_hist_handle); + if (output_all_data) + q2d_release(dip->q2d_priv); + if (dip->pit_fp) + fclose(dip->pit_fp); + free(dip); +} + void dip_exit(void) { - struct d_info *dip; struct list_head *p, *q; list_for_each_safe(p, q, &all_devs) { - dip = list_entry(p, struct d_info, all_head); - - __destroy_heads(dip->heads); - region_exit(&dip->regions); - seeki_exit(dip->seek_handle); - seeki_exit(dip->q2q_handle); - aqd_exit(dip->aqd_handle); - plat_exit(dip->q2d_plat_handle); - plat_exit(dip->q2c_plat_handle); - plat_exit(dip->d2c_plat_handle); - bno_dump_exit(dip->bno_dump_handle); - unplug_hist_exit(dip->unplug_hist_handle); - if (output_all_data) - q2d_release(dip->q2d_priv); - if (dip->pit_fp) - fclose(dip->pit_fp); - free(dip); + struct d_info *dip = list_entry(p, struct d_info, all_head); + __dip_exit(dip); } } @@ -260,3 +264,15 @@ void dip_unplug_tm(__u32 dev, __u64 nios_up) dip->nplugs_t++; } } + +void dip_cleanup(void) +{ + struct list_head *p, *q; + + list_for_each_safe(p, q, &all_devs) { + struct d_info *dip = list_entry(p, struct d_info, all_head); + + if (dip->n_qs == 0 && dip->n_ds == 0) + __dip_exit(dip); + } +} diff --git a/btt/globals.h b/btt/globals.h index 9b73a98..36c30c3 100644 --- a/btt/globals.h +++ b/btt/globals.h @@ -230,6 +230,7 @@ void dip_plug(__u32 dev, double cur_time); void dip_unplug(__u32 dev, double cur_time, __u64 nio_ups); void dip_unplug_tm(__u32 dev, __u64 nio_ups); void dip_exit(void); +void dip_cleanup(void); /* dip_rb.c */ int rb_insert(struct rb_root *root, struct io *iop); |