Commit 500f26e2 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

lib/thread: Move struct spdk_thread public in SPDK internal



thread_get_pollers RPC which will be added in the upcoming patches
will need to access all pollers each thread has.

To avoid adding JSON related code into lib/thread/thread.c, expose
struct spdk_thread internally among SPDK libraries and RPC code will
access it.

The next patch will expose struct spdk_poller internally among
SPDK library for the same purpose.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8da039db3021966ca1e28f6f086bb4c2a8eeb84a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/973


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent 95b35daa
Loading
Loading
Loading
Loading
+37 −1
Original line number Diff line number Diff line
@@ -35,7 +35,43 @@
#define SPDK_THREAD_INTERNAL_H_

#include "spdk/stdinc.h"
#include "spdk/thread.h"

struct spdk_thread;
#define SPDK_MAX_THREAD_NAME_LEN	256

struct spdk_thread {
	TAILQ_HEAD(, spdk_io_channel)	io_channels;
	TAILQ_ENTRY(spdk_thread)	tailq;
	char				name[SPDK_MAX_THREAD_NAME_LEN + 1];
	uint64_t			id;
	bool				exit;
	struct spdk_cpuset		cpumask;
	uint64_t			tsc_last;
	struct spdk_thread_stats	stats;
	/*
	 * Contains pollers actively running on this thread.  Pollers
	 *  are run round-robin. The thread takes one poller from the head
	 *  of the ring, executes it, then puts it back at the tail of
	 *  the ring.
	 */
	TAILQ_HEAD(active_pollers_head, spdk_poller)	active_pollers;
	/**
	 * Contains pollers running on this thread with a periodic timer.
	 */
	TAILQ_HEAD(timed_pollers_head, spdk_poller)	timed_pollers;
	/*
	 * Contains paused pollers.  Pollers on this queue are waiting until
	 * they are resumed (in which case they're put onto the active/timer
	 * queues) or unregistered.
	 */
	TAILQ_HEAD(paused_pollers_head, spdk_poller)	paused_pollers;
	uint32_t			io_device_delete_count;
	struct spdk_ring		*messages;
	SLIST_HEAD(, spdk_msg)		msg_cache;
	size_t				msg_cache_count;
	spdk_msg_fn			critical_msg;
	/* User context allocated at the end */
	uint8_t				ctx[0];
};

#endif /* SPDK_THREAD_INTERNAL_H_ */
+0 −45
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@

#define SPDK_MSG_BATCH_SIZE		8
#define SPDK_MAX_DEVICE_NAME_LEN	256
#define SPDK_MAX_THREAD_NAME_LEN	256

static pthread_mutex_t g_devlist_mutex = PTHREAD_MUTEX_INITIALIZER;

@@ -121,50 +120,6 @@ struct spdk_poller {
	struct spdk_thread		*thread;
};

struct spdk_thread {
	TAILQ_HEAD(, spdk_io_channel)	io_channels;
	TAILQ_ENTRY(spdk_thread)	tailq;
	char				name[SPDK_MAX_THREAD_NAME_LEN + 1];
	uint64_t			id;

	bool				exit;

	struct spdk_cpuset		cpumask;

	uint64_t			tsc_last;
	struct spdk_thread_stats	stats;

	/*
	 * Contains pollers actively running on this thread.  Pollers
	 *  are run round-robin. The thread takes one poller from the head
	 *  of the ring, executes it, then puts it back at the tail of
	 *  the ring.
	 */
	TAILQ_HEAD(active_pollers_head, spdk_poller)	active_pollers;

	/**
	 * Contains pollers running on this thread with a periodic timer.
	 */
	TAILQ_HEAD(timed_pollers_head, spdk_poller)	timed_pollers;

	/*
	 * Contains paused pollers.  Pollers on this queue are waiting until
	 * they are resumed (in which case they're put onto the active/timer
	 * queues) or unregistered.
	 */
	TAILQ_HEAD(paused_pollers_head, spdk_poller)	paused_pollers;

	struct spdk_ring		*messages;

	SLIST_HEAD(, spdk_msg)		msg_cache;
	size_t				msg_cache_count;

	spdk_msg_fn			critical_msg;

	/* User context allocated at the end */
	uint8_t				ctx[0];
};

static TAILQ_HEAD(, spdk_thread) g_threads = TAILQ_HEAD_INITIALIZER(g_threads);
static uint32_t g_thread_count = 0;