From d969ac445ada6f48815934f067593abfb19332bf Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Thu, 18 May 2017 10:48:04 -0700 Subject: [PATCH] io_channel: Remove per-channel priority This wasn't used anywhere and we currently believe there are superior software-only techniques for controlling quality of service. Change-Id: Icdadd5870ed0629b338c307d2619bbc242c3e7a3 Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/362065 Reviewed-by: Jim Harris --- doc/blob.md | 13 ---------- include/spdk/bdev.h | 2 +- include/spdk/blob.h | 3 +-- include/spdk/blobfs.h | 5 ++-- include/spdk/copy_engine.h | 2 +- include/spdk/io_channel.h | 10 ++----- include/spdk_internal/bdev.h | 2 +- include/spdk_internal/copy_engine.h | 2 +- lib/bdev/aio/blockdev_aio.c | 6 ++--- lib/bdev/bdev.c | 8 +++--- lib/bdev/error/vbdev_error.c | 5 ++-- lib/bdev/malloc/blockdev_malloc.c | 4 +-- lib/bdev/null/blockdev_null.c | 6 ++--- lib/bdev/nvme/blockdev_nvme.c | 6 ++--- lib/bdev/rbd/blockdev_rbd.c | 6 ++--- lib/bdev/split/vbdev_split.c | 4 +-- lib/blob/bdev/blob_bdev.c | 2 +- lib/blob/blobstore.c | 11 ++++---- lib/blobfs/blobfs.c | 26 +++++++++---------- lib/copy/copy_engine.c | 18 ++++++------- lib/copy/ioat/copy_engine_ioat.c | 8 +++--- lib/nvmf/virtual.c | 2 +- lib/scsi/lun.c | 2 +- lib/util/io_channel.c | 13 +++------- test/lib/bdev/bdevio/bdevio.c | 2 +- test/lib/bdev/bdevperf/bdevperf.c | 2 +- test/lib/blob/blob_ut/blob_ut.c | 8 +++--- .../blobfs/blobfs_async_ut/blobfs_async_ut.c | 4 +-- .../blobfs/blobfs_sync_ut/blobfs_sync_ut.c | 6 ++--- test/lib/blobfs/fuse/fuse.c | 2 +- test/lib/nvmf/virtual/virtual_ut.c | 2 +- test/lib/scsi/lun/lun_ut.c | 2 +- test/lib/util/io_channel/io_channel_ut.c | 20 +++++--------- 33 files changed, 88 insertions(+), 126 deletions(-) diff --git a/doc/blob.md b/doc/blob.md index 71f20416f5..c111fda8c5 100644 --- a/doc/blob.md +++ b/doc/blob.md @@ -86,19 +86,6 @@ by simply failing requests with an appropriate error code when the queue is full. This allows the blobstore to easily stick to its commitment to never block, but may require the user to provide their own queueing layer. -The NVMe specification has added support for specifying priorities on the -hardware queues. With a traditional filesystem and storage stack, however, -there is no reasonable way to map an I/O from an arbitrary thread to a -particular hardware queue to be processed with the priority requested. The -blobstore solves this by allowing the user to create channels with priorities, -which map directly to priorities on NVMe hardware queues. The user can then -choose the priority for an I/O by sending it on the appropriate channel. This -is incredibly useful for many databases where data intake operations need to -run with a much higher priority than background scrub and compaction operations -in order to stay within quality of service requirements. Note that many NVMe -devices today do not yet support queue priorities, so the blobstore considers -this feature optional. - ## The Basics The blobstore defines a hierarchy of three units of disk space. The smallest are diff --git a/include/spdk/bdev.h b/include/spdk/bdev.h index a247360e55..3e995b6ed0 100644 --- a/include/spdk/bdev.h +++ b/include/spdk/bdev.h @@ -234,7 +234,7 @@ struct spdk_bdev_io *spdk_bdev_flush(struct spdk_bdev *bdev, struct spdk_io_chan int spdk_bdev_free_io(struct spdk_bdev_io *bdev_io); int spdk_bdev_reset(struct spdk_bdev *bdev, struct spdk_io_channel *ch, enum spdk_bdev_reset_type, spdk_bdev_io_completion_cb cb, void *cb_arg); -struct spdk_io_channel *spdk_bdev_get_io_channel(struct spdk_bdev *bdev, uint32_t priority); +struct spdk_io_channel *spdk_bdev_get_io_channel(struct spdk_bdev *bdev); /** * Get the status of bdev_io as an NVMe status code. diff --git a/include/spdk/blob.h b/include/spdk/blob.h index 9dbf656055..94965f83a0 100644 --- a/include/spdk/blob.h +++ b/include/spdk/blob.h @@ -226,8 +226,7 @@ void spdk_bs_md_sync_blob(struct spdk_blob *blob, /* Close a blob. This will automatically sync. */ void spdk_bs_md_close_blob(struct spdk_blob **blob, spdk_blob_op_complete cb_fn, void *cb_arg); -struct spdk_io_channel *spdk_bs_alloc_io_channel(struct spdk_blob_store *bs, - uint32_t priority); +struct spdk_io_channel *spdk_bs_alloc_io_channel(struct spdk_blob_store *bs); void spdk_bs_free_io_channel(struct spdk_io_channel *channel); diff --git a/include/spdk/blobfs.h b/include/spdk/blobfs.h index 8a2490897f..ee595fbb87 100644 --- a/include/spdk/blobfs.h +++ b/include/spdk/blobfs.h @@ -71,7 +71,7 @@ void spdk_fs_load(struct spdk_bs_dev *dev, fs_send_request_fn send_request_fn, spdk_fs_op_with_handle_complete cb_fn, void *cb_arg); void spdk_fs_unload(struct spdk_filesystem *fs, spdk_fs_op_complete cb_fn, void *cb_arg); -struct spdk_io_channel *spdk_fs_alloc_io_channel(struct spdk_filesystem *fs, uint32_t priority); +struct spdk_io_channel *spdk_fs_alloc_io_channel(struct spdk_filesystem *fs); /* * Allocates an I/O channel suitable for using the synchronous blobfs API. These channels do @@ -79,8 +79,7 @@ struct spdk_io_channel *spdk_fs_alloc_io_channel(struct spdk_filesystem *fs, uin * primitives used to block until any necessary I/O operations are completed on a separate * polling thread. */ -struct spdk_io_channel *spdk_fs_alloc_io_channel_sync(struct spdk_filesystem *fs, - uint32_t priority); +struct spdk_io_channel *spdk_fs_alloc_io_channel_sync(struct spdk_filesystem *fs); void spdk_fs_free_io_channel(struct spdk_io_channel *channel); diff --git a/include/spdk/copy_engine.h b/include/spdk/copy_engine.h index e450387e37..c241ef0707 100644 --- a/include/spdk/copy_engine.h +++ b/include/spdk/copy_engine.h @@ -46,7 +46,7 @@ struct spdk_io_channel; struct spdk_copy_task; -struct spdk_io_channel *spdk_copy_engine_get_io_channel(uint32_t priority); +struct spdk_io_channel *spdk_copy_engine_get_io_channel(void); int64_t spdk_copy_submit(struct spdk_copy_task *copy_req, struct spdk_io_channel *ch, void *dst, void *src, uint64_t nbytes, spdk_copy_completion_cb cb); int64_t spdk_copy_submit_fill(struct spdk_copy_task *copy_req, struct spdk_io_channel *ch, diff --git a/include/spdk/io_channel.h b/include/spdk/io_channel.h index 5313083c9e..f08406408a 100644 --- a/include/spdk/io_channel.h +++ b/include/spdk/io_channel.h @@ -42,11 +42,9 @@ #include "spdk/queue.h" -#define SPDK_IO_PRIORITY_DEFAULT 100 - 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, void *ctx_buf); typedef void (*io_channel_destroy_cb_t)(void *io_device, void *ctx_buf); /** @@ -92,12 +90,8 @@ void spdk_io_device_unregister(void *io_device); * function pointer specified in spdk_io_device_register(). If an I/O channel already * exists for the given io_device on the calling thread, its reference is returned rather * than creating a new I/O channel. - * - * 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 - * SPDK_IO_PRIORITY_DEFAULT. */ -struct spdk_io_channel *spdk_get_io_channel(void *io_device, uint32_t priority); +struct spdk_io_channel *spdk_get_io_channel(void *io_device); /** * \brief Releases a reference to an I/O channel. diff --git a/include/spdk_internal/bdev.h b/include/spdk_internal/bdev.h index 78a42bfd89..22221047e7 100644 --- a/include/spdk_internal/bdev.h +++ b/include/spdk_internal/bdev.h @@ -136,7 +136,7 @@ struct spdk_bdev_fn_table { bool (*io_type_supported)(void *ctx, enum spdk_bdev_io_type); /** Get an I/O channel for the specific bdev for the calling thread. */ - struct spdk_io_channel *(*get_io_channel)(void *ctx, uint32_t priority); + struct spdk_io_channel *(*get_io_channel)(void *ctx); /** * Output driver-specific configuration to a JSON stream. Optional - may be NULL. diff --git a/include/spdk_internal/copy_engine.h b/include/spdk_internal/copy_engine.h index 04a00f9b61..b8d475f244 100644 --- a/include/spdk_internal/copy_engine.h +++ b/include/spdk_internal/copy_engine.h @@ -49,7 +49,7 @@ struct spdk_copy_engine { uint64_t nbytes, spdk_copy_completion_cb cb); int64_t (*fill)(void *cb_arg, struct spdk_io_channel *ch, void *dst, uint8_t fill, uint64_t nbytes, spdk_copy_completion_cb cb); - struct spdk_io_channel *(*get_io_channel)(uint32_t priority); + struct spdk_io_channel *(*get_io_channel)(void); }; struct spdk_copy_module_if { diff --git a/lib/bdev/aio/blockdev_aio.c b/lib/bdev/aio/blockdev_aio.c index 27b8d0393f..73a35e498e 100644 --- a/lib/bdev/aio/blockdev_aio.c +++ b/lib/bdev/aio/blockdev_aio.c @@ -290,7 +290,7 @@ blockdev_aio_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type) } static int -blockdev_aio_create_cb(void *io_device, uint32_t priority, void *ctx_buf) +blockdev_aio_create_cb(void *io_device, void *ctx_buf) { struct blockdev_aio_io_channel *ch = ctx_buf; @@ -314,11 +314,11 @@ blockdev_aio_destroy_cb(void *io_device, void *ctx_buf) } static struct spdk_io_channel * -blockdev_aio_get_io_channel(void *ctx, uint32_t priority) +blockdev_aio_get_io_channel(void *ctx) { struct file_disk *fdisk = ctx; - return spdk_get_io_channel(&fdisk->fd, priority); + return spdk_get_io_channel(&fdisk->fd); } static const struct spdk_bdev_fn_table aio_fn_table = { diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index d3d6f6ca5e..37b9453fe3 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -507,13 +507,13 @@ spdk_bdev_dump_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w } static int -spdk_bdev_channel_create(void *io_device, uint32_t priority, void *ctx_buf) +spdk_bdev_channel_create(void *io_device, void *ctx_buf) { struct spdk_bdev *bdev = io_device; struct spdk_bdev_channel *ch = ctx_buf; ch->bdev = io_device; - ch->channel = bdev->fn_table->get_io_channel(bdev->ctxt, priority); + ch->channel = bdev->fn_table->get_io_channel(bdev->ctxt); return 0; } @@ -527,9 +527,9 @@ spdk_bdev_channel_destroy(void *io_device, void *ctx_buf) } 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) { - return spdk_get_io_channel(bdev, priority); + return spdk_get_io_channel(bdev); } const char * diff --git a/lib/bdev/error/vbdev_error.c b/lib/bdev/error/vbdev_error.c index ff8622f84b..ca22a607eb 100644 --- a/lib/bdev/error/vbdev_error.c +++ b/lib/bdev/error/vbdev_error.c @@ -154,12 +154,11 @@ vbdev_error_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type) } static struct spdk_io_channel * -vbdev_error_get_io_channel(void *ctx, uint32_t priority) +vbdev_error_get_io_channel(void *ctx) { struct vbdev_error_disk *error_disk = ctx; - return error_disk->base_bdev->fn_table->get_io_channel(error_disk->base_bdev, - priority); + return error_disk->base_bdev->fn_table->get_io_channel(error_disk->base_bdev); } static int diff --git a/lib/bdev/malloc/blockdev_malloc.c b/lib/bdev/malloc/blockdev_malloc.c index 02c7a6dfc2..ea17e371a6 100644 --- a/lib/bdev/malloc/blockdev_malloc.c +++ b/lib/bdev/malloc/blockdev_malloc.c @@ -350,9 +350,9 @@ blockdev_malloc_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type) } static struct spdk_io_channel * -blockdev_malloc_get_io_channel(void *ctx, uint32_t priority) +blockdev_malloc_get_io_channel(void *ctx) { - return spdk_copy_engine_get_io_channel(priority); + return spdk_copy_engine_get_io_channel(); } static const struct spdk_bdev_fn_table malloc_fn_table = { diff --git a/lib/bdev/null/blockdev_null.c b/lib/bdev/null/blockdev_null.c index 2ea192b9be..d8f9506e32 100644 --- a/lib/bdev/null/blockdev_null.c +++ b/lib/bdev/null/blockdev_null.c @@ -108,9 +108,9 @@ blockdev_null_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type) } static struct spdk_io_channel * -blockdev_null_get_io_channel(void *ctx, uint32_t priority) +blockdev_null_get_io_channel(void *ctx) { - return spdk_get_io_channel(&g_null_bdev_head, priority); + return spdk_get_io_channel(&g_null_bdev_head); } 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 -null_bdev_create_cb(void *io_device, uint32_t priority, void *ctx_buf) +null_bdev_create_cb(void *io_device, void *ctx_buf) { return 0; } diff --git a/lib/bdev/nvme/blockdev_nvme.c b/lib/bdev/nvme/blockdev_nvme.c index 0324dcaca5..bd01820932 100644 --- a/lib/bdev/nvme/blockdev_nvme.c +++ b/lib/bdev/nvme/blockdev_nvme.c @@ -333,7 +333,7 @@ bdev_nvme_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type) } static int -bdev_nvme_create_cb(void *io_device, uint32_t priority, void *ctx_buf) +bdev_nvme_create_cb(void *io_device, void *ctx_buf) { struct spdk_nvme_ctrlr *ctrlr = io_device; struct nvme_io_channel *ch = ctx_buf; @@ -359,11 +359,11 @@ bdev_nvme_destroy_cb(void *io_device, void *ctx_buf) } static struct spdk_io_channel * -bdev_nvme_get_io_channel(void *ctx, uint32_t priority) +bdev_nvme_get_io_channel(void *ctx) { struct nvme_bdev *nvme_bdev = ctx; - return spdk_get_io_channel(nvme_bdev->nvme_ctrlr->ctrlr, priority); + return spdk_get_io_channel(nvme_bdev->nvme_ctrlr->ctrlr); } static int diff --git a/lib/bdev/rbd/blockdev_rbd.c b/lib/bdev/rbd/blockdev_rbd.c index fee0719bb6..ff98f26d55 100644 --- a/lib/bdev/rbd/blockdev_rbd.c +++ b/lib/bdev/rbd/blockdev_rbd.c @@ -399,7 +399,7 @@ blockdev_rbd_handle(void *arg) } static int -blockdev_rbd_create_cb(void *io_device, uint32_t priority, void *ctx_buf) +blockdev_rbd_create_cb(void *io_device, void *ctx_buf) { struct blockdev_rbd_io_channel *ch = ctx_buf; int ret; @@ -461,11 +461,11 @@ blockdev_rbd_destroy_cb(void *io_device, void *ctx_buf) } static struct spdk_io_channel * -blockdev_rbd_get_io_channel(void *ctx, uint32_t priority) +blockdev_rbd_get_io_channel(void *ctx) { struct blockdev_rbd *rbd_bdev = ctx; - return spdk_get_io_channel(&rbd_bdev->info, priority); + return spdk_get_io_channel(&rbd_bdev->info); } static const struct spdk_bdev_fn_table rbd_fn_table = { diff --git a/lib/bdev/split/vbdev_split.c b/lib/bdev/split/vbdev_split.c index 44f592d8b8..36a7972018 100644 --- a/lib/bdev/split/vbdev_split.c +++ b/lib/bdev/split/vbdev_split.c @@ -194,11 +194,11 @@ vbdev_split_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type) } static struct spdk_io_channel * -vbdev_split_get_io_channel(void *ctx, uint32_t priority) +vbdev_split_get_io_channel(void *ctx) { struct split_disk *split_disk = ctx; - return split_disk->base_bdev->fn_table->get_io_channel(split_disk->base_bdev, priority); + return split_disk->base_bdev->fn_table->get_io_channel(split_disk->base_bdev); } static int diff --git a/lib/blob/bdev/blob_bdev.c b/lib/blob/bdev/blob_bdev.c index 0eb34f3694..aa83580154 100644 --- a/lib/blob/bdev/blob_bdev.c +++ b/lib/blob/bdev/blob_bdev.c @@ -122,7 +122,7 @@ bdev_blob_create_channel(struct spdk_bs_dev *dev) { struct spdk_bdev *bdev = __get_bdev(dev); - return spdk_bdev_get_io_channel(bdev, SPDK_IO_PRIORITY_DEFAULT); + return spdk_bdev_get_io_channel(bdev); } static void diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index 977382dc5c..26fcfea425 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -1077,7 +1077,7 @@ _spdk_bs_channel_create(struct spdk_blob_store *bs, struct spdk_bs_channel *chan } static int -_spdk_bs_md_channel_create(void *io_device, uint32_t priority, void *ctx_buf) +_spdk_bs_md_channel_create(void *io_device, void *ctx_buf) { struct spdk_blob_store *bs; 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) } static int -_spdk_bs_io_channel_create(void *io_device, uint32_t priority, void *ctx_buf) +_spdk_bs_io_channel_create(void *io_device, void *ctx_buf) { struct spdk_blob_store *bs; struct spdk_bs_channel *channel = ctx_buf; @@ -1761,7 +1761,7 @@ spdk_bs_free_cluster_count(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); return 0; } @@ -2101,10 +2101,9 @@ void spdk_bs_md_close_blob(struct spdk_blob **b, /* END spdk_bs_md_close_blob */ -struct spdk_io_channel *spdk_bs_alloc_io_channel(struct spdk_blob_store *bs, - uint32_t priority) +struct spdk_io_channel *spdk_bs_alloc_io_channel(struct spdk_blob_store *bs) { - return spdk_get_io_channel(&bs->io_target, priority); + return spdk_get_io_channel(&bs->io_target); } void spdk_bs_free_io_channel(struct spdk_io_channel *channel) diff --git a/lib/blobfs/blobfs.c b/lib/blobfs/blobfs.c index 6ffcc33f21..7d7396b896 100644 --- a/lib/blobfs/blobfs.c +++ b/lib/blobfs/blobfs.c @@ -281,7 +281,7 @@ _spdk_fs_channel_create(struct spdk_filesystem *fs, struct spdk_fs_channel *chan } static int -_spdk_fs_md_channel_create(void *io_device, uint32_t priority, void *ctx_buf) +_spdk_fs_md_channel_create(void *io_device, void *ctx_buf) { struct spdk_filesystem *fs; struct spdk_fs_channel *channel = ctx_buf; @@ -292,7 +292,7 @@ _spdk_fs_md_channel_create(void *io_device, uint32_t priority, void *ctx_buf) } static int -_spdk_fs_sync_channel_create(void *io_device, uint32_t priority, void *ctx_buf) +_spdk_fs_sync_channel_create(void *io_device, void *ctx_buf) { struct spdk_filesystem *fs; struct spdk_fs_channel *channel = ctx_buf; @@ -303,7 +303,7 @@ _spdk_fs_sync_channel_create(void *io_device, uint32_t priority, void *ctx_buf) } static int -_spdk_fs_io_channel_create(void *io_device, uint32_t priority, void *ctx_buf) +_spdk_fs_io_channel_create(void *io_device, void *ctx_buf) { struct spdk_filesystem *fs; struct spdk_fs_channel *channel = ctx_buf; @@ -335,11 +335,9 @@ common_fs_bs_init(struct spdk_filesystem *fs, struct spdk_blob_store *bs) { fs->bs = bs; fs->bs_opts.cluster_sz = spdk_bs_get_cluster_size(bs); - fs->md_target.md_fs_channel->bs_channel = spdk_bs_alloc_io_channel(fs->bs, - SPDK_IO_PRIORITY_DEFAULT); + fs->md_target.md_fs_channel->bs_channel = spdk_bs_alloc_io_channel(fs->bs); fs->md_target.md_fs_channel->send_request = __send_request_direct; - fs->sync_target.sync_fs_channel->bs_channel = spdk_bs_alloc_io_channel(fs->bs, - SPDK_IO_PRIORITY_DEFAULT); + fs->sync_target.sync_fs_channel->bs_channel = spdk_bs_alloc_io_channel(fs->bs); fs->sync_target.sync_fs_channel->send_request = __send_request_direct; pthread_mutex_lock(&g_cache_init_lock); @@ -385,13 +383,13 @@ fs_alloc(struct spdk_bs_dev *dev, fs_send_request_fn send_request_fn) fs->md_target.max_ops = 512; spdk_io_device_register(&fs->md_target, _spdk_fs_md_channel_create, _spdk_fs_channel_destroy, sizeof(struct spdk_fs_channel)); - fs->md_target.md_io_channel = spdk_get_io_channel(&fs->md_target, SPDK_IO_PRIORITY_DEFAULT); + fs->md_target.md_io_channel = spdk_get_io_channel(&fs->md_target); fs->md_target.md_fs_channel = spdk_io_channel_get_ctx(fs->md_target.md_io_channel); fs->sync_target.max_ops = 512; spdk_io_device_register(&fs->sync_target, _spdk_fs_sync_channel_create, _spdk_fs_channel_destroy, 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); fs->sync_target.sync_fs_channel = spdk_io_channel_get_ctx(fs->sync_target.sync_io_channel); fs->io_target.max_ops = 512; @@ -1437,26 +1435,26 @@ spdk_file_read_async(struct spdk_file *file, struct spdk_io_channel *channel, } struct spdk_io_channel * -spdk_fs_alloc_io_channel(struct spdk_filesystem *fs, uint32_t priority) +spdk_fs_alloc_io_channel(struct spdk_filesystem *fs) { struct spdk_io_channel *io_channel; struct spdk_fs_channel *fs_channel; - io_channel = spdk_get_io_channel(&fs->io_target, priority); + io_channel = spdk_get_io_channel(&fs->io_target); 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); fs_channel->send_request = __send_request_direct; return io_channel; } struct spdk_io_channel * -spdk_fs_alloc_io_channel_sync(struct spdk_filesystem *fs, uint32_t priority) +spdk_fs_alloc_io_channel_sync(struct spdk_filesystem *fs) { struct spdk_io_channel *io_channel; struct spdk_fs_channel *fs_channel; - io_channel = spdk_get_io_channel(&fs->io_target, priority); + io_channel = spdk_get_io_channel(&fs->io_target); fs_channel = spdk_io_channel_get_ctx(io_channel); fs_channel->send_request = fs->send_request; diff --git a/lib/copy/copy_engine.c b/lib/copy/copy_engine.c index 06812c6b54..1acac8002a 100644 --- a/lib/copy/copy_engine.c +++ b/lib/copy/copy_engine.c @@ -130,7 +130,7 @@ mem_copy_fill(void *cb_arg, struct spdk_io_channel *ch, void *dst, uint8_t fill, return nbytes; } -static struct spdk_io_channel *mem_get_io_channel(uint32_t priority); +static struct spdk_io_channel *mem_get_io_channel(void); static struct spdk_copy_engine memcpy_copy_engine = { .copy = mem_copy_submit, @@ -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, void *ctx_buf) { return 0; } @@ -149,9 +149,9 @@ 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(void) { - return spdk_get_io_channel(&memcpy_copy_engine, priority); + return spdk_get_io_channel(&memcpy_copy_engine); } static size_t @@ -175,19 +175,19 @@ 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, void *ctx_buf) { struct copy_io_channel *copy_ch = ctx_buf; if (hw_copy_engine != NULL) { - copy_ch->ch = hw_copy_engine->get_io_channel(priority); + copy_ch->ch = hw_copy_engine->get_io_channel(); if (copy_ch->ch != NULL) { copy_ch->engine = hw_copy_engine; return 0; } } - copy_ch->ch = mem_copy_engine->get_io_channel(priority); + copy_ch->ch = mem_copy_engine->get_io_channel(); assert(copy_ch->ch != NULL); copy_ch->engine = mem_copy_engine; return 0; @@ -202,9 +202,9 @@ copy_destroy_cb(void *io_device, void *ctx_buf) } struct spdk_io_channel * -spdk_copy_engine_get_io_channel(uint32_t priority) +spdk_copy_engine_get_io_channel(void) { - return spdk_get_io_channel(&spdk_copy_module_list, priority); + return spdk_get_io_channel(&spdk_copy_module_list); } static int diff --git a/lib/copy/ioat/copy_engine_ioat.c b/lib/copy/ioat/copy_engine_ioat.c index a63083c06e..9810f4f335 100644 --- a/lib/copy/ioat/copy_engine_ioat.c +++ b/lib/copy/ioat/copy_engine_ioat.c @@ -182,7 +182,7 @@ ioat_poll(void *arg) spdk_ioat_process_events(chan); } -static struct spdk_io_channel *ioat_get_io_channel(uint32_t priority); +static struct spdk_io_channel *ioat_get_io_channel(void); static struct spdk_copy_engine ioat_copy_engine = { .copy = ioat_copy_submit, @@ -191,7 +191,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, void *ctx_buf) { struct ioat_io_channel *ch = ctx_buf; struct ioat_device *ioat_dev; @@ -218,9 +218,9 @@ ioat_destroy_cb(void *io_device, void *ctx_buf) } static struct spdk_io_channel * -ioat_get_io_channel(uint32_t priority) +ioat_get_io_channel(void) { - return spdk_get_io_channel(&ioat_copy_engine, priority); + return spdk_get_io_channel(&ioat_copy_engine); } struct ioat_probe_ctx { diff --git a/lib/nvmf/virtual.c b/lib/nvmf/virtual.c index f4e03b3418..8116c7efb4 100644 --- a/lib/nvmf/virtual.c +++ b/lib/nvmf/virtual.c @@ -533,7 +533,7 @@ nvmf_virtual_ctrlr_attach(struct spdk_nvmf_subsystem *subsystem) for (i = 0; i < subsystem->dev.virt.ns_count; i++) { bdev = subsystem->dev.virt.ns_list[i]; - ch = spdk_bdev_get_io_channel(bdev, SPDK_IO_PRIORITY_DEFAULT); + ch = spdk_bdev_get_io_channel(bdev); if (ch == NULL) { SPDK_ERRLOG("io_channel allocation failed\n"); return -1; diff --git a/lib/scsi/lun.c b/lib/scsi/lun.c index 51179828a6..a938ba44c3 100644 --- a/lib/scsi/lun.c +++ b/lib/scsi/lun.c @@ -368,7 +368,7 @@ int spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_lun *lun) lun->lcore = spdk_env_get_current_core(); - lun->io_channel = spdk_bdev_get_io_channel(lun->bdev, SPDK_IO_PRIORITY_DEFAULT); + lun->io_channel = spdk_bdev_get_io_channel(lun->bdev); if (lun->io_channel == NULL) { return -1; } diff --git a/lib/util/io_channel.c b/lib/util/io_channel.c index 34b2cfc8aa..36196c0e11 100644 --- a/lib/util/io_channel.c +++ b/lib/util/io_channel.c @@ -52,7 +52,6 @@ struct spdk_io_channel { pthread_t thread_id; void *io_device; uint32_t ref; - uint32_t priority; TAILQ_ENTRY(spdk_io_channel) tailq; io_channel_destroy_cb_t destroy_cb; @@ -127,17 +126,12 @@ spdk_io_device_unregister(void *io_device) } struct spdk_io_channel * -spdk_get_io_channel(void *io_device, uint32_t priority) +spdk_get_io_channel(void *io_device) { struct spdk_io_channel *ch; struct io_device *dev; int rc; - if (priority != SPDK_IO_PRIORITY_DEFAULT) { - SPDK_ERRLOG("priority must be set to SPDK_IO_PRIORITY_DEFAULT\n"); - return NULL; - } - pthread_mutex_lock(&g_devlist_mutex); TAILQ_FOREACH(dev, &g_io_devices, tailq) { if (dev->io_device_ctx == io_device) { @@ -152,7 +146,7 @@ spdk_get_io_channel(void *io_device, uint32_t priority) pthread_mutex_unlock(&g_devlist_mutex); TAILQ_FOREACH(ch, &g_io_channels, tailq) { - if (ch->io_device == io_device && ch->priority == priority) { + if (ch->io_device == io_device) { ch->ref++; /* * An I/O channel already exists for this device on this @@ -167,7 +161,7 @@ spdk_get_io_channel(void *io_device, uint32_t priority) SPDK_ERRLOG("could not calloc spdk_io_channel\n"); return NULL; } - rc = dev->create_cb(io_device, priority, (uint8_t *)ch + sizeof(*ch)); + rc = dev->create_cb(io_device, (uint8_t *)ch + sizeof(*ch)); if (rc == -1) { free(ch); return NULL; @@ -176,7 +170,6 @@ spdk_get_io_channel(void *io_device, uint32_t priority) ch->io_device = io_device; ch->destroy_cb = dev->destroy_cb; ch->thread_id = pthread_self(); - ch->priority = priority; ch->ref = 1; TAILQ_INSERT_TAIL(&g_io_channels, ch, tailq); return ch; diff --git a/test/lib/bdev/bdevio/bdevio.c b/test/lib/bdev/bdevio/bdevio.c index 60b3bcc031..7867f9489f 100644 --- a/test/lib/bdev/bdevio/bdevio.c +++ b/test/lib/bdev/bdevio/bdevio.c @@ -94,7 +94,7 @@ __get_io_channel(void *arg1, void *arg2) { struct io_target *target = arg1; - target->ch = spdk_bdev_get_io_channel(target->bdev, SPDK_IO_PRIORITY_DEFAULT); + target->ch = spdk_bdev_get_io_channel(target->bdev); wake_ut_thread(); } diff --git a/test/lib/bdev/bdevperf/bdevperf.c b/test/lib/bdev/bdevperf/bdevperf.c index 412ae7782f..3a9cd0f570 100644 --- a/test/lib/bdev/bdevperf/bdevperf.c +++ b/test/lib/bdev/bdevperf/bdevperf.c @@ -406,7 +406,7 @@ bdevperf_submit_on_core(void *arg1, void *arg2) /* Submit initial I/O for each block device. Each time one * completes, another will be submitted. */ while (target != NULL) { - target->ch = spdk_bdev_get_io_channel(target->bdev, SPDK_IO_PRIORITY_DEFAULT); + target->ch = spdk_bdev_get_io_channel(target->bdev); /* Start a timer to stop this I/O chain when the run is over */ spdk_poller_register(&target->run_timer, end_target, target, target->lcore, diff --git a/test/lib/blob/blob_ut/blob_ut.c b/test/lib/blob/blob_ut/blob_ut.c index 033484ada5..69b9772f26 100644 --- a/test/lib/blob/blob_ut/blob_ut.c +++ b/test/lib/blob/blob_ut/blob_ut.c @@ -309,7 +309,7 @@ channel_ops(void) SPDK_CU_ASSERT_FATAL(g_bs != NULL); bs = g_bs; - channel = spdk_bs_alloc_io_channel(bs, SPDK_IO_PRIORITY_DEFAULT); + channel = spdk_bs_alloc_io_channel(bs); CU_ASSERT(channel != NULL); spdk_bs_free_io_channel(channel); @@ -340,7 +340,7 @@ blob_write(void) pages_per_cluster = spdk_bs_get_cluster_size(bs) / spdk_bs_get_page_size(bs); - channel = spdk_bs_alloc_io_channel(bs, SPDK_IO_PRIORITY_DEFAULT); + channel = spdk_bs_alloc_io_channel(bs); CU_ASSERT(channel != NULL); spdk_bs_md_create_blob(bs, blob_op_with_id_complete, NULL); @@ -406,7 +406,7 @@ blob_read(void) pages_per_cluster = spdk_bs_get_cluster_size(bs) / spdk_bs_get_page_size(bs); - channel = spdk_bs_alloc_io_channel(bs, SPDK_IO_PRIORITY_DEFAULT); + channel = spdk_bs_alloc_io_channel(bs); CU_ASSERT(channel != NULL); spdk_bs_md_create_blob(bs, blob_op_with_id_complete, NULL); @@ -470,7 +470,7 @@ blob_rw_verify(void) SPDK_CU_ASSERT_FATAL(g_bs != NULL); bs = g_bs; - channel = spdk_bs_alloc_io_channel(bs, SPDK_IO_PRIORITY_DEFAULT); + channel = spdk_bs_alloc_io_channel(bs); CU_ASSERT(channel != NULL); spdk_bs_md_create_blob(bs, blob_op_with_id_complete, NULL); diff --git a/test/lib/blobfs/blobfs_async_ut/blobfs_async_ut.c b/test/lib/blobfs/blobfs_async_ut/blobfs_async_ut.c index 80a7a0fe9e..18c31e617f 100644 --- a/test/lib/blobfs/blobfs_async_ut/blobfs_async_ut.c +++ b/test/lib/blobfs/blobfs_async_ut/blobfs_async_ut.c @@ -384,7 +384,7 @@ channel_ops(void) CU_ASSERT(g_fserrno == 0); fs = g_fs; - channel = spdk_fs_alloc_io_channel(fs, SPDK_IO_PRIORITY_DEFAULT); + channel = spdk_fs_alloc_io_channel(fs); CU_ASSERT(channel != NULL); spdk_fs_free_io_channel(channel); @@ -412,7 +412,7 @@ channel_ops_sync(void) CU_ASSERT(g_fserrno == 0); fs = g_fs; - channel = spdk_fs_alloc_io_channel_sync(fs, SPDK_IO_PRIORITY_DEFAULT); + channel = spdk_fs_alloc_io_channel_sync(fs); CU_ASSERT(channel != NULL); spdk_fs_free_io_channel(channel); diff --git a/test/lib/blobfs/blobfs_sync_ut/blobfs_sync_ut.c b/test/lib/blobfs/blobfs_sync_ut/blobfs_sync_ut.c index 197507e06e..09bf3a1fd6 100644 --- a/test/lib/blobfs/blobfs_sync_ut/blobfs_sync_ut.c +++ b/test/lib/blobfs/blobfs_sync_ut/blobfs_sync_ut.c @@ -145,7 +145,7 @@ cache_write(void) ut_send_request(_fs_init, NULL); spdk_allocate_thread(); - channel = spdk_fs_alloc_io_channel_sync(g_fs, SPDK_IO_PRIORITY_DEFAULT); + channel = spdk_fs_alloc_io_channel_sync(g_fs); rc = spdk_fs_open_file(g_fs, channel, "testfile", SPDK_BLOBFS_OPEN_CREATE, &g_file); CU_ASSERT(rc == 0); @@ -183,7 +183,7 @@ cache_write_null_buffer(void) ut_send_request(_fs_init, NULL); spdk_allocate_thread(); - channel = spdk_fs_alloc_io_channel_sync(g_fs, SPDK_IO_PRIORITY_DEFAULT); + channel = spdk_fs_alloc_io_channel_sync(g_fs); rc = spdk_fs_open_file(g_fs, channel, "testfile", SPDK_BLOBFS_OPEN_CREATE, &g_file); CU_ASSERT(rc == 0); @@ -215,7 +215,7 @@ cache_append_no_cache(void) ut_send_request(_fs_init, NULL); spdk_allocate_thread(); - channel = spdk_fs_alloc_io_channel_sync(g_fs, SPDK_IO_PRIORITY_DEFAULT); + channel = spdk_fs_alloc_io_channel_sync(g_fs); rc = spdk_fs_open_file(g_fs, channel, "testfile", SPDK_BLOBFS_OPEN_CREATE, &g_file); CU_ASSERT(rc == 0); diff --git a/test/lib/blobfs/fuse/fuse.c b/test/lib/blobfs/fuse/fuse.c index 1d6e3d9afe..efe3cae25e 100644 --- a/test/lib/blobfs/fuse/fuse.c +++ b/test/lib/blobfs/fuse/fuse.c @@ -293,7 +293,7 @@ init_cb(void *ctx, struct spdk_filesystem *fs, int fserrno) struct spdk_event *event; g_fs = fs; - g_channel = spdk_fs_alloc_io_channel_sync(g_fs, SPDK_IO_PRIORITY_DEFAULT); + g_channel = spdk_fs_alloc_io_channel_sync(g_fs); event = spdk_event_allocate(1, start_fuse_fn, NULL, NULL); spdk_event_call(event); } diff --git a/test/lib/nvmf/virtual/virtual_ut.c b/test/lib/nvmf/virtual/virtual_ut.c index aacf19fe54..4ef1568763 100644 --- a/test/lib/nvmf/virtual/virtual_ut.c +++ b/test/lib/nvmf/virtual/virtual_ut.c @@ -118,7 +118,7 @@ spdk_bdev_get_num_blocks(const struct spdk_bdev *bdev) } 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) { return NULL; } diff --git a/test/lib/scsi/lun/lun_ut.c b/test/lib/scsi/lun/lun_ut.c index c50aee5d0a..536330dedc 100644 --- a/test/lib/scsi/lun/lun_ut.c +++ b/test/lib/scsi/lun/lun_ut.c @@ -188,7 +188,7 @@ void spdk_bdev_unregister(struct spdk_bdev *bdev) } 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) { return NULL; } diff --git a/test/lib/util/io_channel/io_channel_ut.c b/test/lib/util/io_channel/io_channel_ut.c index 2005d7f2bb..08aa50b113 100644 --- a/test/lib/util/io_channel/io_channel_ut.c +++ b/test/lib/util/io_channel/io_channel_ut.c @@ -55,10 +55,9 @@ static int g_create_cb_calls = 0; static int g_destroy_cb_calls = 0; static int -create_cb_1(void *io_device, uint32_t priority, void *ctx_buf) +create_cb_1(void *io_device, void *ctx_buf) { CU_ASSERT(io_device == &device1); - CU_ASSERT(priority == SPDK_IO_PRIORITY_DEFAULT); *(uint64_t *)ctx_buf = ctx1; g_create_cb_calls++; return 0; @@ -73,10 +72,9 @@ destroy_cb_1(void *io_device, void *ctx_buf) } static int -create_cb_2(void *io_device, uint32_t priority, void *ctx_buf) +create_cb_2(void *io_device, void *ctx_buf) { CU_ASSERT(io_device == &device2); - CU_ASSERT(priority == SPDK_IO_PRIORITY_DEFAULT); *(uint64_t *)ctx_buf = ctx2; g_create_cb_calls++; return 0; @@ -91,7 +89,7 @@ destroy_cb_2(void *io_device, void *ctx_buf) } static int -create_cb_null(void *io_device, uint32_t priority, void *ctx_buf) +create_cb_null(void *io_device, void *ctx_buf) { return -1; } @@ -108,12 +106,12 @@ channel(void) spdk_io_device_register(&device3, create_cb_null, NULL, 0); g_create_cb_calls = 0; - ch1 = spdk_get_io_channel(&device1, SPDK_IO_PRIORITY_DEFAULT); + ch1 = spdk_get_io_channel(&device1); CU_ASSERT(g_create_cb_calls == 1); SPDK_CU_ASSERT_FATAL(ch1 != NULL); g_create_cb_calls = 0; - ch2 = spdk_get_io_channel(&device1, SPDK_IO_PRIORITY_DEFAULT); + ch2 = spdk_get_io_channel(&device1); CU_ASSERT(g_create_cb_calls == 0); CU_ASSERT(ch1 == ch2); SPDK_CU_ASSERT_FATAL(ch2 != NULL); @@ -123,7 +121,7 @@ channel(void) CU_ASSERT(g_destroy_cb_calls == 0); g_create_cb_calls = 0; - ch2 = spdk_get_io_channel(&device2, SPDK_IO_PRIORITY_DEFAULT); + ch2 = spdk_get_io_channel(&device2); CU_ASSERT(g_create_cb_calls == 1); CU_ASSERT(ch1 != ch2); SPDK_CU_ASSERT_FATAL(ch2 != NULL); @@ -139,11 +137,7 @@ channel(void) spdk_put_io_channel(ch2); CU_ASSERT(g_destroy_cb_calls == 1); - ch1 = spdk_get_io_channel(&device3, SPDK_IO_PRIORITY_DEFAULT); - CU_ASSERT(ch1 == NULL); - - /* Confirm failure if user specifies an invalid I/O priority. */ - ch1 = spdk_get_io_channel(&device1, SPDK_IO_PRIORITY_DEFAULT + 1); + ch1 = spdk_get_io_channel(&device3); CU_ASSERT(ch1 == NULL); spdk_io_device_unregister(&device1);