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: WANGHAILIANG <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3818
Community-CI: Broadcom CI
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
WANGHAILIANG 2020-08-17 17:40:47 +08:00 committed by Tomasz Zawadzki
parent 05cd697757
commit ea80818901

View File

@ -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) {