From 32b2d78a3ca2b83fadb6c31a7b6d4ec775e1b6b9 Mon Sep 17 00:00:00 2001 From: Vitaliy Mysak Date: Thu, 23 Jul 2020 21:03:36 +0200 Subject: [PATCH] bdevperf: config file: handle 'offset' and 'length' parameters This parameters allow for low cost refactoring because with them we can simplify construct_multithread_jobs() by creating instances of job_config during its invocation and then handling those in construct_config_jobs(). Change-Id: I73057a9a65f58e48ac719f30e918d7a05ffc0f28 Signed-off-by: Vitaliy Mysak Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3509 Tested-by: SPDK CI Jenkins Reviewed-by: Aleksey Marchuk Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris Reviewed-by: Ben Walker Community-CI: Mellanox Build Bot --- test/bdev/bdevperf/bdevperf.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/bdev/bdevperf/bdevperf.c b/test/bdev/bdevperf/bdevperf.c index abed81176..f3cabb4dd 100644 --- a/test/bdev/bdevperf/bdevperf.c +++ b/test/bdev/bdevperf/bdevperf.c @@ -159,6 +159,8 @@ struct job_config { int bs; int iodepth; int rwmixread; + int offset; + int length; TAILQ_ENTRY(job_config) link; }; @@ -1307,7 +1309,7 @@ bdevperf_construct_config_jobs(void) thread = construct_job_thread(&config->cpumask, config->name); assert(thread); - rc = bdevperf_construct_job(bdev, config, thread, 0, 0); + rc = bdevperf_construct_job(bdev, config, thread, config->offset, config->length); if (rc < 0) { g_run_rc = rc; return; @@ -1589,6 +1591,9 @@ read_job_config(void) global_default_config.iodepth = BDEVPERF_CONFIG_UNDEFINED; /* bdevperf has no default for -M option but in FIO the default is 50 */ global_default_config.rwmixread = 50; + global_default_config.offset = 0; + /* length 0 means 100% */ + global_default_config.length = 0; config_set_cli_args(&global_default_config); /* There is only a single instance of global job_config @@ -1656,6 +1661,16 @@ read_job_config(void) goto error; } + config->offset = parse_uint_option(s, "offset", global_config.offset); + if (config->offset == BDEVPERF_CONFIG_ERROR) { + goto error; + } + + config->length = parse_uint_option(s, "length", global_config.length); + if (config->length == BDEVPERF_CONFIG_ERROR) { + goto error; + } + if (is_global) { config_set_cli_args(config); global_config = *config;