diff --git a/examples/bdev/fio_plugin/fio_plugin.c b/examples/bdev/fio_plugin/fio_plugin.c index 562dbb12f..7e435310f 100644 --- a/examples/bdev/fio_plugin/fio_plugin.c +++ b/examples/bdev/fio_plugin/fio_plugin.c @@ -66,6 +66,7 @@ struct spdk_fio_options { void *pad; char *conf; char *json_conf; + char *log_flags; unsigned mem_mb; int mem_single_seg; int initial_zone_reset; @@ -286,6 +287,21 @@ spdk_init_thread_poll(void *arg) } spdk_unaffinitize_thread(); + if (eo->log_flags) { + char *tok = strtok(eo->log_flags, ","); + do { + rc = spdk_log_set_flag(tok); + if (rc < 0) { + SPDK_ERRLOG("unknown spdk log flag %s\n", tok); + rc = EINVAL; + goto err_exit; + } + } while ((tok = strtok(NULL, ",")) != NULL); +#ifdef DEBUG + spdk_log_set_print_level(SPDK_LOG_DEBUG); +#endif + } + spdk_thread_lib_init(NULL, 0); /* Create an SPDK thread temporarily */ @@ -1198,6 +1214,15 @@ static struct fio_option options[] = { .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_INVALID, }, + { + .name = "log_flags", + .lname = "log flags", + .type = FIO_OPT_STR_STORE, + .off1 = offsetof(struct spdk_fio_options, log_flags), + .help = "SPDK log flags to enable", + .category = FIO_OPT_C_ENGINE, + .group = FIO_OPT_G_INVALID, + }, { .name = "initial_zone_reset", .lname = "Reset Zones on initialization",