X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=ioengines.c;h=0f94d0d9513da64337bbb23284ebb09001b2ebd9;hp=f4eae04db6df5d072103191f05b187fcb6f19e80;hb=3310fcedbf11916c20aca6cffc20264a6e781e32;hpb=6a5c4d92ce70a05d2fee981b6f133373c0ef62f8 diff --git a/ioengines.c b/ioengines.c index f4eae04d..0f94d0d9 100644 --- a/ioengines.c +++ b/ioengines.c @@ -107,6 +107,20 @@ static struct ioengine_ops *dlopen_ioengine(struct thread_data *td, ops = dlsym(dlhandle, engine_lib); if (!ops) ops = dlsym(dlhandle, "ioengine"); + + /* + * For some external engines (like C++ ones) it is not that trivial + * to provide a non-static ionengine structure that we can reference. + * Instead we call a method which allocates the required ioengine + * structure. + */ + if (!ops) { + get_ioengine_t get_ioengine = dlsym(dlhandle, "get_ioengine"); + + if (get_ioengine) + get_ioengine(&ops); + } + if (!ops) { td_vmsg(td, -1, dlerror(), "dlsym"); dlclose(dlhandle); @@ -287,6 +301,13 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u) unlock_file(td, io_u->file); + /* + * If an error was seen and the io engine didn't propagate it + * back to 'td', do so. + */ + if (io_u->error && !td->error) + td_verror(td, io_u->error, "td_io_queue"); + /* * Add warning for O_DIRECT so that users have an easier time * spotting potentially bad alignment. If this triggers for the first @@ -354,6 +375,9 @@ int td_io_init(struct thread_data *td) td->error = ret; } + if (!ret && (td->io_ops->flags & FIO_NOIO)) + td->flags |= TD_F_NOIO; + return ret; } @@ -475,7 +499,9 @@ int td_io_close_file(struct thread_data *td, struct fio_file *f) fio_file_set_closing(f); disk_util_dec(f->du); - unlock_file_all(td, f); + + if (td->o.file_lock_mode != FILE_LOCK_NONE) + unlock_file_all(td, f); return put_file(td, f); }