diff --git a/examples/bdev/fio_plugin/README.md b/examples/bdev/fio_plugin/README.md index ee9519926..7794cd539 100644 --- a/examples/bdev/fio_plugin/README.md +++ b/examples/bdev/fio_plugin/README.md @@ -94,6 +94,9 @@ state at any point in time. It is very important to not exceed this limit. You can control how many zones fio will keep in an open state by using the ``--max_open_zones`` option. +If you use a fio version newer than 3.26, fio will automatically detect and set the proper value. +If you use an old version of fio, make sure to provide the proper --max_open_zones value yourself. + ## Maximum Active Zones Zoned block devices may also have a resource constraint on the number of zones that can be active at diff --git a/examples/bdev/fio_plugin/fio_plugin.c b/examples/bdev/fio_plugin/fio_plugin.c index fba1ea2dd..2ce5c8104 100644 --- a/examples/bdev/fio_plugin/fio_plugin.c +++ b/examples/bdev/fio_plugin/fio_plugin.c @@ -1067,6 +1067,24 @@ spdk_fio_reset_wp(struct thread_data *td, struct fio_file *f, uint64_t offset, u } #endif +#if FIO_IOOPS_VERSION >= 30 +static int spdk_fio_get_max_open_zones(struct thread_data *td, struct fio_file *f, + unsigned int *max_open_zones) +{ + struct spdk_bdev *bdev; + + bdev = spdk_bdev_get_by_name(f->file_name); + if (!bdev) { + SPDK_ERRLOG("Cannot get max open zones, no bdev with name: %s\n", f->file_name); + return -ENODEV; + } + + *max_open_zones = spdk_bdev_get_max_open_zones(bdev); + + return 0; +} +#endif + static int spdk_fio_handle_options(struct thread_data *td, struct fio_file *f, struct spdk_bdev *bdev) { @@ -1203,6 +1221,9 @@ struct ioengine_ops ioengine = { .get_zoned_model = spdk_fio_get_zoned_model, .report_zones = spdk_fio_report_zones, .reset_wp = spdk_fio_reset_wp, +#endif +#if FIO_IOOPS_VERSION >= 30 + .get_max_open_zones = spdk_fio_get_max_open_zones, #endif .option_struct_size = sizeof(struct spdk_fio_options), .options = options,