Commit df8992df authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I6e97099622d58f44d92482beaf24ca61de4ca038
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478756


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 3b69ae85
Loading
Loading
Loading
Loading
+13 −16
Original line number Diff line number Diff line
@@ -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)