[PATCH] First cut at supporting > 1 file per job
[fio.git] / stat.c
diff --git a/stat.c b/stat.c
index 4cc3b7e92fbe802d80cc10f5baee9d4babfb0dee..e43a336108f0f78c18dcc28d5baf6cd1859b576c 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -156,8 +156,6 @@ static int find_block_dir(dev_t dev, char *path)
 
                if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, ".."))
                        continue;
-               if (!strcmp(dir->d_name, "device"))
-                       continue;
 
                sprintf(full_path, "%s/%s", path, dir->d_name);
 
@@ -168,7 +166,7 @@ static int find_block_dir(dev_t dev, char *path)
                        }
                }
 
-               if (stat(full_path, &st) == -1) {
+               if (lstat(full_path, &st) == -1) {
                        perror("stat");
                        break;
                }
@@ -189,6 +187,7 @@ static int find_block_dir(dev_t dev, char *path)
 
 void init_disk_util(struct thread_data *td)
 {
+       struct fio_file *f;
        struct stat st;
        char foo[256], tmp[256];
        dev_t dev;
@@ -197,7 +196,11 @@ void init_disk_util(struct thread_data *td)
        if (!td->do_disk_util)
                return;
 
-       if (!stat(td->file_name, &st)) {
+       /*
+        * 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;
                else
@@ -206,7 +209,7 @@ void init_disk_util(struct thread_data *td)
                /*
                 * must be a file, open "." in that path
                 */
-               strcpy(foo, td->file_name);
+               strcpy(foo, f->file_name);
                p = dirname(foo);
                if (stat(p, &st)) {
                        perror("disk util stat");