bdev_fio: add log_flags

Allow user to add something like:

log_flags=app_config,nvme,bdev

to their fio config file to enable log flags.  On
DEBUG builds, setting at least one log flag will
also set the print_level to DEBUG.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I383512e47ad6ea86b8b2c71a212bdc88fadf2f65
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9870
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Jim Harris 2021-10-14 05:01:28 +00:00 committed by Tomasz Zawadzki
parent f01146ae48
commit 1b61d481cc

View File

@ -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",