bdevperf: use uint64_t to save per-job length
When specifying -C for multithread mode, we calculate a 'blocks_per_job' to tell each core what subset of the bdev it should target with I/O. But this blocks_per_job, and the config->length member that it gets copied to, were ints. For devices with num blocks > INT32_MAX, this can cause overflow if the num blocks is also < UINT32_MAX (because then we end up storing a negative value in the bdevperf's length field). For sequential workloads, it may take a long time until it happens, but for random workloads it fails almost immediately. Fixes issue #2108. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I6c2b787ab5d3c6bfe12efd183ce86d4d95f9b6c6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9231 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Ziye Yang <ziye.yang@intel.com> Reviewed-by: Dong Yi <dongx.yi@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
8b21208129
commit
c9268075ab
@ -175,7 +175,7 @@ struct job_config {
|
|||||||
int iodepth;
|
int iodepth;
|
||||||
int rwmixread;
|
int rwmixread;
|
||||||
int64_t offset;
|
int64_t offset;
|
||||||
int length;
|
uint64_t length;
|
||||||
enum job_config_rw rw;
|
enum job_config_rw rw;
|
||||||
TAILQ_ENTRY(job_config) link;
|
TAILQ_ENTRY(job_config) link;
|
||||||
};
|
};
|
||||||
@ -1486,7 +1486,7 @@ bdevperf_construct_config_jobs(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
make_cli_job_config(const char *filename, int64_t offset, int range)
|
make_cli_job_config(const char *filename, int64_t offset, uint64_t range)
|
||||||
{
|
{
|
||||||
struct job_config *config = calloc(1, sizeof(*config));
|
struct job_config *config = calloc(1, sizeof(*config));
|
||||||
|
|
||||||
@ -1519,7 +1519,7 @@ bdevperf_construct_multithread_jobs(void)
|
|||||||
struct spdk_bdev *bdev;
|
struct spdk_bdev *bdev;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t num_cores;
|
uint32_t num_cores;
|
||||||
uint32_t blocks_per_job;
|
uint64_t blocks_per_job;
|
||||||
int64_t offset;
|
int64_t offset;
|
||||||
|
|
||||||
num_cores = 0;
|
num_cores = 0;
|
||||||
@ -1698,6 +1698,7 @@ read_job_config(void)
|
|||||||
const char *rw;
|
const char *rw;
|
||||||
bool is_global;
|
bool is_global;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
int val;
|
||||||
|
|
||||||
if (g_bdevperf_conf_file == NULL) {
|
if (g_bdevperf_conf_file == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -1813,10 +1814,11 @@ read_job_config(void)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
config->length = parse_uint_option(s, "length", global_config.length);
|
val = parse_uint_option(s, "length", global_config.length);
|
||||||
if (config->length == BDEVPERF_CONFIG_ERROR) {
|
if (val == BDEVPERF_CONFIG_ERROR) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
config->length = val;
|
||||||
|
|
||||||
rw = spdk_conf_section_get_val(s, "rw");
|
rw = spdk_conf_section_get_val(s, "rw");
|
||||||
config->rw = parse_rw(rw, global_config.rw);
|
config->rw = parse_rw(rw, global_config.rw);
|
||||||
|
Loading…
Reference in New Issue
Block a user