io_channel: Remove unique flag

This is no longer used anywhere. For the places where we previously
used it, we've since found alternate solutions that do not
require it.

Change-Id: I738a80b95ef50348ce1c14969a3812b0a625b3fd
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/362064
Tested-by: <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2017-05-15 15:25:48 -07:00 committed by Daniel Verkamp
parent 267a4e1ebd
commit 305cb239d2
12 changed files with 48 additions and 92 deletions

View File

@ -46,8 +46,7 @@
struct spdk_io_channel; 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); typedef void (*io_channel_destroy_cb_t)(void *io_device, void *ctx_buf);
/** /**
@ -97,15 +96,8 @@ void spdk_io_device_unregister(void *io_device);
* The priority parameter allows callers to create different I/O channels to the same * The priority parameter allows callers to create different I/O channels to the same
* I/O device with varying priorities. Currently this value must be set to * I/O device with varying priorities. Currently this value must be set to
* SPDK_IO_PRIORITY_DEFAULT. * SPDK_IO_PRIORITY_DEFAULT.
*
* 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);
void *unique_ctx);
/** /**
* \brief Releases a reference to an I/O channel. * \brief Releases a reference to an I/O channel.

View File

@ -290,7 +290,7 @@ blockdev_aio_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type)
} }
static int static int
blockdev_aio_create_cb(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx) blockdev_aio_create_cb(void *io_device, uint32_t priority, void *ctx_buf)
{ {
struct blockdev_aio_io_channel *ch = ctx_buf; struct blockdev_aio_io_channel *ch = ctx_buf;
@ -318,7 +318,7 @@ blockdev_aio_get_io_channel(void *ctx, uint32_t priority)
{ {
struct file_disk *fdisk = ctx; struct file_disk *fdisk = ctx;
return spdk_get_io_channel(&fdisk->fd, priority, false, NULL); return spdk_get_io_channel(&fdisk->fd, priority);
} }
static const struct spdk_bdev_fn_table aio_fn_table = { static const struct spdk_bdev_fn_table aio_fn_table = {

View File

@ -507,8 +507,7 @@ spdk_bdev_dump_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w
} }
static int static int
spdk_bdev_channel_create(void *io_device, uint32_t priority, void *ctx_buf, spdk_bdev_channel_create(void *io_device, uint32_t priority, void *ctx_buf)
void *unique_ctx)
{ {
struct spdk_bdev *bdev = io_device; struct spdk_bdev *bdev = io_device;
struct spdk_bdev_channel *ch = ctx_buf; struct spdk_bdev_channel *ch = ctx_buf;
@ -530,7 +529,7 @@ spdk_bdev_channel_destroy(void *io_device, void *ctx_buf)
struct spdk_io_channel * struct spdk_io_channel *
spdk_bdev_get_io_channel(struct spdk_bdev *bdev, uint32_t priority) spdk_bdev_get_io_channel(struct spdk_bdev *bdev, uint32_t priority)
{ {
return spdk_get_io_channel(bdev, priority, false, NULL); return spdk_get_io_channel(bdev, priority);
} }
const char * const char *

View File

@ -110,7 +110,7 @@ blockdev_null_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type)
static struct spdk_io_channel * static struct spdk_io_channel *
blockdev_null_get_io_channel(void *ctx, uint32_t priority) blockdev_null_get_io_channel(void *ctx, uint32_t priority)
{ {
return spdk_get_io_channel(&g_null_bdev_head, priority, false, NULL); return spdk_get_io_channel(&g_null_bdev_head, priority);
} }
static const struct spdk_bdev_fn_table null_fn_table = { static const struct spdk_bdev_fn_table null_fn_table = {
@ -160,7 +160,7 @@ create_null_bdev(const char *name, uint64_t num_blocks, uint32_t block_size)
} }
static int static int
null_bdev_create_cb(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx) null_bdev_create_cb(void *io_device, uint32_t priority, void *ctx_buf)
{ {
return 0; return 0;
} }

View File

@ -343,7 +343,7 @@ bdev_nvme_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type)
} }
static int static int
bdev_nvme_create_cb(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx) bdev_nvme_create_cb(void *io_device, uint32_t priority, void *ctx_buf)
{ {
struct spdk_nvme_ctrlr *ctrlr = io_device; struct spdk_nvme_ctrlr *ctrlr = io_device;
struct nvme_io_channel *ch = ctx_buf; struct nvme_io_channel *ch = ctx_buf;
@ -373,7 +373,7 @@ bdev_nvme_get_io_channel(void *ctx, uint32_t priority)
{ {
struct nvme_bdev *nvme_bdev = ctx; struct nvme_bdev *nvme_bdev = ctx;
return spdk_get_io_channel(nvme_bdev->nvme_ctrlr->ctrlr, priority, false, NULL); return spdk_get_io_channel(nvme_bdev->nvme_ctrlr->ctrlr, priority);
} }
static int static int

View File

@ -399,8 +399,7 @@ blockdev_rbd_handle(void *arg)
} }
static int static int
blockdev_rbd_create_cb(void *io_device, uint32_t priority, blockdev_rbd_create_cb(void *io_device, uint32_t priority, void *ctx_buf)
void *ctx_buf, void *unique_ctx)
{ {
struct blockdev_rbd_io_channel *ch = ctx_buf; struct blockdev_rbd_io_channel *ch = ctx_buf;
int ret; int ret;
@ -466,7 +465,7 @@ blockdev_rbd_get_io_channel(void *ctx, uint32_t priority)
{ {
struct blockdev_rbd *rbd_bdev = ctx; struct blockdev_rbd *rbd_bdev = ctx;
return spdk_get_io_channel(&rbd_bdev->info, priority, false, NULL); return spdk_get_io_channel(&rbd_bdev->info, priority);
} }
static const struct spdk_bdev_fn_table rbd_fn_table = { static const struct spdk_bdev_fn_table rbd_fn_table = {

View File

@ -1077,7 +1077,7 @@ _spdk_bs_channel_create(struct spdk_blob_store *bs, struct spdk_bs_channel *chan
} }
static int static int
_spdk_bs_md_channel_create(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx) _spdk_bs_md_channel_create(void *io_device, uint32_t priority, void *ctx_buf)
{ {
struct spdk_blob_store *bs; struct spdk_blob_store *bs;
struct spdk_bs_channel *channel = ctx_buf; struct spdk_bs_channel *channel = ctx_buf;
@ -1088,7 +1088,7 @@ _spdk_bs_md_channel_create(void *io_device, uint32_t priority, void *ctx_buf, vo
} }
static int static int
_spdk_bs_io_channel_create(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx) _spdk_bs_io_channel_create(void *io_device, uint32_t priority, void *ctx_buf)
{ {
struct spdk_blob_store *bs; struct spdk_blob_store *bs;
struct spdk_bs_channel *channel = ctx_buf; struct spdk_bs_channel *channel = ctx_buf;
@ -1761,8 +1761,7 @@ spdk_bs_free_cluster_count(struct spdk_blob_store *bs)
int spdk_bs_register_md_thread(struct spdk_blob_store *bs) int spdk_bs_register_md_thread(struct spdk_blob_store *bs)
{ {
bs->md_target.md_channel = spdk_get_io_channel(&bs->md_target, SPDK_IO_PRIORITY_DEFAULT, bs->md_target.md_channel = spdk_get_io_channel(&bs->md_target, SPDK_IO_PRIORITY_DEFAULT);
false, NULL);
return 0; return 0;
} }
@ -2105,7 +2104,7 @@ void spdk_bs_md_close_blob(struct spdk_blob **b,
struct spdk_io_channel *spdk_bs_alloc_io_channel(struct spdk_blob_store *bs, struct spdk_io_channel *spdk_bs_alloc_io_channel(struct spdk_blob_store *bs,
uint32_t priority) uint32_t priority)
{ {
return spdk_get_io_channel(&bs->io_target, priority, false, NULL); return spdk_get_io_channel(&bs->io_target, priority);
} }
void spdk_bs_free_io_channel(struct spdk_io_channel *channel) void spdk_bs_free_io_channel(struct spdk_io_channel *channel)

View File

@ -272,7 +272,7 @@ _spdk_fs_channel_create(struct spdk_filesystem *fs, struct spdk_fs_channel *chan
} }
static int static int
_spdk_fs_md_channel_create(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx) _spdk_fs_md_channel_create(void *io_device, uint32_t priority, void *ctx_buf)
{ {
struct spdk_filesystem *fs; struct spdk_filesystem *fs;
struct spdk_fs_channel *channel = ctx_buf; struct spdk_fs_channel *channel = ctx_buf;
@ -283,7 +283,7 @@ _spdk_fs_md_channel_create(void *io_device, uint32_t priority, void *ctx_buf, vo
} }
static int static int
_spdk_fs_sync_channel_create(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx) _spdk_fs_sync_channel_create(void *io_device, uint32_t priority, void *ctx_buf)
{ {
struct spdk_filesystem *fs; struct spdk_filesystem *fs;
struct spdk_fs_channel *channel = ctx_buf; struct spdk_fs_channel *channel = ctx_buf;
@ -294,7 +294,7 @@ _spdk_fs_sync_channel_create(void *io_device, uint32_t priority, void *ctx_buf,
} }
static int static int
_spdk_fs_io_channel_create(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx) _spdk_fs_io_channel_create(void *io_device, uint32_t priority, void *ctx_buf)
{ {
struct spdk_filesystem *fs; struct spdk_filesystem *fs;
struct spdk_fs_channel *channel = ctx_buf; struct spdk_fs_channel *channel = ctx_buf;
@ -369,15 +369,13 @@ fs_alloc(struct spdk_bs_dev *dev, fs_send_request_fn send_request_fn)
fs->md_target.max_ops = 512; fs->md_target.max_ops = 512;
spdk_io_device_register(&fs->md_target, _spdk_fs_md_channel_create, _spdk_fs_channel_destroy, spdk_io_device_register(&fs->md_target, _spdk_fs_md_channel_create, _spdk_fs_channel_destroy,
sizeof(struct spdk_fs_channel)); sizeof(struct spdk_fs_channel));
fs->md_target.md_io_channel = spdk_get_io_channel(&fs->md_target, SPDK_IO_PRIORITY_DEFAULT, false, fs->md_target.md_io_channel = spdk_get_io_channel(&fs->md_target, SPDK_IO_PRIORITY_DEFAULT);
NULL);
fs->md_target.md_fs_channel = spdk_io_channel_get_ctx(fs->md_target.md_io_channel); fs->md_target.md_fs_channel = spdk_io_channel_get_ctx(fs->md_target.md_io_channel);
fs->sync_target.max_ops = 512; fs->sync_target.max_ops = 512;
spdk_io_device_register(&fs->sync_target, _spdk_fs_sync_channel_create, _spdk_fs_channel_destroy, spdk_io_device_register(&fs->sync_target, _spdk_fs_sync_channel_create, _spdk_fs_channel_destroy,
sizeof(struct spdk_fs_channel)); sizeof(struct spdk_fs_channel));
fs->sync_target.sync_io_channel = spdk_get_io_channel(&fs->sync_target, SPDK_IO_PRIORITY_DEFAULT, fs->sync_target.sync_io_channel = spdk_get_io_channel(&fs->sync_target, SPDK_IO_PRIORITY_DEFAULT);
false, NULL);
fs->sync_target.sync_fs_channel = spdk_io_channel_get_ctx(fs->sync_target.sync_io_channel); fs->sync_target.sync_fs_channel = spdk_io_channel_get_ctx(fs->sync_target.sync_io_channel);
fs->io_target.max_ops = 512; fs->io_target.max_ops = 512;
@ -1423,7 +1421,7 @@ spdk_fs_alloc_io_channel(struct spdk_filesystem *fs, uint32_t priority)
struct spdk_io_channel *io_channel; struct spdk_io_channel *io_channel;
struct spdk_fs_channel *fs_channel; struct spdk_fs_channel *fs_channel;
io_channel = spdk_get_io_channel(&fs->io_target, priority, false, NULL); io_channel = spdk_get_io_channel(&fs->io_target, priority);
fs_channel = spdk_io_channel_get_ctx(io_channel); fs_channel = spdk_io_channel_get_ctx(io_channel);
fs_channel->bs_channel = spdk_bs_alloc_io_channel(fs->bs, SPDK_IO_PRIORITY_DEFAULT); fs_channel->bs_channel = spdk_bs_alloc_io_channel(fs->bs, SPDK_IO_PRIORITY_DEFAULT);
fs_channel->send_request = __send_request_direct; fs_channel->send_request = __send_request_direct;
@ -1437,7 +1435,7 @@ spdk_fs_alloc_io_channel_sync(struct spdk_filesystem *fs, uint32_t priority)
struct spdk_io_channel *io_channel; struct spdk_io_channel *io_channel;
struct spdk_fs_channel *fs_channel; struct spdk_fs_channel *fs_channel;
io_channel = spdk_get_io_channel(&fs->io_target, priority, false, NULL); io_channel = spdk_get_io_channel(&fs->io_target, priority);
fs_channel = spdk_io_channel_get_ctx(io_channel); fs_channel = spdk_io_channel_get_ctx(io_channel);
fs_channel->send_request = fs->send_request; fs_channel->send_request = fs->send_request;

View File

@ -139,7 +139,7 @@ static struct spdk_copy_engine memcpy_copy_engine = {
}; };
static int static int
memcpy_create_cb(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx) memcpy_create_cb(void *io_device, uint32_t priority, void *ctx_buf)
{ {
return 0; 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) static struct spdk_io_channel *mem_get_io_channel(uint32_t priority)
{ {
return spdk_get_io_channel(&memcpy_copy_engine, priority, false, NULL); return spdk_get_io_channel(&memcpy_copy_engine, priority);
} }
static size_t static size_t
@ -175,7 +175,7 @@ void spdk_copy_module_list_add(struct spdk_copy_module_if *copy_module)
} }
static int static int
copy_create_cb(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx) copy_create_cb(void *io_device, uint32_t priority, void *ctx_buf)
{ {
struct copy_io_channel *copy_ch = ctx_buf; struct copy_io_channel *copy_ch = ctx_buf;
@ -204,7 +204,7 @@ copy_destroy_cb(void *io_device, void *ctx_buf)
struct spdk_io_channel * struct spdk_io_channel *
spdk_copy_engine_get_io_channel(uint32_t priority) spdk_copy_engine_get_io_channel(uint32_t priority)
{ {
return spdk_get_io_channel(&spdk_copy_module_list, priority, false, NULL); return spdk_get_io_channel(&spdk_copy_module_list, priority);
} }
static int static int

View File

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

View File

@ -127,7 +127,7 @@ spdk_io_device_unregister(void *io_device)
} }
struct spdk_io_channel * struct spdk_io_channel *
spdk_get_io_channel(void *io_device, uint32_t priority, bool unique, void *unique_ctx) spdk_get_io_channel(void *io_device, uint32_t priority)
{ {
struct spdk_io_channel *ch; struct spdk_io_channel *ch;
struct io_device *dev; struct io_device *dev;
@ -138,11 +138,6 @@ spdk_get_io_channel(void *io_device, uint32_t priority, bool unique, void *uniqu
return NULL; return NULL;
} }
if (unique == false && unique_ctx != NULL) {
SPDK_ERRLOG("non-NULL unique_ctx passed for shared channel\n");
return NULL;
}
pthread_mutex_lock(&g_devlist_mutex); pthread_mutex_lock(&g_devlist_mutex);
TAILQ_FOREACH(dev, &g_io_devices, tailq) { TAILQ_FOREACH(dev, &g_io_devices, tailq) {
if (dev->io_device_ctx == io_device) { if (dev->io_device_ctx == io_device) {
@ -156,16 +151,14 @@ spdk_get_io_channel(void *io_device, uint32_t priority, bool unique, void *uniqu
} }
pthread_mutex_unlock(&g_devlist_mutex); pthread_mutex_unlock(&g_devlist_mutex);
if (unique == false) { TAILQ_FOREACH(ch, &g_io_channels, tailq) {
TAILQ_FOREACH(ch, &g_io_channels, tailq) { if (ch->io_device == io_device && ch->priority == priority) {
if (ch->io_device == io_device && ch->priority == priority) { ch->ref++;
ch->ref++; /*
/* * An I/O channel already exists for this device on this
* An I/O channel already exists for this device on this * thread, so return it.
* thread, so return it. */
*/ return ch;
return ch;
}
} }
} }
@ -174,7 +167,7 @@ spdk_get_io_channel(void *io_device, uint32_t priority, bool unique, void *uniqu
SPDK_ERRLOG("could not calloc spdk_io_channel\n"); SPDK_ERRLOG("could not calloc spdk_io_channel\n");
return NULL; return NULL;
} }
rc = dev->create_cb(io_device, priority, (uint8_t *)ch + sizeof(*ch), unique_ctx); rc = dev->create_cb(io_device, priority, (uint8_t *)ch + sizeof(*ch));
if (rc == -1) { if (rc == -1) {
free(ch); free(ch);
return NULL; return NULL;

View File

@ -55,7 +55,7 @@ static int g_create_cb_calls = 0;
static int g_destroy_cb_calls = 0; static int g_destroy_cb_calls = 0;
static int static int
create_cb_1(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx) create_cb_1(void *io_device, uint32_t priority, void *ctx_buf)
{ {
CU_ASSERT(io_device == &device1); CU_ASSERT(io_device == &device1);
CU_ASSERT(priority == SPDK_IO_PRIORITY_DEFAULT); CU_ASSERT(priority == SPDK_IO_PRIORITY_DEFAULT);
@ -73,15 +73,12 @@ destroy_cb_1(void *io_device, void *ctx_buf)
} }
static int static int
create_cb_2(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx) create_cb_2(void *io_device, uint32_t priority, void *ctx_buf)
{ {
CU_ASSERT(io_device == &device2); CU_ASSERT(io_device == &device2);
CU_ASSERT(priority == SPDK_IO_PRIORITY_DEFAULT); CU_ASSERT(priority == SPDK_IO_PRIORITY_DEFAULT);
*(uint64_t *)ctx_buf = ctx2; *(uint64_t *)ctx_buf = ctx2;
g_create_cb_calls++; g_create_cb_calls++;
if (unique_ctx != NULL) {
*(int *)unique_ctx = ~(*(int *)unique_ctx);
}
return 0; return 0;
} }
@ -94,7 +91,7 @@ destroy_cb_2(void *io_device, void *ctx_buf)
} }
static int static int
create_cb_null(void *io_device, uint32_t priority, void *ctx_buf, void *unique_ctx) create_cb_null(void *io_device, uint32_t priority, void *ctx_buf)
{ {
return -1; return -1;
} }
@ -102,8 +99,7 @@ create_cb_null(void *io_device, uint32_t priority, void *ctx_buf, void *unique_c
static void static void
channel(void) channel(void)
{ {
struct spdk_io_channel *ch1, *ch2, *ch3; struct spdk_io_channel *ch1, *ch2;
int tmp;
void *ctx; void *ctx;
spdk_allocate_thread(); spdk_allocate_thread();
@ -112,12 +108,12 @@ channel(void)
spdk_io_device_register(&device3, create_cb_null, NULL, 0); spdk_io_device_register(&device3, create_cb_null, NULL, 0);
g_create_cb_calls = 0; g_create_cb_calls = 0;
ch1 = spdk_get_io_channel(&device1, SPDK_IO_PRIORITY_DEFAULT, false, NULL); ch1 = spdk_get_io_channel(&device1, SPDK_IO_PRIORITY_DEFAULT);
CU_ASSERT(g_create_cb_calls == 1); CU_ASSERT(g_create_cb_calls == 1);
SPDK_CU_ASSERT_FATAL(ch1 != NULL); SPDK_CU_ASSERT_FATAL(ch1 != NULL);
g_create_cb_calls = 0; g_create_cb_calls = 0;
ch2 = spdk_get_io_channel(&device1, SPDK_IO_PRIORITY_DEFAULT, false, NULL); ch2 = spdk_get_io_channel(&device1, SPDK_IO_PRIORITY_DEFAULT);
CU_ASSERT(g_create_cb_calls == 0); CU_ASSERT(g_create_cb_calls == 0);
CU_ASSERT(ch1 == ch2); CU_ASSERT(ch1 == ch2);
SPDK_CU_ASSERT_FATAL(ch2 != NULL); SPDK_CU_ASSERT_FATAL(ch2 != NULL);
@ -127,7 +123,7 @@ channel(void)
CU_ASSERT(g_destroy_cb_calls == 0); CU_ASSERT(g_destroy_cb_calls == 0);
g_create_cb_calls = 0; g_create_cb_calls = 0;
ch2 = spdk_get_io_channel(&device2, SPDK_IO_PRIORITY_DEFAULT, false, NULL); ch2 = spdk_get_io_channel(&device2, SPDK_IO_PRIORITY_DEFAULT);
CU_ASSERT(g_create_cb_calls == 1); CU_ASSERT(g_create_cb_calls == 1);
CU_ASSERT(ch1 != ch2); CU_ASSERT(ch1 != ch2);
SPDK_CU_ASSERT_FATAL(ch2 != NULL); SPDK_CU_ASSERT_FATAL(ch2 != NULL);
@ -135,18 +131,6 @@ channel(void)
ctx = spdk_io_channel_get_ctx(ch2); ctx = spdk_io_channel_get_ctx(ch2);
CU_ASSERT(*(uint64_t *)ctx == ctx2); CU_ASSERT(*(uint64_t *)ctx == ctx2);
/*
* Confirm that specifying unique==true will generate a new I/O channel,
* and reuse ch2.
*/
g_create_cb_calls = 0;
tmp = 0x5a5a;
ch3 = spdk_get_io_channel(&device2, SPDK_IO_PRIORITY_DEFAULT, true, &tmp);
CU_ASSERT(g_create_cb_calls == 1);
CU_ASSERT(ch2 != ch3);
SPDK_CU_ASSERT_FATAL(ch3 != NULL);
CU_ASSERT(tmp == ~0x5a5a);
g_destroy_cb_calls = 0; g_destroy_cb_calls = 0;
spdk_put_io_channel(ch1); spdk_put_io_channel(ch1);
CU_ASSERT(g_destroy_cb_calls == 1); CU_ASSERT(g_destroy_cb_calls == 1);
@ -155,19 +139,11 @@ channel(void)
spdk_put_io_channel(ch2); spdk_put_io_channel(ch2);
CU_ASSERT(g_destroy_cb_calls == 1); CU_ASSERT(g_destroy_cb_calls == 1);
g_destroy_cb_calls = 0; ch1 = spdk_get_io_channel(&device3, SPDK_IO_PRIORITY_DEFAULT);
spdk_put_io_channel(ch3);
CU_ASSERT(g_destroy_cb_calls == 1);
ch1 = spdk_get_io_channel(&device3, SPDK_IO_PRIORITY_DEFAULT, false, NULL);
CU_ASSERT(ch1 == NULL); CU_ASSERT(ch1 == NULL);
/* Confirm failure if user specifies an invalid I/O priority. */ /* Confirm failure if user specifies an invalid I/O priority. */
ch1 = spdk_get_io_channel(&device1, SPDK_IO_PRIORITY_DEFAULT + 1, false, NULL); ch1 = spdk_get_io_channel(&device1, SPDK_IO_PRIORITY_DEFAULT + 1);
CU_ASSERT(ch1 == NULL);
/* Confirm failure if user specifies non-NULL unique_ctx for a shared channel. */
ch1 = spdk_get_io_channel(&device1, SPDK_IO_PRIORITY_DEFAULT, false, &tmp);
CU_ASSERT(ch1 == NULL); CU_ASSERT(ch1 == NULL);
spdk_io_device_unregister(&device1); spdk_io_device_unregister(&device1);