X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=diskutil.c;h=4fe554f561af20919434fcbdeef4cfd66e8dd0f9;hp=27ddb46b7fecdae75114874210ed2ae135d21bd6;hb=e40e581c9c845d1c95804665bc5c0ab820327ef8;hpb=81b3c86f086cb2340d1c5596202a307487216b21 diff --git a/diskutil.c b/diskutil.c index 27ddb46b..4fe554f5 100644 --- a/diskutil.c +++ b/diskutil.c @@ -18,8 +18,6 @@ static struct disk_util *last_du; static struct fio_mutex *disk_util_mutex; -FLIST_HEAD(disk_list); - static struct disk_util *__init_per_file_disk_util(struct thread_data *td, int majdev, int mindev, char *path); @@ -37,6 +35,7 @@ static void disk_util_free(struct disk_util *du) } fio_mutex_remove(du->lock); + free(du->sysfs_root); sfree(du); } @@ -85,7 +84,7 @@ static int get_io_ticks(struct disk_util *du, struct disk_util_stat *dus) static void update_io_tick_disk(struct disk_util *du) { struct disk_util_stat __dus, *dus, *ldus; - struct timeval t; + struct timespec t; if (!du->users) return; @@ -305,7 +304,7 @@ static struct disk_util *disk_util_add(struct thread_data *td, int majdev, return NULL; } strncpy((char *) du->dus.name, basename(path), FIO_DU_NAME_SZ - 1); - du->sysfs_root = path; + du->sysfs_root = strdup(path); du->major = majdev; du->minor = mindev; INIT_FLIST_HEAD(&du->slavelist); @@ -364,7 +363,7 @@ static int find_block_dir(int majdev, int mindev, char *path, int link_ok) return 0; while ((dir = readdir(D)) != NULL) { - char full_path[256]; + char full_path[257]; if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, "..")) continue; @@ -430,9 +429,6 @@ static struct disk_util *__init_per_file_disk_util(struct thread_data *td, sprintf(path, "%s", tmp); } - if (td->o.ioscheduler && !td->sysfs_root) - td->sysfs_root = strdup(path); - return disk_util_add(td, majdev, mindev, path); } @@ -451,12 +447,8 @@ static struct disk_util *init_per_file_disk_util(struct thread_data *td, mindev); du = disk_util_exists(majdev, mindev); - if (du) { - if (td->o.ioscheduler && !td->sysfs_root) - td->sysfs_root = strdup(du->sysfs_root); - + if (du) return du; - } /* * for an fs without a device, we will repeatedly stat through