summaryrefslogtreecommitdiff
path: root/diskutil.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-04-03 16:33:04 -0700
committerJens Axboe <jens.axboe@oracle.com>2007-04-03 16:33:04 -0700
commite11c410cbd60400c10d92d0115880c6e5728aa4e (patch)
treea67f205c1270f623c86ebceaaec66406bf0a01a0 /diskutil.c
parent317b95d07d4921d2594a1be6e014c9c2d062fe75 (diff)
downloadfio-e11c410cbd60400c10d92d0115880c6e5728aa4e.tar.gz
Fix sysfs_root assignment with multiple identical devices
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'diskutil.c')
-rw-r--r--diskutil.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/diskutil.c b/diskutil.c
index 399aced4..a87435af 100644
--- a/diskutil.c
+++ b/diskutil.c
@@ -79,7 +79,7 @@ void update_io_ticks(void)
}
}
-static int disk_util_exists(int major, int minor)
+static struct disk_util *disk_util_exists(int major, int minor)
{
struct list_head *entry;
struct disk_util *du;
@@ -88,10 +88,10 @@ static int disk_util_exists(int major, int minor)
du = list_entry(entry, struct disk_util, list);
if (major == du->major && minor == du->minor)
- return 1;
+ return du;
}
- return 0;
+ return NULL;
}
static void disk_util_add(int majdev, int mindev, char *path)
@@ -104,6 +104,7 @@ static void disk_util_add(int majdev, int mindev, char *path)
INIT_LIST_HEAD(&du->list);
sprintf(du->path, "%s/stat", path);
du->name = strdup(basename(path));
+ du->sysfs_root = path;
du->major = majdev;
du->minor = mindev;
@@ -204,6 +205,7 @@ static void __init_disk_util(struct thread_data *td, struct fio_file *f)
{
struct stat st;
char foo[PATH_MAX], tmp[PATH_MAX];
+ struct disk_util *du;
int mindev, majdev;
char *p;
@@ -234,8 +236,13 @@ static void __init_disk_util(struct thread_data *td, struct fio_file *f)
mindev = minor(st.st_dev);
}
- if (disk_util_exists(majdev, mindev))
+ du = disk_util_exists(majdev, mindev);
+ if (du) {
+ if (td->o.ioscheduler && !td->sysfs_root)
+ td->sysfs_root = strdup(du->sysfs_root);
+
return;
+ }
/*
* for an fs without a device, we will repeatedly stat through