Loading include/spdk/bdev.h +4 −1 Original line number Diff line number Diff line Loading @@ -146,6 +146,9 @@ struct spdk_bdev_fn_table { /** Check if the block device supports a specific I/O type. */ bool (*io_type_supported)(struct spdk_bdev *bdev, 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)(struct spdk_bdev *bdev, uint32_t priority); }; /** Blockdev I/O completion status */ Loading Loading @@ -308,5 +311,5 @@ void spdk_bdev_do_work(void *ctx); int spdk_bdev_free_io(struct spdk_bdev_io *bdev_io); int spdk_bdev_reset(struct spdk_bdev *bdev, 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); #endif /* SPDK_BDEV_H_ */ lib/bdev/aio/blockdev_aio.c +34 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include "spdk/conf.h" #include "spdk/fd.h" #include "spdk/log.h" #include "spdk/io_channel.h" static int g_blockdev_count = 0; Loading Loading @@ -314,11 +315,42 @@ 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) { struct blockdev_aio_io_channel *ch = ctx_buf; if (blockdev_aio_initialize_io_channel(ch) != 0) { return -1; } spdk_poller_register(&ch->poller, blockdev_aio_poll, ch, spdk_app_get_current_core(), NULL, 0); return 0; } static void blockdev_aio_destroy_cb(void *io_device, void *ctx_buf) { struct blockdev_aio_io_channel *io_channel = ctx_buf; io_destroy(io_channel->io_ctx); free(io_channel->events); spdk_poller_unregister(&io_channel->poller, NULL); } static struct spdk_io_channel * blockdev_aio_get_io_channel(struct spdk_bdev *bdev, uint32_t priority) { return spdk_get_io_channel(bdev, priority); } static const struct spdk_bdev_fn_table aio_fn_table = { .destruct = blockdev_aio_destruct, .check_io = blockdev_aio_check_io, .submit_request = blockdev_aio_submit_request, .io_type_supported = blockdev_aio_io_type_supported, .get_io_channel = blockdev_aio_get_io_channel, }; static void aio_free_disk(struct file_disk *fdisk) Loading Loading @@ -367,6 +399,8 @@ create_aio_disk(char *fname) g_blockdev_count++; spdk_io_device_register(&fdisk->disk, blockdev_aio_create_cb, blockdev_aio_destroy_cb, sizeof(struct blockdev_aio_io_channel)); spdk_bdev_register(&fdisk->disk); return fdisk; Loading lib/bdev/aio/blockdev_aio.h +1 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ struct blockdev_aio_io_channel { io_context_t io_ctx; long queue_depth; struct io_event *events; struct spdk_poller *poller; }; struct file_disk { Loading lib/bdev/bdev.c +6 −0 Original line number Diff line number Diff line Loading @@ -535,6 +535,12 @@ spdk_bdev_io_type_supported(struct spdk_bdev *bdev, enum spdk_bdev_io_type io_ty return bdev->fn_table->io_type_supported(bdev, io_type); } struct spdk_io_channel * spdk_bdev_get_io_channel(struct spdk_bdev *bdev, uint32_t priority) { return bdev->fn_table->get_io_channel(bdev, priority); } struct spdk_bdev_io * spdk_bdev_read(struct spdk_bdev *bdev, void *buf, uint64_t offset, uint64_t nbytes, Loading lib/bdev/malloc/blockdev_malloc.c +8 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ #include "spdk/endian.h" #include "spdk/log.h" #include "spdk/copy_engine.h" #include "spdk/io_channel.h" #include "bdev_module.h" Loading Loading @@ -266,11 +267,18 @@ blockdev_malloc_io_type_supported(struct spdk_bdev *bdev, enum spdk_bdev_io_type } } static struct spdk_io_channel * blockdev_malloc_get_io_channel(struct spdk_bdev *bdev, uint32_t priority) { return spdk_copy_engine_get_io_channel(priority); } static const struct spdk_bdev_fn_table malloc_fn_table = { .destruct = blockdev_malloc_destruct, .check_io = blockdev_malloc_check_io, .submit_request = blockdev_malloc_submit_request, .io_type_supported = blockdev_malloc_io_type_supported, .get_io_channel = blockdev_malloc_get_io_channel, }; struct malloc_disk *create_malloc_disk(uint64_t num_blocks, uint32_t block_size) Loading Loading
include/spdk/bdev.h +4 −1 Original line number Diff line number Diff line Loading @@ -146,6 +146,9 @@ struct spdk_bdev_fn_table { /** Check if the block device supports a specific I/O type. */ bool (*io_type_supported)(struct spdk_bdev *bdev, 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)(struct spdk_bdev *bdev, uint32_t priority); }; /** Blockdev I/O completion status */ Loading Loading @@ -308,5 +311,5 @@ void spdk_bdev_do_work(void *ctx); int spdk_bdev_free_io(struct spdk_bdev_io *bdev_io); int spdk_bdev_reset(struct spdk_bdev *bdev, 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); #endif /* SPDK_BDEV_H_ */
lib/bdev/aio/blockdev_aio.c +34 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include "spdk/conf.h" #include "spdk/fd.h" #include "spdk/log.h" #include "spdk/io_channel.h" static int g_blockdev_count = 0; Loading Loading @@ -314,11 +315,42 @@ 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) { struct blockdev_aio_io_channel *ch = ctx_buf; if (blockdev_aio_initialize_io_channel(ch) != 0) { return -1; } spdk_poller_register(&ch->poller, blockdev_aio_poll, ch, spdk_app_get_current_core(), NULL, 0); return 0; } static void blockdev_aio_destroy_cb(void *io_device, void *ctx_buf) { struct blockdev_aio_io_channel *io_channel = ctx_buf; io_destroy(io_channel->io_ctx); free(io_channel->events); spdk_poller_unregister(&io_channel->poller, NULL); } static struct spdk_io_channel * blockdev_aio_get_io_channel(struct spdk_bdev *bdev, uint32_t priority) { return spdk_get_io_channel(bdev, priority); } static const struct spdk_bdev_fn_table aio_fn_table = { .destruct = blockdev_aio_destruct, .check_io = blockdev_aio_check_io, .submit_request = blockdev_aio_submit_request, .io_type_supported = blockdev_aio_io_type_supported, .get_io_channel = blockdev_aio_get_io_channel, }; static void aio_free_disk(struct file_disk *fdisk) Loading Loading @@ -367,6 +399,8 @@ create_aio_disk(char *fname) g_blockdev_count++; spdk_io_device_register(&fdisk->disk, blockdev_aio_create_cb, blockdev_aio_destroy_cb, sizeof(struct blockdev_aio_io_channel)); spdk_bdev_register(&fdisk->disk); return fdisk; Loading
lib/bdev/aio/blockdev_aio.h +1 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ struct blockdev_aio_io_channel { io_context_t io_ctx; long queue_depth; struct io_event *events; struct spdk_poller *poller; }; struct file_disk { Loading
lib/bdev/bdev.c +6 −0 Original line number Diff line number Diff line Loading @@ -535,6 +535,12 @@ spdk_bdev_io_type_supported(struct spdk_bdev *bdev, enum spdk_bdev_io_type io_ty return bdev->fn_table->io_type_supported(bdev, io_type); } struct spdk_io_channel * spdk_bdev_get_io_channel(struct spdk_bdev *bdev, uint32_t priority) { return bdev->fn_table->get_io_channel(bdev, priority); } struct spdk_bdev_io * spdk_bdev_read(struct spdk_bdev *bdev, void *buf, uint64_t offset, uint64_t nbytes, Loading
lib/bdev/malloc/blockdev_malloc.c +8 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ #include "spdk/endian.h" #include "spdk/log.h" #include "spdk/copy_engine.h" #include "spdk/io_channel.h" #include "bdev_module.h" Loading Loading @@ -266,11 +267,18 @@ blockdev_malloc_io_type_supported(struct spdk_bdev *bdev, enum spdk_bdev_io_type } } static struct spdk_io_channel * blockdev_malloc_get_io_channel(struct spdk_bdev *bdev, uint32_t priority) { return spdk_copy_engine_get_io_channel(priority); } static const struct spdk_bdev_fn_table malloc_fn_table = { .destruct = blockdev_malloc_destruct, .check_io = blockdev_malloc_check_io, .submit_request = blockdev_malloc_submit_request, .io_type_supported = blockdev_malloc_io_type_supported, .get_io_channel = blockdev_malloc_get_io_channel, }; struct malloc_disk *create_malloc_disk(uint64_t num_blocks, uint32_t block_size) Loading