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 <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/362065 Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
94e1719bf5
commit
d969ac445a
13
doc/blob.md
13
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
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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 {
|
||||
|
@ -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 = {
|
||||
|
@ -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 *
|
||||
|
@ -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
|
||||
|
@ -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 = {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 = {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user