From 1188caf84ba7fb6c2b3955ad67f4bf087ede13fd Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 8 Jan 2007 10:57:27 +0100 Subject: [PATCH 1/1] [PATCH] Add extra disk util name check If it's the same device name, don't print utilization more than once. Signed-off-by: Jens Axboe --- stat.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/stat.c b/stat.c index 068aa923..a84f28a5 100644 --- a/stat.c +++ b/stat.c @@ -94,14 +94,26 @@ static int disk_util_exists(dev_t dev) static void disk_util_add(dev_t dev, char *path) { - struct disk_util *du = malloc(sizeof(*du)); + struct disk_util *du, *__du; + struct list_head *entry; + du = malloc(sizeof(*du)); memset(du, 0, sizeof(*du)); INIT_LIST_HEAD(&du->list); sprintf(du->path, "%s/stat", path); du->name = strdup(basename(path)); du->dev = dev; + list_for_each(entry, &disk_list) { + __du = list_entry(entry, struct disk_util, list); + + if (!strcmp(du->name, __du->name)) { + free(du->name); + free(du); + return; + } + } + fio_gettime(&du->time, NULL); get_io_ticks(du, &du->last_dus); -- 2.25.1