diff --git a/include/spdk/bdev_module.h b/include/spdk/bdev_module.h index 596fd2910..c87411fc8 100644 --- a/include/spdk/bdev_module.h +++ b/include/spdk/bdev_module.h @@ -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; diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index aa7662441..395e3779f 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -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; diff --git a/module/bdev/nvme/bdev_nvme.c b/module/bdev/nvme/bdev_nvme.c index 9bfd30745..5bde7a5e2 100644 --- a/module/bdev/nvme/bdev_nvme.c +++ b/module/bdev/nvme/bdev_nvme.c @@ -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, diff --git a/test/unit/lib/bdev/nvme/bdev_nvme.c/bdev_nvme_ut.c b/test/unit/lib/bdev/nvme/bdev_nvme.c/bdev_nvme_ut.c index 95d17d691..a79954f74 100644 --- a/test/unit/lib/bdev/nvme/bdev_nvme.c/bdev_nvme_ut.c +++ b/test/unit/lib/bdev/nvme/bdev_nvme.c/bdev_nvme_ut.c @@ -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);