Fio 1.20-rc1
[fio.git] / init.c
diff --git a/init.c b/init.c
index e53f103f65bf1f8f6659fe51a2b9d97d1cda72c4..af1798ee22acb95bc8f7155492490af63e093c6e 100644 (file)
--- a/init.c
+++ b/init.c
@@ -17,8 +17,9 @@
 #include "fio.h"
 #include "parse.h"
 #include "smalloc.h"
+#include "filehash.h"
 
-static char fio_version_string[] = "fio 1.19";
+static char fio_version_string[] = "fio 1.20-rc1";
 
 #define FIO_RANDSEED           (0xb1899bedUL)
 
@@ -750,10 +751,13 @@ static void free_shm(void)
 /*
  * The thread area is shared between the main process and the job
  * threads/processes. So setup a shared memory segment that will hold
- * all the job info.
+ * all the job info. We use the end of the region for keeping track of
+ * open files across jobs, for file sharing.
  */
 static int setup_thread_area(void)
 {
+       void *hash;
+
        /*
         * 1024 is too much on some machines, scale max_jobs if
         * we get a failure that looks like too large a shm segment
@@ -761,6 +765,8 @@ static int setup_thread_area(void)
        do {
                size_t size = max_jobs * sizeof(struct thread_data);
 
+               size += file_hash_size;
+
                shm_id = shmget(0, size, IPC_CREAT | 0600);
                if (shm_id != -1)
                        break;
@@ -782,6 +788,8 @@ static int setup_thread_area(void)
        }
 
        memset(threads, 0, max_jobs * sizeof(struct thread_data));
+       hash = (void *) threads + max_jobs * sizeof(struct thread_data);
+       file_hash_init(hash);
        atexit(free_shm);
        return 0;
 }