rocksdb: cleanup SpdkInitializeThread/SpdkFinalizeThread
Remove SpdkFinalizeThread. It is no longer needed - the thread-local destructor handles the cleanup. Keep SpdkInitializeThread but make it static. We still need this function for the main thread, so that it can be explicitly called after the filesystem has been loaded. Part of this patch moves the rocksdb_commit_id to a version that doesn't make calls to these functions. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: Ib9aefdfede7e5636085079d2226ec1c4d2cae406 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452687 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
parent
43cfca676b
commit
eba7fce38f
@ -59,8 +59,7 @@ std::string g_bdev_name;
|
||||
volatile bool g_spdk_ready = false;
|
||||
volatile bool g_spdk_start_failure = false;
|
||||
|
||||
void SpdkInitializeThread(void);
|
||||
void SpdkFinalizeThread(void);
|
||||
static void SpdkInitializeThread(void);
|
||||
|
||||
class SpdkThreadCtx
|
||||
{
|
||||
@ -74,7 +73,10 @@ public:
|
||||
|
||||
~SpdkThreadCtx(void)
|
||||
{
|
||||
SpdkFinalizeThread();
|
||||
if (channel) {
|
||||
spdk_fs_free_thread_ctx(channel);
|
||||
channel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@ -598,25 +600,23 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
void SpdkInitializeThread(void)
|
||||
/* The thread local constructor doesn't work for the main thread, since
|
||||
* the filesystem hasn't been loaded yet. So we break out this
|
||||
* SpdkInitializeThread function, so that the main thread can explicitly
|
||||
* call it after the filesystem has been loaded.
|
||||
*/
|
||||
static void SpdkInitializeThread(void)
|
||||
{
|
||||
struct spdk_thread *thread;
|
||||
|
||||
if (g_fs != NULL && g_sync_args.channel == NULL) {
|
||||
assert(g_sync_args.channel == NULL);
|
||||
if (g_fs != NULL) {
|
||||
thread = spdk_thread_create("spdk_rocksdb", NULL);
|
||||
spdk_set_thread(thread);
|
||||
g_sync_args.channel = spdk_fs_alloc_thread_ctx(g_fs);
|
||||
}
|
||||
}
|
||||
|
||||
void SpdkFinalizeThread(void)
|
||||
{
|
||||
if (g_sync_args.channel) {
|
||||
spdk_fs_free_thread_ctx(g_sync_args.channel);
|
||||
g_sync_args.channel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fs_load_cb(__attribute__((unused)) void *ctx,
|
||||
struct spdk_filesystem *fs, int fserrno)
|
||||
|
@ -1 +1 @@
|
||||
803b318a9e1c0244030c1775c1b84b4f385a8908
|
||||
526c73bd94150cc8fbd651f736e1ca95f50d8e13
|
||||
|
Loading…
Reference in New Issue
Block a user