Commit 32b2d78a authored by Vitaliy Mysak's avatar Vitaliy Mysak Committed by Tomasz Zawadzki
Browse files

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: default avatarVitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3509


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
parent b18c8458
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -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;