bdevperf: enable multi-core running for less bdevs
If number of bdev is smaller than number of configured cores, the bdevperf tool will exit abnormally. Change-Id: I88e08d1bc71af8b927c701c80f6ddd2bf22c659c Signed-off-by: GangCao <gang.cao@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469669 Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
31e77a7331
commit
a424dcbcc6
@ -113,7 +113,7 @@ struct io_target {
|
||||
|
||||
struct io_target **g_head;
|
||||
uint32_t *g_coremap;
|
||||
static int g_target_count = 0;
|
||||
static uint32_t g_target_count = 0;
|
||||
|
||||
/*
|
||||
* Used to determine how the I/O buffers should be aligned.
|
||||
@ -1252,6 +1252,7 @@ bdevperf_test(void)
|
||||
struct io_target *target;
|
||||
struct spdk_event *event;
|
||||
int rc;
|
||||
uint32_t core_count = spdk_min(g_target_count, spdk_env_get_core_count());
|
||||
|
||||
rc = bdevperf_construct_targets_tasks();
|
||||
if (rc) {
|
||||
@ -1269,7 +1270,7 @@ bdevperf_test(void)
|
||||
}
|
||||
|
||||
/* Send events to start all I/O */
|
||||
for (i = 0; i < spdk_env_get_core_count(); i++) {
|
||||
for (i = 0; i < core_count; i++) {
|
||||
target = g_head[i];
|
||||
if (target == NULL) {
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user