When the iodepth is greater then 1 some io_us in fio_gf_io_u_init() can
be fooled into thinking their .engine_data has already been set when it
hasn't. This happens because .index and .engine_data are part of the
same union and .index can be set to non-zero values:
static int init_io_u(struct thread_data *td)
...
for (i = 0; i < max_units; i++) {
...
io_u->index = i;
...
if (td->io_ops->io_u_init) {
int ret = td->io_ops->io_u_init(td, io_u);
which means io_u->engine_data != 0 in fio_gf_io_u_init().
Fix the issue by removing the initial check of io_u->engine_data.
Signed-off-by: Simon Gao <simon29rock@gmail.com>
static int fio_gf_io_u_init(struct thread_data *td, struct io_u *io_u)
{
+ struct fio_gf_iou *io;
dprint(FD_FILE, "%s\n", __FUNCTION__);
-
- if (!io_u->engine_data) {
- struct fio_gf_iou *io;
-
- io = malloc(sizeof(struct fio_gf_iou));
- if (!io) {
- td_verror(td, errno, "malloc");
- return 1;
- }
- io->io_complete = 0;
- io->io_u = io_u;
- io_u->engine_data = io;
- }
+
+ io = malloc(sizeof(struct fio_gf_iou));
+ if (!io) {
+ td_verror(td, errno, "malloc");
+ return 1;
+ }
+ io->io_complete = 0;
+ io->io_u = io_u;
+ io_u->engine_data = io;
return 0;
}