bdev: Add ext_opts in public bdev_io section
Bdev modules must not access internal bdev_io structure, so add a new pointer in a public section. Pointer in internal section will be used in next patch Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com> Change-Id: Ib631563015b3e5fa9300d22b7ae59d8db43c8275 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10421 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
c03985a068
commit
c20dd8afee
@ -607,6 +607,9 @@ struct spdk_bdev_io {
|
||||
/** Starting offset (in blocks) of the bdev for this I/O. */
|
||||
uint64_t offset_blocks;
|
||||
|
||||
/** Pointer to user's ext opts to be used by bdev modules */
|
||||
struct spdk_bdev_ext_io_opts *ext_opts;
|
||||
|
||||
/** stored user callback in case we split the I/O and use a temporary callback */
|
||||
spdk_bdev_io_completion_cb stored_user_cb;
|
||||
|
||||
|
@ -4013,6 +4013,7 @@ bdev_read_blocks_with_md(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch
|
||||
bdev_io->u.bdev.md_buf = md_buf;
|
||||
bdev_io->u.bdev.num_blocks = num_blocks;
|
||||
bdev_io->u.bdev.offset_blocks = offset_blocks;
|
||||
bdev_io->u.bdev.ext_opts = NULL;
|
||||
bdev_io_init(bdev_io, bdev, cb_arg, cb);
|
||||
|
||||
bdev_io_submit(bdev_io);
|
||||
@ -4108,6 +4109,7 @@ bdev_readv_blocks_with_md(struct spdk_bdev_desc *desc, struct spdk_io_channel *c
|
||||
bdev_io->u.bdev.offset_blocks = offset_blocks;
|
||||
bdev_io_init(bdev_io, bdev, cb_arg, cb);
|
||||
bdev_io->internal.ext_opts = opts;
|
||||
bdev_io->u.bdev.ext_opts = opts;
|
||||
|
||||
bdev_io_submit(bdev_io);
|
||||
return 0;
|
||||
@ -4197,6 +4199,7 @@ bdev_write_blocks_with_md(struct spdk_bdev_desc *desc, struct spdk_io_channel *c
|
||||
bdev_io->u.bdev.md_buf = md_buf;
|
||||
bdev_io->u.bdev.num_blocks = num_blocks;
|
||||
bdev_io->u.bdev.offset_blocks = offset_blocks;
|
||||
bdev_io->u.bdev.ext_opts = NULL;
|
||||
bdev_io_init(bdev_io, bdev, cb_arg, cb);
|
||||
|
||||
bdev_io_submit(bdev_io);
|
||||
@ -4282,6 +4285,7 @@ bdev_writev_blocks_with_md(struct spdk_bdev_desc *desc, struct spdk_io_channel *
|
||||
bdev_io->u.bdev.offset_blocks = offset_blocks;
|
||||
bdev_io_init(bdev_io, bdev, cb_arg, cb);
|
||||
bdev_io->internal.ext_opts = opts;
|
||||
bdev_io->u.bdev.ext_opts = opts;
|
||||
|
||||
bdev_io_submit(bdev_io);
|
||||
return 0;
|
||||
|
@ -1954,7 +1954,7 @@ bdev_nvme_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
|
||||
bdev_io->u.bdev.num_blocks,
|
||||
bdev_io->u.bdev.offset_blocks,
|
||||
bdev->dif_check_flags,
|
||||
bdev_io->internal.ext_opts);
|
||||
bdev_io->u.bdev.ext_opts);
|
||||
|
||||
exit:
|
||||
if (spdk_unlikely(ret != 0)) {
|
||||
@ -1993,7 +1993,7 @@ bdev_nvme_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_i
|
||||
bdev_io->u.bdev.num_blocks,
|
||||
bdev_io->u.bdev.offset_blocks,
|
||||
bdev->dif_check_flags,
|
||||
bdev_io->internal.ext_opts);
|
||||
bdev_io->u.bdev.ext_opts);
|
||||
} else {
|
||||
spdk_bdev_io_get_buf(bdev_io, bdev_nvme_get_buf_cb,
|
||||
bdev_io->u.bdev.num_blocks * bdev->blocklen);
|
||||
@ -2008,7 +2008,7 @@ bdev_nvme_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_i
|
||||
bdev_io->u.bdev.num_blocks,
|
||||
bdev_io->u.bdev.offset_blocks,
|
||||
bdev->dif_check_flags,
|
||||
bdev_io->internal.ext_opts);
|
||||
bdev_io->u.bdev.ext_opts);
|
||||
break;
|
||||
case SPDK_BDEV_IO_TYPE_COMPARE:
|
||||
rc = bdev_nvme_comparev(nbdev_io,
|
||||
|
@ -2265,7 +2265,7 @@ test_submit_nvme_cmd(void)
|
||||
ut_test_submit_fused_nvme_cmd(ch, bdev_io);
|
||||
|
||||
/* Verify that ext NVME API is called if bdev_io ext_opts is set */
|
||||
bdev_io->internal.ext_opts = &ext_io_opts;
|
||||
bdev_io->u.bdev.ext_opts = &ext_io_opts;
|
||||
g_ut_readv_ext_called = false;
|
||||
ut_test_submit_nvme_cmd(ch, bdev_io, SPDK_BDEV_IO_TYPE_READ);
|
||||
CU_ASSERT(g_ut_readv_ext_called == true);
|
||||
@ -2275,7 +2275,7 @@ test_submit_nvme_cmd(void)
|
||||
ut_test_submit_nvme_cmd(ch, bdev_io, SPDK_BDEV_IO_TYPE_WRITE);
|
||||
CU_ASSERT(g_ut_writev_ext_called == true);
|
||||
g_ut_writev_ext_called = false;
|
||||
bdev_io->internal.ext_opts = NULL;
|
||||
bdev_io->u.bdev.ext_opts = NULL;
|
||||
|
||||
ut_test_submit_admin_cmd(ch, bdev_io, ctrlr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user