X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=stat.c;h=815e3ae54fd42f01200614db771c5768cf004147;hp=85d55b4ca91e825320c6c3a3ae26938a89a2afc9;hb=55bc7fc003004510d2bd19080668fc3fbea517d5;hpb=1549441cdfecb2c1a4a8b8d494253859d67b4344;ds=sidebyside diff --git a/stat.c b/stat.c index 85d55b4c..815e3ae5 100644 --- a/stat.c +++ b/stat.c @@ -241,22 +241,13 @@ static int find_block_dir(dev_t dev, char *path) return found; } -void init_disk_util(struct thread_data *td) +static void __init_disk_util(struct thread_data *td, struct fio_file *f) { - struct fio_file *f; struct stat st; char foo[PATH_MAX], tmp[PATH_MAX]; dev_t dev; char *p; - if (!td->do_disk_util || - (td->io_ops->flags & (FIO_DISKLESSIO | FIO_NODISKUTIL))) - return; - - /* - * Just use the same file, they are on the same device. - */ - f = &td->files[0]; if (!stat(f->file_name, &st)) { if (S_ISBLK(st.st_mode)) dev = st.st_rdev; @@ -311,12 +302,25 @@ void init_disk_util(struct thread_data *td) sprintf(foo, "%s", tmp); } - if (td->ioscheduler) + if (td->ioscheduler && !td->sysfs_root) td->sysfs_root = strdup(foo); disk_util_add(dev, foo); } +void init_disk_util(struct thread_data *td) +{ + struct fio_file *f; + unsigned int i; + + if (!td->do_disk_util || + (td->io_ops->flags & (FIO_DISKLESSIO | FIO_NODISKUTIL))) + return; + + for_each_file(td, f, i) + __init_disk_util(td, f); +} + void disk_util_timer_arm(void) { itimer.it_value.tv_sec = 0;