blobfs: spdk_fs_thread_ctx is no longer a channel

This also means that the RocksDB threads don't need
to be SPDK threads any more.

Change-Id: Icadd6dd446958ebf470ad8ab8239f5390942eb87
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449465
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Ben Walker 2019-03-28 11:32:37 -07:00 committed by Jim Harris
parent e9d400d5b9
commit b71bebe88a
2 changed files with 17 additions and 10 deletions

View File

@ -1738,24 +1738,28 @@ spdk_fs_free_io_channel(struct spdk_io_channel *channel)
struct spdk_fs_thread_ctx * struct spdk_fs_thread_ctx *
spdk_fs_alloc_thread_ctx(struct spdk_filesystem *fs) spdk_fs_alloc_thread_ctx(struct spdk_filesystem *fs)
{ {
struct spdk_io_channel *io_channel; struct spdk_fs_thread_ctx *ctx;
struct spdk_fs_channel *fs_channel;
io_channel = spdk_get_io_channel(&fs->io_target); ctx = calloc(1, sizeof(*ctx));
fs_channel = spdk_io_channel_get_ctx(io_channel); if (!ctx) {
fs_channel->send_request = fs->send_request; return NULL;
fs_channel->sync = 1; }
pthread_spin_init(&fs_channel->lock, 0);
/* These two types are currently equivalent */ _spdk_fs_channel_create(fs, &ctx->ch, 512);
return (struct spdk_fs_thread_ctx *)fs_channel;
ctx->ch.send_request = fs->send_request;
ctx->ch.sync = 1;
pthread_spin_init(&ctx->ch.lock, 0);
return ctx;
} }
void void
spdk_fs_free_thread_ctx(struct spdk_fs_thread_ctx *ctx) spdk_fs_free_thread_ctx(struct spdk_fs_thread_ctx *ctx)
{ {
spdk_put_io_channel(spdk_io_channel_from_ctx(ctx)); _spdk_fs_channel_destroy(NULL, &ctx->ch);
free(ctx);
} }
void void

View File

@ -592,6 +592,9 @@ void SpdkInitializeThread(void)
void SpdkFinalizeThread(void) void SpdkFinalizeThread(void)
{ {
if (g_sync_args.channel) {
spdk_fs_free_thread_ctx(g_sync_args.channel);
}
} }
struct SpdkThreadState { struct SpdkThreadState {