| 55f94793 | 10-Feb-2023 |
Konrad Sztyber <konrad.sztyber@intel.com> |
bdev: remove spdk_bdev_ext_io_opts from spdk_bdev_io
The spdk_bdev_ext_io_opts structure is used to pass extra options when submitting a bdev IO request, without having to modify/add functions to ha
bdev: remove spdk_bdev_ext_io_opts from spdk_bdev_io
The spdk_bdev_ext_io_opts structure is used to pass extra options when submitting a bdev IO request, without having to modify/add functions to handle new options. Additionally, the structure has a size field to allow adding new fields without breaking the ABI (and thus having to bump up the major version of a library).
It is also a part of spdk_bdev_io and there are several reasons for removing it from that structure:
1. The size field only makes sense in structures that are passed through pointers. And spdk_bdev_ext_io_opts is indeed passed as a pointer to spdk_bdev_{readv,writev}_blocks_ext(), however it is also embedded in spdk_bdev_io (internal.ext_opts_copy), which is also part of the API. It means that each time a new field is added to spdk_bdev_ext_io_opts, the size of spdk_bdev_io will also change, so we will need to bump the major version of libspdk_bdev anyway, thus making spdk_bdev_ext_io_opts.size useless. 2. The size field also makes internal.ext_opts cumbersome to use, as each time one of its fields is accessed, we need to check the size. Currently the code doesn't do that, because all of the existing spdk_bdev_ext_io_opts fields were present when this structure was initially introduced, but we'd need to do check the size before accessing any new fields. 3. spdk_bdev_ext_io_opts has a metadata field, while spdk_bdev_io already has u.bdev.md_buf, which means that we store the same thing in several different places in spdk_bdev_io (u.bdev.md_buf, u.bdev.ext_opts->metadata, internal.ext_opts->metadata).
Therefore, this patch removes all references to spdk_bdev_ext_io_opts from spdk_bdev_io and replaces them with fields (memory_domain, memory_domain_ctx) that were missing in spdk_bdev_io. Unfortunately, this change breaks the API and requires changes in bdev modules that supported spdk_bdev_io.u.bdev.ext_opts.
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: I49b7524eb84d1d4d7f12b7ab025fec36da1ee01f Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16773 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
show more ...
|
| 25156211 | 29-Mar-2022 |
Shuhei Matsumoto <smatsumoto@nvidia.com> |
bdev/delay: Find delay_bdev directly from g_delay_node list
spdk_bdev_get_by_name() uses RB tree and is fast. However it is not secure from race condition. We can use spdk_bdev_open_ext() instead bu
bdev/delay: Find delay_bdev directly from g_delay_node list
spdk_bdev_get_by_name() uses RB tree and is fast. However it is not secure from race condition. We can use spdk_bdev_open_ext() instead but what we want to get is not spdk_bdev but vbdev_delay. vbdev_delay is managed by the g_delay_nodes list.
The g_delay_nodes includes only vbdev_delay. Even if its performance is O(N), it is more intutive, more secure, and small list.
So replace spdk_bdev_get_by_name() by simple list traversal.
Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Change-Id: I3e184066e237e10132523591133900231055b5af Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12069 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: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
show more ...
|