Also add a 'get_next_file' hook while at it.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
#include "iolog.h"
#include "helpers.h"
#include "options.h"
#include "iolog.h"
#include "helpers.h"
#include "options.h"
#ifdef FIO_HAVE_GUASI
#include <guasi.h>
#ifdef FIO_HAVE_GUASI
#include <guasi.h>
/*
* Can be overloaded by profiles
*/
/*
* Can be overloaded by profiles
*/
- int (*fill_io_u_off)(struct thread_data *, struct io_u *);
- int (*fill_io_u_size)(struct thread_data *, struct io_u *);
+ struct prof_io_ops prof_io_ops;
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)
{
- if (td->fill_io_u_off)
- return td->fill_io_u_off(td, io_u);
+ struct prof_io_ops *ops = &td->prof_io_ops;
+
+ if (ops->fill_io_u_off)
+ return ops->fill_io_u_off(td, io_u);
return __get_next_offset(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)
{
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);
+ struct prof_io_ops *ops = &td->prof_io_ops;
+
+ if (ops->fill_io_u_size)
+ return ops->fill_io_u_size(td, io_u);
return __get_next_buflen(td, io_u);
}
return __get_next_buflen(td, io_u);
}
-static struct fio_file *get_next_file(struct thread_data *td)
+static struct fio_file *__get_next_file(struct thread_data *td)
+static struct fio_file *get_next_file(struct thread_data *td)
+{
+ struct prof_io_ops *ops = &td->prof_io_ops;
+
+ if (ops->get_next_file)
+ return ops->get_next_file(td);
+
+ return __get_next_file(td);
+}
+
static int set_io_u_file(struct thread_data *td, struct io_u *io_u)
{
struct fio_file *f;
static int set_io_u_file(struct thread_data *td, struct io_u *io_u)
{
struct fio_file *f;
int found = 0;
int show_all = 0;
int found = 0;
int show_all = 0;
+ printf("exec_profile=%s\n", exec_profile);
+
if (!name || !strcmp(name, "all"))
show_all = 1;
if (!name || !strcmp(name, "all"))
show_all = 1;
- td->fill_io_u_off = ops->fill_io_u_off;
- td->fill_io_u_size = ops->fill_io_u_size;
+ if (ops->io_ops)
+ td->prof_io_ops = *ops->io_ops;
+/*
+ * Functions for overriding internal fio io_u functions
+ */
+struct prof_io_ops {
+ int (*fill_io_u_off)(struct thread_data *, struct io_u *);
+ int (*fill_io_u_size)(struct thread_data *, struct io_u *);
+ struct fio_file *(*get_next_file)(struct thread_data *);
+};
+
struct profile_ops {
struct flist_head list;
char name[32];
struct profile_ops {
struct flist_head list;
char name[32];
- /*
- * Functions for overriding internal fio io_u functions
- */
- int (*fill_io_u_off)(struct thread_data *, struct io_u *);
- int (*fill_io_u_size)(struct thread_data *, struct io_u *);
+ struct prof_io_ops *io_ops;
};
int register_profile(struct profile_ops *);
};
int register_profile(struct profile_ops *);