Commit 095f4254 authored by Lance Hartmann's avatar Lance Hartmann Committed by Jim Harris
Browse files

lib: Return instead of exit/abort in env_dpdk



Modifies spdk_env_init() and spdk_mem_map_init() such that
they return on failure instead of terminating with exit()
or abort().

Change-Id: I054c1d9b2e46516ff53d845328ab9547f54bdbc4
Signed-off-by: default avatarLance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/393987


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
parent 9014e913
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -31,6 +31,19 @@ callback, the user must call spdk_for_each_channel_continue() to resume iteratio
The poller abstraction was removed from the bdev layer. There is now a general purpose
abstraction for pollers available in include/spdk/io_channel.h

### Lib

A set of changes were made in the SPDK's lib code altering,
instances of calls to `exit()` and `abort()` to return a failure instead
wherever reasonably possible.  This has resulted in return type changes of
the API for:

- spdk_env_init() from type `void` to `int`.
- spdk_mem_map_init() from type `void` to `int`.

Applications making use of these APIs should be modified to check for
a non-zero return value instead of relying on them to fail without return.

### NVMe Driver

SPDK now supports hotplug for vfio-attached devices. But there is one thing keep in mind:
+5 −1
Original line number Diff line number Diff line
@@ -251,7 +251,11 @@ spdk_fio_init_env(struct thread_data *td)
		opts.mem_size = eo->mem_mb;
	}

	spdk_env_init(&opts);
	if (spdk_env_init(&opts) < 0) {
		SPDK_ERRLOG("Unable to initialize SPDK env\n");
		spdk_conf_free(config);
		return -1;
	}
	spdk_unaffinitize_thread();

	/* Create an SPDK thread temporarily */
+3 −1
Original line number Diff line number Diff line
@@ -385,7 +385,9 @@ init(void)
	spdk_env_opts_init(&opts);
	opts.name = "perf";
	opts.core_mask = g_user_config.core_mask;
	spdk_env_init(&opts);
	if (spdk_env_init(&opts) < 0) {
		return -1;
	}

	return 0;
}
+4 −1
Original line number Diff line number Diff line
@@ -385,7 +385,10 @@ init(void)
	spdk_env_opts_init(&opts);
	opts.name = "verify";
	opts.core_mask = g_user_config.core_mask;
	spdk_env_init(&opts);
	if (spdk_env_init(&opts) < 0) {
		fprintf(stderr, "Unable to initialize SPDK env\n");
		return 1;
	}

	if (init_src_buffer() != 0) {
		fprintf(stderr, "Could not init src buffer\n");
+3 −1
Original line number Diff line number Diff line
@@ -1094,7 +1094,9 @@ main(int argc, char **argv)
	opts.name = "arb";
	opts.core_mask = g_arbitration.core_mask;
	opts.shm_id = g_arbitration.shm_id;
	spdk_env_init(&opts);
	if (spdk_env_init(&opts) < 0) {
		return 1;
	}

	g_arbitration.tsc_rate = spdk_get_ticks_hz();

Loading