Commit 32aa4fa0 authored by Jim Harris's avatar Jim Harris
Browse files

util: add context parameter for unique I/O channels



Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I296992b2e03b9b516cfd26726405e49616ad08a5
parent c1e3a87b
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -46,7 +46,8 @@

struct spdk_io_channel;

typedef int (*io_channel_create_cb_t)(void *io_device, uint32_t priority, void *ctx_buf);
typedef int (*io_channel_create_cb_t)(void *io_device, uint32_t priority, void *ctx_buf,
				      void *unique_ctx);
typedef void (*io_channel_destroy_cb_t)(void *io_device, void *ctx_buf);

/**
@@ -99,8 +100,12 @@ void spdk_io_device_unregister(void *io_device);
 *
 * The unique parameter allows callers to specify that an existing channel should not
 *  be used to satisfy this request, even if the io_device and priority fields match.
 *
 * The unique_ctx parameter allows callers to pass channel-specific context to the create_cb
 *  handler for unique channels.  This value must be NULL for shared channels.
 */
struct spdk_io_channel *spdk_get_io_channel(void *io_device, uint32_t priority, bool unique);
struct spdk_io_channel *spdk_get_io_channel(void *io_device, uint32_t priority, bool unique,
		void *unique_ctx);

/**
 * \brief Releases a reference to an I/O channel.
+2 −2
Original line number Diff line number Diff line
@@ -310,7 +310,7 @@ blockdev_aio_io_type_supported(struct spdk_bdev *bdev, enum spdk_bdev_io_type io
}

static int
blockdev_aio_create_cb(void *io_device, uint32_t priority, void *ctx_buf)
blockdev_aio_create_cb(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx)
{
	struct blockdev_aio_io_channel *ch = ctx_buf;

@@ -336,7 +336,7 @@ blockdev_aio_destroy_cb(void *io_device, void *ctx_buf)
static struct spdk_io_channel *
blockdev_aio_get_io_channel(struct spdk_bdev *bdev, uint32_t priority)
{
	return spdk_get_io_channel(bdev, priority, false);
	return spdk_get_io_channel(bdev, priority, false, NULL);
}

static const struct spdk_bdev_fn_table aio_fn_table = {
+2 −2
Original line number Diff line number Diff line
@@ -306,7 +306,7 @@ blockdev_nvme_io_type_supported(struct spdk_bdev *bdev, enum spdk_bdev_io_type i
}

static int
blockdev_nvme_create_cb(void *io_device, uint32_t priority, void *ctx_buf)
blockdev_nvme_create_cb(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx)
{
	struct spdk_nvme_ctrlr *ctrlr = io_device;
	struct nvme_io_channel *ch = ctx_buf;
@@ -336,7 +336,7 @@ blockdev_nvme_get_io_channel(struct spdk_bdev *bdev, uint32_t priority)
{
	struct nvme_blockdev *nvme_bdev = (struct nvme_blockdev *)bdev;

	return spdk_get_io_channel(nvme_bdev->ctrlr, priority, false);
	return spdk_get_io_channel(nvme_bdev->ctrlr, priority, false, NULL);
}

static const struct spdk_bdev_fn_table nvmelib_fn_table = {
+4 −4
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ static struct spdk_copy_engine memcpy_copy_engine = {
};

static int
memcpy_create_cb(void *io_device, uint32_t priority, void *ctx_buf)
memcpy_create_cb(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx)
{
	return 0;
}
@@ -151,7 +151,7 @@ memcpy_destroy_cb(void *io_device, void *ctx_buf)

static struct spdk_io_channel *mem_get_io_channel(uint32_t priority)
{
	return spdk_get_io_channel(&memcpy_copy_engine, priority, false);
	return spdk_get_io_channel(&memcpy_copy_engine, priority, false, NULL);
}

static int
@@ -179,7 +179,7 @@ void spdk_copy_module_list_add(struct spdk_copy_module_if *copy_module)
}

static int
copy_create_cb(void *io_device, uint32_t priority, void *ctx_buf)
copy_create_cb(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx)
{
	struct copy_io_channel	*copy_ch = ctx_buf;

@@ -208,7 +208,7 @@ copy_destroy_cb(void *io_device, void *ctx_buf)
struct spdk_io_channel *
spdk_copy_engine_get_io_channel(uint32_t priority)
{
	return spdk_get_io_channel(&spdk_copy_module_list, priority, false);
	return spdk_get_io_channel(&spdk_copy_module_list, priority, false, NULL);
}

static int
+2 −2
Original line number Diff line number Diff line
@@ -207,7 +207,7 @@ static struct spdk_copy_engine ioat_copy_engine = {
};

static int
ioat_create_cb(void *io_device, uint32_t priority, void *ctx_buf)
ioat_create_cb(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx)
{
	struct ioat_io_channel *ch = ctx_buf;
	struct ioat_device *ioat_dev;
@@ -236,7 +236,7 @@ ioat_destroy_cb(void *io_device, void *ctx_buf)
static struct spdk_io_channel *
ioat_get_io_channel(uint32_t priority)
{
	return spdk_get_io_channel(&ioat_copy_engine, priority, false);
	return spdk_get_io_channel(&ioat_copy_engine, priority, false, NULL);
}

struct ioat_probe_ctx {
Loading