Allow profiles to override internal io_u functions
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index 1845d3b81e09437d3fc7bc95ba3d366da9d73006..278d47a4d88baaf30e8a4c0bfeaff9a8e128dd87 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -187,7 +187,7 @@ static int get_next_rand_offset(struct thread_data *td, struct fio_file *f,
  * until we find a free one. For sequential io, just return the end of
  * the last io issued.
  */
-static int get_next_offset(struct thread_data *td, struct io_u *io_u)
+static int __get_next_offset(struct thread_data *td, struct io_u *io_u)
 {
        struct fio_file *f = io_u->file;
        unsigned long long b;
@@ -231,7 +231,15 @@ static int get_next_offset(struct thread_data *td, struct io_u *io_u)
        return 0;
 }
 
-static unsigned int get_next_buflen(struct thread_data *td, struct io_u *io_u)
+static int get_next_offset(struct thread_data *td, struct io_u *io_u)
+{
+       if (td->fill_io_u_off)
+               return td->fill_io_u_off(td, io_u);
+
+       return __get_next_offset(td, io_u);
+}
+
+static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u)
 {
        const int ddir = io_u->ddir;
        unsigned int uninitialized_var(buflen);
@@ -276,6 +284,14 @@ static unsigned int get_next_buflen(struct thread_data *td, struct io_u *io_u)
        return buflen;
 }
 
+static unsigned int get_next_buflen(struct thread_data *td, struct io_u *io_u)
+{
+       if (td->fill_io_u_size)
+               return td->fill_io_u_size(td, io_u);
+
+       return __get_next_buflen(td, io_u);
+}
+
 static void set_rwmix_bytes(struct thread_data *td)
 {
        unsigned int diff;