From 7ba4ea07732baaa651ca8a4960cc99f346a9d25b Mon Sep 17 00:00:00 2001 From: Jiewei Ke Date: Thu, 17 Jun 2021 23:27:56 -0400 Subject: [PATCH] bdev: use thread api to access spdk_io_channel's thread Thread is private data of spdk_io_channel, bdev should use spdk_io_channel_get_thread() to access it. This prepares for the upcoming change to make the definition of struct spdk_io_channel private. Change-Id: I643c8d677e22f6d8dde2faf91bb2711d3f5d81b8 Signed-off-by: Jiewei Ke Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8426 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Changpeng Liu Reviewed-by: Aleksey Marchuk Reviewed-by: Jim Harris Community-CI: Mellanox Build Bot --- lib/bdev/bdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index b41738465e..7a61fa26e6 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -6783,7 +6783,7 @@ bdev_lock_lba_range_get_channel(struct spdk_io_channel_iter *i) static void bdev_lock_lba_range_ctx(struct spdk_bdev *bdev, struct locked_lba_range_ctx *ctx) { - assert(spdk_get_thread() == ctx->range.owner_ch->channel->thread); + assert(spdk_get_thread() == spdk_io_channel_get_thread(ctx->range.owner_ch->channel)); /* We will add a copy of this range to each channel now. */ spdk_for_each_channel(__bdev_to_io_dev(bdev), bdev_lock_lba_range_get_channel, ctx, @@ -6874,7 +6874,7 @@ bdev_unlock_lba_range_cb(struct spdk_io_channel_iter *i, int status) TAILQ_REMOVE(&bdev->internal.pending_locked_ranges, range, tailq); pending_ctx = SPDK_CONTAINEROF(range, struct locked_lba_range_ctx, range); TAILQ_INSERT_TAIL(&bdev->internal.locked_ranges, range, tailq); - spdk_thread_send_msg(pending_ctx->range.owner_ch->channel->thread, + spdk_thread_send_msg(spdk_io_channel_get_thread(pending_ctx->range.owner_ch->channel), bdev_lock_lba_range_ctx_msg, pending_ctx); } }