util: call for_each_channel completion in original thread
As specified in the doc of spdk_for_each_channel:
```
Once 'fn' has been called on each channel, 'cpl' will be called
on the thread that spdk_for_each_channel was initially called from.
```
Fixes: ff87d29cc3
("io_channel: Add mechanism to call a function on
each channel")
Change-Id: Ic60b061ec402672f510d99697943e96ff9a73417
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/369719
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
740e5dc50b
commit
931e3d51d9
@ -322,6 +322,15 @@ struct call_channel {
|
|||||||
spdk_channel_for_each_cpl cpl;
|
spdk_channel_for_each_cpl cpl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
_call_completion(void *ctx)
|
||||||
|
{
|
||||||
|
struct call_channel *ch_ctx = ctx;
|
||||||
|
|
||||||
|
ch_ctx->cpl(ch_ctx->io_device, ch_ctx->ctx);
|
||||||
|
free(ch_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_call_channel(void *ctx)
|
_call_channel(void *ctx)
|
||||||
{
|
{
|
||||||
@ -351,8 +360,7 @@ _call_channel(void *ctx)
|
|||||||
|
|
||||||
pthread_mutex_unlock(&g_devlist_mutex);
|
pthread_mutex_unlock(&g_devlist_mutex);
|
||||||
|
|
||||||
ch_ctx->cpl(ch_ctx->io_device, ch_ctx->ctx);
|
spdk_thread_send_msg(ch_ctx->orig_thread, _call_completion, ch_ctx);
|
||||||
free(ch_ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user