example/nvmf: Deprecate spdk_thread_lib_init() by spdk_thread_lib_init_ext()
Replace spdk_thread_lib_init() by spdk_thread_lib_init_ext() to support dynamic SPDK thread scheduling in this sample application. Add nvmf_reactor_thread_op() and nvmf_reactor_thread_op_supported(), and then pass them by spdk_thread_lib_init_ext(). Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I9498d45d74757d8893b2b415fe28bf65f8fd02d6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2540 Community-CI: Mellanox Build Bot Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
bda55ddb6b
commit
a9430856b6
@ -278,6 +278,30 @@ nvmf_schedule_spdk_thread(struct spdk_thread *thread)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
nvmf_reactor_thread_op(struct spdk_thread *thread, enum spdk_thread_op op)
|
||||
{
|
||||
switch (op) {
|
||||
case SPDK_THREAD_OP_NEW:
|
||||
return nvmf_schedule_spdk_thread(thread);
|
||||
case SPDK_THREAD_OP_RESCHED:
|
||||
default:
|
||||
return -ENOTSUP;
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
nvmf_reactor_thread_op_supported(enum spdk_thread_op op)
|
||||
{
|
||||
switch (op) {
|
||||
case SPDK_THREAD_OP_NEW:
|
||||
return true;
|
||||
case SPDK_THREAD_OP_RESCHED:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
nvmf_init_threads(void)
|
||||
{
|
||||
@ -295,7 +319,8 @@ nvmf_init_threads(void)
|
||||
* SPDK optionally allocates extra memory to be used by the application
|
||||
* framework. The size of the extra memory allocated is the second parameter.
|
||||
*/
|
||||
spdk_thread_lib_init(nvmf_schedule_spdk_thread, sizeof(struct nvmf_lw_thread));
|
||||
spdk_thread_lib_init_ext(nvmf_reactor_thread_op, nvmf_reactor_thread_op_supported,
|
||||
sizeof(struct nvmf_lw_thread));
|
||||
|
||||
/* Spawn one system thread per CPU core. The system thread is called a reactor.
|
||||
* SPDK will spawn lightweight threads that must be mapped to reactors in
|
||||
|
Loading…
x
Reference in New Issue
Block a user