thread: Change remaining direct accesses to io_channel outside lib/thread to helper functions
This is the same effort as spdk_poller. The following patches will move the definition of struct spdk_thread and enum spdk_thread_state from include/spdk_internal/thread.h to lib/thread/thread.c. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I7f7bdfdd7a7b1b834d16d79638a4fd2d63e9daf6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7800 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
5fdb2b761b
commit
bd2fae2f0e
@ -108,6 +108,8 @@ const char *spdk_poller_get_state_str(struct spdk_poller *poller);
|
|||||||
uint64_t spdk_poller_get_period_ticks(struct spdk_poller *poller);
|
uint64_t spdk_poller_get_period_ticks(struct spdk_poller *poller);
|
||||||
void spdk_poller_get_stats(struct spdk_poller *poller, struct spdk_poller_stats *stats);
|
void spdk_poller_get_stats(struct spdk_poller *poller, struct spdk_poller_stats *stats);
|
||||||
|
|
||||||
|
int spdk_io_channel_get_ref_count(struct spdk_io_channel *ch);
|
||||||
|
|
||||||
const char *spdk_io_device_get_name(struct io_device *dev);
|
const char *spdk_io_device_get_name(struct io_device *dev);
|
||||||
|
|
||||||
struct spdk_poller *spdk_thread_get_first_active_poller(struct spdk_thread *thread);
|
struct spdk_poller *spdk_thread_get_first_active_poller(struct spdk_thread *thread);
|
||||||
@ -117,4 +119,7 @@ struct spdk_poller *spdk_thread_get_next_timed_poller(struct spdk_poller *prev);
|
|||||||
struct spdk_poller *spdk_thread_get_first_paused_poller(struct spdk_thread *thread);
|
struct spdk_poller *spdk_thread_get_first_paused_poller(struct spdk_thread *thread);
|
||||||
struct spdk_poller *spdk_thread_get_next_paused_poller(struct spdk_poller *prev);
|
struct spdk_poller *spdk_thread_get_next_paused_poller(struct spdk_poller *prev);
|
||||||
|
|
||||||
|
struct spdk_io_channel *spdk_thread_get_first_io_channel(struct spdk_thread *thread);
|
||||||
|
struct spdk_io_channel *spdk_thread_get_next_io_channel(struct spdk_io_channel *prev);
|
||||||
|
|
||||||
#endif /* SPDK_THREAD_INTERNAL_H_ */
|
#endif /* SPDK_THREAD_INTERNAL_H_ */
|
||||||
|
@ -322,7 +322,7 @@ rpc_get_io_channel(struct spdk_io_channel *ch, struct spdk_json_write_ctx *w)
|
|||||||
{
|
{
|
||||||
spdk_json_write_object_begin(w);
|
spdk_json_write_object_begin(w);
|
||||||
spdk_json_write_named_string(w, "name", spdk_io_device_get_name(ch->dev));
|
spdk_json_write_named_string(w, "name", spdk_io_device_get_name(ch->dev));
|
||||||
spdk_json_write_named_uint32(w, "ref", ch->ref);
|
spdk_json_write_named_uint32(w, "ref", spdk_io_channel_get_ref_count(ch));
|
||||||
spdk_json_write_object_end(w);
|
spdk_json_write_object_end(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,7 +337,8 @@ _rpc_thread_get_io_channels(void *arg)
|
|||||||
spdk_json_write_named_string(ctx->w, "name", spdk_thread_get_name(thread));
|
spdk_json_write_named_string(ctx->w, "name", spdk_thread_get_name(thread));
|
||||||
|
|
||||||
spdk_json_write_named_array_begin(ctx->w, "io_channels");
|
spdk_json_write_named_array_begin(ctx->w, "io_channels");
|
||||||
TAILQ_FOREACH(ch, &thread->io_channels, tailq) {
|
for (ch = spdk_thread_get_first_io_channel(thread); ch != NULL;
|
||||||
|
ch = spdk_thread_get_next_io_channel(ch)) {
|
||||||
rpc_get_io_channel(ch, ctx->w);
|
rpc_get_io_channel(ch, ctx->w);
|
||||||
}
|
}
|
||||||
spdk_json_write_array_end(ctx->w);
|
spdk_json_write_array_end(ctx->w);
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
spdk_poller_get_state_str;
|
spdk_poller_get_state_str;
|
||||||
spdk_poller_get_period_ticks;
|
spdk_poller_get_period_ticks;
|
||||||
spdk_poller_get_stats;
|
spdk_poller_get_stats;
|
||||||
|
spdk_io_channel_get_ref_count;
|
||||||
spdk_io_device_get_name;
|
spdk_io_device_get_name;
|
||||||
spdk_thread_get_first_active_poller;
|
spdk_thread_get_first_active_poller;
|
||||||
spdk_thread_get_next_active_poller;
|
spdk_thread_get_next_active_poller;
|
||||||
@ -68,6 +69,8 @@
|
|||||||
spdk_thread_get_next_timed_poller;
|
spdk_thread_get_next_timed_poller;
|
||||||
spdk_thread_get_first_paused_poller;
|
spdk_thread_get_first_paused_poller;
|
||||||
spdk_thread_get_next_paused_poller;
|
spdk_thread_get_next_paused_poller;
|
||||||
|
spdk_thread_get_first_io_channel;
|
||||||
|
spdk_thread_get_next_io_channel;
|
||||||
|
|
||||||
local: *;
|
local: *;
|
||||||
};
|
};
|
||||||
|
@ -1606,6 +1606,18 @@ spdk_thread_get_next_paused_poller(struct spdk_poller *prev)
|
|||||||
return TAILQ_NEXT(prev, tailq);
|
return TAILQ_NEXT(prev, tailq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct spdk_io_channel *
|
||||||
|
spdk_thread_get_first_io_channel(struct spdk_thread *thread)
|
||||||
|
{
|
||||||
|
return TAILQ_FIRST(&thread->io_channels);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct spdk_io_channel *
|
||||||
|
spdk_thread_get_next_io_channel(struct spdk_io_channel *prev)
|
||||||
|
{
|
||||||
|
return TAILQ_NEXT(prev, tailq);
|
||||||
|
}
|
||||||
|
|
||||||
struct call_thread {
|
struct call_thread {
|
||||||
struct spdk_thread *cur_thread;
|
struct spdk_thread *cur_thread;
|
||||||
spdk_msg_fn fn;
|
spdk_msg_fn fn;
|
||||||
@ -2068,6 +2080,12 @@ spdk_io_channel_get_io_device(struct spdk_io_channel *ch)
|
|||||||
return ch->dev->io_device;
|
return ch->dev->io_device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
spdk_io_channel_get_ref_count(struct spdk_io_channel *ch)
|
||||||
|
{
|
||||||
|
return ch->ref;
|
||||||
|
}
|
||||||
|
|
||||||
struct spdk_io_channel_iter {
|
struct spdk_io_channel_iter {
|
||||||
void *io_device;
|
void *io_device;
|
||||||
struct io_device *dev;
|
struct io_device *dev;
|
||||||
|
Loading…
Reference in New Issue
Block a user