bdev/fio_plugin: initialize filetype to FIO_TYPE_BLOCK

fio will do certain actions depending on the backing file
type of the target that it runs against.
(E.g. if the zbd code in fio detects that the backing file
is FIO_TYPE_FILE, it will emulate zones inside the regular
file.)

Both SPDK ioengines reuse the filename option to not point
to an actual path exposed by the OS, but to instead point to
a device in the SPDK namespace.

Because of this, the file type detection in fio will fail,
and will always initialize filetype to FIO_TYPE_FILE.
Therefore, the SPDK ioengines will need to initialize
f->filetype themselves.

The SPDK nvme ioengine already initializes f->filetype to
FIO_TYPE_BLOCK unconditionally. Do the same in the SPDK
bdev ioengine.
(Just like in the SPDK nvme ioengine, we also need to call
fio_file_set_size_known(), so that fio generic code does
not try to initialize f->real_file_size.)

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I37df185524ed262cb875105f989685b740b430a3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8328
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Niklas Cassel 2021-06-07 10:46:32 +00:00 committed by Tomasz Zawadzki
parent 5172337d95
commit 1a7a599ba0

View File

@ -492,6 +492,8 @@ spdk_fio_setup(struct thread_data *td)
f->real_file_size = spdk_bdev_get_num_blocks(bdev) *
spdk_bdev_get_block_size(bdev);
f->filetype = FIO_TYPE_BLOCK;
fio_file_set_size_known(f);
rc = spdk_fio_handle_options(td, f, bdev);
if (rc) {