Now we can have files all over the place, so we need to loop
over td->files[] to setup disk util stats.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-void init_disk_util(struct thread_data *td)
+static void __init_disk_util(struct thread_data *td, struct fio_file *f)
struct stat st;
char foo[PATH_MAX], tmp[PATH_MAX];
dev_t dev;
char *p;
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;
if (!stat(f->file_name, &st)) {
if (S_ISBLK(st.st_mode))
dev = st.st_rdev;
sprintf(foo, "%s", tmp);
}
sprintf(foo, "%s", tmp);
}
+ if (td->ioscheduler && !td->sysfs_root)
td->sysfs_root = strdup(foo);
disk_util_add(dev, foo);
}
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;
void disk_util_timer_arm(void)
{
itimer.it_value.tv_sec = 0;