Net engine: missing ->nr_open_files for clients
[fio.git] / stat.c
diff --git a/stat.c b/stat.c
index 34b2b6a5d0ece0024c93b2590b65f4085d6d0593..0ecc1648fd2178ae32e1526211f0bf2ea41fb6db 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -11,6 +11,7 @@
 
 static struct itimerval itimer;
 static struct list_head disk_list = LIST_HEAD_INIT(disk_list);
+static dev_t last_dev;
 
 /*
  * Cheasy number->string conversion, complete with carry rounding error.
@@ -245,7 +246,7 @@ void init_disk_util(struct thread_data *td)
        dev_t dev;
        char *p;
 
-       if (!td->do_disk_util || (td->io_ops->flags & (FIO_NETIO | FIO_NULLIO)))
+       if (!td->do_disk_util || (td->io_ops->flags & FIO_DISKLESSIO))
                return;
 
        /*
@@ -273,6 +274,17 @@ void init_disk_util(struct thread_data *td)
 
        if (disk_util_exists(dev))
                return;
+
+       /*
+        * for an fs without a device, we will repeatedly stat through
+        * sysfs which can take oodles of time for thousands of files. so
+        * cache the last lookup and compare with that before going through
+        * everything again.
+        */
+       if (dev == last_dev)
+               return;
+
+       last_dev = dev;
                
        sprintf(foo, "/sys/block");
        if (!find_block_dir(dev, foo))