bdevperf: Change break to continue in some for loops

Number of entries of the array g_head is spdk_env_get_core_count(),
and hence we did not need to break from some for loops.  For them,
continue to the next iteration will be more appropriate and do the
changes in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I6e97099622d58f44d92482beaf24ca61de4ca038
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478756
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-12-23 17:18:26 -05:00 committed by Tomasz Zawadzki
parent 3b69ae8596
commit df8992dfb1

View File

@ -1093,9 +1093,6 @@ bdevperf_construct_targets_tasks(void)
/* Initialize task list for each target */
for (i = 0; i < spdk_env_get_core_count(); i++) {
target = g_head[i];
if (!target) {
break;
}
while (target != NULL) {
for (j = 0; j < task_num; j++) {
task = bdevperf_construct_task_on_target(target);
@ -1285,13 +1282,12 @@ bdevperf_test(void)
/* Send events to start all I/O */
for (i = 0; i < core_count; i++) {
target = g_head[i];
if (target == NULL) {
return -1;
}
if (target != NULL) {
event = spdk_event_allocate(target->lcore, bdevperf_submit_on_core,
target, NULL);
spdk_event_call(event);
}
}
return 0;
}
@ -1354,22 +1350,23 @@ spdk_bdevperf_shutdown_cb(void)
return;
}
if (g_head == NULL) {
spdk_app_stop(0);
return;
}
g_shutdown_tsc = spdk_get_ticks() - g_shutdown_tsc;
/* Send events to stop all I/O on each core */
for (i = 0; i < spdk_env_get_core_count(); i++) {
if (g_head == NULL) {
break;
}
target = g_head[i];
if (target == NULL) {
break;
}
if (target != NULL) {
event = spdk_event_allocate(target->lcore, bdevperf_stop_io_on_core,
target, NULL);
spdk_event_call(event);
}
}
}
static int
bdevperf_parse_arg(int ch, char *arg)