Commit ea808189 authored by WANGHAILIANG's avatar WANGHAILIANG Committed by Tomasz Zawadzki
Browse files

test/bdevperf: fix an int types for offset which can result in core dumped.



Originally, config->offset was defined as int type.
When the capacity of SSD is very large, such as 8T(P4510),
then bdev->blockcnt2 is 7814037168, config->offset is 3907018584.
At this time, it exceeds the maximum int range of 2147483647 and
becomes a negative number, resulting in core dumped.

Debug info:
config->filename is Nvme1n1.
make_cli_job_config offset is -387948712.
This should be:
config->filename is Nvme1n1.
make_cli_job_config offset is 3907018584.

Change-Id: Ia83d88cc4e56d6c97a6d3fc1a2593b6fc31655b2
Signed-off-by: default avatarWANGHAILIANG <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3818


Community-CI: Broadcom CI
Reviewed-by: default avatarGangCao <gang.cao@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 05cd6977
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ struct job_config {
	int				bs;
	int				iodepth;
	int				rwmixread;
	int				offset;
	int64_t				offset;
	int				length;
	enum job_config_rw		rw;
	TAILQ_ENTRY(job_config)	link;
@@ -1465,7 +1465,7 @@ bdevperf_construct_config_jobs(void)
}

static int
make_cli_job_config(const char *filename, int offset, int range)
make_cli_job_config(const char *filename, int64_t offset, int range)
{
	struct job_config *config = calloc(1, sizeof(*config));

@@ -1499,7 +1499,7 @@ bdevperf_construct_multithread_jobs(void)
	uint32_t i;
	uint32_t num_cores;
	uint32_t blocks_per_job;
	uint32_t offset;
	int64_t offset;

	num_cores = 0;
	SPDK_ENV_FOREACH_CORE(i) {