mmap engine: allow large files on 32-bit archs
[fio.git] / fio.h
diff --git a/fio.h b/fio.h
index 1ccc862e4a59ed455f40ef72fc2d5fad1be67382..2e5431e99a6d21d953617154e2df9538e938dcab 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -135,6 +135,7 @@ struct io_u {
 #ifdef FIO_HAVE_SOLARISAIO
                aio_result_t resultp;
 #endif
+               void *mmap_data;
        };
        struct timeval start_time;
        struct timeval issue_time;
@@ -145,7 +146,6 @@ struct io_u {
        void *buf;
        unsigned long buflen;
        unsigned long long offset;
-       unsigned long long endpos;
 
        /*
         * IO engine state, may be different from above when we get
@@ -314,9 +314,12 @@ struct fio_file {
         * filename and possible memory mapping
         */
        char *file_name;
-       void *mmap;
        unsigned int major, minor;
 
+       void *mmap_ptr;
+       size_t mmap_sz;
+       off_t mmap_off;
+
        /*
         * size of the file, offset into file, and io size from that offset
         */
@@ -343,6 +346,8 @@ struct fio_file {
 
        int references;
        enum fio_file_flags flags;
+
+       struct disk_util *du;
 };
 
 /*
@@ -447,6 +452,7 @@ struct thread_options {
        unsigned int create_fsync;
        unsigned int create_on_open;
        unsigned int end_fsync;
+       unsigned int pre_read;
        unsigned int sync_io;
        unsigned int verify;
        unsigned int do_verify;
@@ -785,8 +791,29 @@ struct disk_util {
 
        unsigned long msec;
        struct timeval time;
+
+       struct fio_mutex *lock;
+       unsigned long users;
 };
 
+static inline void disk_util_inc(struct disk_util *du)
+{
+       if (du) {
+               fio_mutex_down(du->lock);
+               du->users++;
+               fio_mutex_up(du->lock);
+       }
+}
+
+static inline void disk_util_dec(struct disk_util *du)
+{
+       if (du) {
+               fio_mutex_down(du->lock);
+               du->users--;
+               fio_mutex_up(du->lock);
+       }
+}
+
 #define DISK_UTIL_MSEC (250)
 
 /*
@@ -874,6 +901,7 @@ extern int __must_check file_invalidate_cache(struct thread_data *, struct fio_f
 extern int __must_check generic_open_file(struct thread_data *, struct fio_file *);
 extern int __must_check generic_close_file(struct thread_data *, struct fio_file *);
 extern int __must_check generic_get_file_size(struct thread_data *, struct fio_file *);
+extern int __must_check pre_read_files(struct thread_data *);
 extern int add_file(struct thread_data *, const char *);
 extern void get_file(struct fio_file *);
 extern int __must_check put_file(struct thread_data *, struct fio_file *);
@@ -917,6 +945,7 @@ enum {
        TD_INITIALIZED,
        TD_RAMP,
        TD_RUNNING,
+       TD_PRE_READING,
        TD_VERIFYING,
        TD_FSYNCING,
        TD_EXITED,