Don't malloc/memcpy ioengine_ops on td initialization
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Wed, 27 Jul 2016 13:37:16 +0000 (22:37 +0900)
committerJens Axboe <axboe@fb.com>
Wed, 27 Jul 2016 14:29:45 +0000 (08:29 -0600)
commit565e784df05c2529479eed8a38701a33b01894bd
treeea8982555aa5153a96e4ba159f3dd176ef002883
parent675d2d651cce01e8c18cc6fda8bb44e1d9e405bd
Don't malloc/memcpy ioengine_ops on td initialization

The only reason load_ioengine() needs to malloc extra space for
struct ioengine_ops and memcpy from the original ops is because td
has per-thread/process ioengine private data which is a part of
this structure.

If data (and dlhandle) are separated from struct ioengine_ops,
load_ioengine() no longer needs to malloc, as the rest of structure
fields such as function pointers and string literal are static.
Td only needs a pointer to the original ops. Also avoid memcpying
a list_head from the original ops.

This commit moves/renames data and dlhandle to struct thread_data
as thread_data::io_ops_data and thread_data::io_ops_dlhandle.
engines/*.c which access ioengine private data by dereferencing
td->io_ops->... are modified accordingly, but nothing more than that.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
21 files changed:
engines/binject.c
engines/e4defrag.c
engines/glusterfs.c
engines/glusterfs_async.c
engines/glusterfs_sync.c
engines/guasi.c
engines/libaio.c
engines/libhdfs.c
engines/net.c
engines/null.c
engines/posixaio.c
engines/rbd.c
engines/rdma.c
engines/sg.c
engines/solarisaio.c
engines/splice.c
engines/sync.c
engines/windowsaio.c
fio.h
ioengine.h
ioengines.c