From 6335d88c8a4dc010346f30ec7102f11a5472f3c0 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Thu, 4 May 2023 15:48:33 +0000 Subject: [PATCH] fio: set FIO_DISKLESSIO flag for spdk engines This tells fio to not try to use POSIX calls on "files" specified for an SPDK engine. Note that w/o DISKLESSIO option set, fio would figure out that "*" wasn't a real file. With this option set, we now need to explicitly set its real_file_size to 0 to tell fio to ignore it. Found by Karol Latecki - he noticed that when specifying lvols in the form "lvs/lvol" that fio would create an empty "lvs" directory. Adding this flag prevents things like this from happening. Signed-off-by: Jim Harris Change-Id: I5d457631b122ba5eb480813ab9d8aa6578f38277 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17937 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Konrad Sztyber Reviewed-by: Shuhei Matsumoto --- examples/bdev/fio_plugin/fio_plugin.c | 6 +++++- examples/nvme/fio_plugin/fio_plugin.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/bdev/fio_plugin/fio_plugin.c b/examples/bdev/fio_plugin/fio_plugin.c index fe56aef04..e6b48e5be 100644 --- a/examples/bdev/fio_plugin/fio_plugin.c +++ b/examples/bdev/fio_plugin/fio_plugin.c @@ -619,6 +619,10 @@ spdk_fio_setup_oat(void *_ctx) struct spdk_bdev *bdev; if (strcmp(f->file_name, "*") == 0) { + /* Explicitly set file size to 0 here to make sure fio doesn't try to + * actually send I/O to this "*" file. + */ + f->real_file_size = 0; continue; } @@ -1436,7 +1440,7 @@ static struct fio_option options[] = { struct ioengine_ops ioengine = { .name = "spdk_bdev", .version = FIO_IOOPS_VERSION, - .flags = FIO_RAWIO | FIO_NOEXTEND | FIO_NODISKUTIL | FIO_MEMALIGN, + .flags = FIO_RAWIO | FIO_NOEXTEND | FIO_NODISKUTIL | FIO_MEMALIGN | FIO_DISKLESSIO, .setup = spdk_fio_setup, .init = spdk_fio_init, /* .prep = unused, */ diff --git a/examples/nvme/fio_plugin/fio_plugin.c b/examples/nvme/fio_plugin/fio_plugin.c index 947937641..45eec47c7 100644 --- a/examples/nvme/fio_plugin/fio_plugin.c +++ b/examples/nvme/fio_plugin/fio_plugin.c @@ -1806,7 +1806,7 @@ struct ioengine_ops ioengine = { #if FIO_HAS_FDP .fdp_fetch_ruhs = spdk_fio_fdp_fetch_ruhs, #endif - .flags = FIO_RAWIO | FIO_NOEXTEND | FIO_NODISKUTIL | FIO_MEMALIGN, + .flags = FIO_RAWIO | FIO_NOEXTEND | FIO_NODISKUTIL | FIO_MEMALIGN | FIO_DISKLESSIO, .options = options, .option_struct_size = sizeof(struct spdk_fio_options), };