Commit 5fc0475c authored by Jiewei Ke's avatar Jiewei Ke Committed by Jim Harris
Browse files

thread: Make the definition of struct spdk_io_channel private



Move the definition of structure spdk_io_channel into
lib/thread/thread_internal.h, so we don't have to update SO_VER for
other libraries in future when we need to change the internal details on
the structure.

Signed-off-by: default avatarJiewei Ke <jiewei@smartx.com>
Change-Id: I3d2ca7a8737972e0b33ce92e464da42c48f89dec
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8189


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarZiye Yang <ziye.yang@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 2509e124
Loading
Loading
Loading
Loading
+2 −27
Original line number Diff line number Diff line
@@ -39,9 +39,7 @@
#define SPDK_THREAD_H_

#include "spdk/stdinc.h"

#include "spdk/cpuset.h"
#include "spdk/queue.h"

#ifdef __cplusplus
extern "C" {
@@ -210,30 +208,7 @@ typedef void (*spdk_channel_msg)(struct spdk_io_channel_iter *i);
 */
typedef void (*spdk_channel_for_each_cpl)(struct spdk_io_channel_iter *i, int status);

/**
 * \brief Represents a per-thread channel for accessing an I/O device.
 *
 * An I/O device may be a physical entity (i.e. NVMe controller) or a software
 *  entity (i.e. a blobstore).
 *
 * This structure is not part of the API - all accesses should be done through
 *  spdk_io_channel function calls.
 */
struct spdk_io_channel {
	struct spdk_thread		*thread;
	struct io_device		*dev;
	uint32_t			ref;
	uint32_t			destroy_ref;
	TAILQ_ENTRY(spdk_io_channel)	tailq;
	spdk_io_channel_destroy_cb	destroy_cb;

	/*
	 * Modules will allocate extra memory off the end of this structure
	 *  to store references to hardware-specific references (i.e. NVMe queue
	 *  pairs, or references to child device spdk_io_channels (i.e.
	 *  virtual bdevs).
	 */
};
#define SPDK_IO_CHANNEL_STRUCT_SIZE	96

/**
 * Initialize the threading library. Must be called once prior to allocating any threads.
@@ -688,7 +663,7 @@ void spdk_put_io_channel(struct spdk_io_channel *ch);
static inline void *
spdk_io_channel_get_ctx(struct spdk_io_channel *ch)
{
	return (uint8_t *)ch + sizeof(*ch);
	return (uint8_t *)ch + SPDK_IO_CHANNEL_STRUCT_SIZE;
}

/**
+5 −3
Original line number Diff line number Diff line
@@ -31,8 +31,8 @@
 *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef SPDK_THREAD_INTERNAL_H_
#define SPDK_THREAD_INTERNAL_H_
#ifndef SPDK_INTERNAL_THREAD_H_
#define SPDK_INTERNAL_THREAD_H_

#include "spdk/stdinc.h"
#include "spdk/thread.h"
@@ -44,6 +44,7 @@ struct spdk_poller_stats {
	uint64_t	busy_count;
};

struct io_device;
struct spdk_thread;

const char *spdk_poller_get_name(struct spdk_poller *poller);
@@ -51,6 +52,7 @@ const char *spdk_poller_get_state_str(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);

const char *spdk_io_channel_get_io_device_name(struct spdk_io_channel *ch);
int spdk_io_channel_get_ref_count(struct spdk_io_channel *ch);

const char *spdk_io_device_get_name(struct io_device *dev);
@@ -65,4 +67,4 @@ 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_INTERNAL_THREAD_H_ */
+1 −1
Original line number Diff line number Diff line
@@ -321,7 +321,7 @@ static void
rpc_get_io_channel(struct spdk_io_channel *ch, struct spdk_json_write_ctx *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_channel_get_io_device_name(ch));
	spdk_json_write_named_uint32(w, "ref", spdk_io_channel_get_ref_count(ch));
	spdk_json_write_object_end(w);
}
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@
	spdk_poller_get_state_str;
	spdk_poller_get_period_ticks;
	spdk_poller_get_stats;
	spdk_io_channel_get_io_device_name;
	spdk_io_channel_get_ref_count;
	spdk_io_device_get_name;
	spdk_thread_get_first_active_poller;
+7 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@

#include "spdk/log.h"
#include "spdk_internal/thread.h"
#include "thread_internal.h"

#ifdef __linux__
#include <sys/timerfd.h>
@@ -2209,6 +2210,12 @@ spdk_io_channel_get_io_device(struct spdk_io_channel *ch)
	return ch->dev->io_device;
}

const char *
spdk_io_channel_get_io_device_name(struct spdk_io_channel *ch)
{
	return spdk_io_device_get_name(ch->dev);
}

int
spdk_io_channel_get_ref_count(struct spdk_io_channel *ch)
{
Loading