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 <vitaliy.mysak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3509
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Vitaliy Mysak 2020-07-23 21:03:36 +02:00 committed by Tomasz Zawadzki
parent b18c845893
commit 32b2d78a3c

View File

@ -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;