blob: add spdk_blob_get_esnap_bs_dev()
While getting memory domains, vbdev_lvol will need to be able to access the bdev that acts as the lvol's external snapshot. The introduction of spdk_blob_get_esnap_bs_dev() facilitates this access. Signed-off-by: Mike Gerdts <mgerdts@nvidia.com> Change-Id: I604c957a468392d40b824c3d2afb00cbfe89cd21 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16429 Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
793be3a0f5
commit
510b723ba9
@ -1134,6 +1134,15 @@ void spdk_bs_set_bstype(struct spdk_blob_store *bs, struct spdk_bs_type bstype);
|
||||
void spdk_blob_set_esnap_bs_dev(struct spdk_blob *blob, struct spdk_bs_dev *back_bs_dev,
|
||||
spdk_blob_op_complete cb_fn, void *cb_arg);
|
||||
|
||||
/**
|
||||
* Get the existing external snapshot device
|
||||
*
|
||||
* \param blob A blob that is an esnap clone
|
||||
*
|
||||
* \return NULL if the blob is not an esnap clone, else the current external snapshot device.
|
||||
*/
|
||||
struct spdk_bs_dev *spdk_blob_get_esnap_bs_dev(const struct spdk_blob *blob);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -9104,5 +9104,16 @@ spdk_blob_set_esnap_bs_dev(struct spdk_blob *blob, struct spdk_bs_dev *back_bs_d
|
||||
blob_freeze_io(blob, blob_frozen_destroy_esnap_channels, ctx);
|
||||
}
|
||||
|
||||
struct spdk_bs_dev *
|
||||
spdk_blob_get_esnap_bs_dev(const struct spdk_blob *blob)
|
||||
{
|
||||
if (!blob_is_esnap_clone(blob)) {
|
||||
SPDK_ERRLOG("blob 0x%" PRIx64 ": not an esnap clone\n", blob->id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return blob->back_bs_dev;
|
||||
}
|
||||
|
||||
SPDK_LOG_REGISTER_COMPONENT(blob)
|
||||
SPDK_LOG_REGISTER_COMPONENT(blob_esnap)
|
||||
|
@ -66,6 +66,7 @@
|
||||
spdk_xattr_names_free;
|
||||
spdk_bs_get_bstype;
|
||||
spdk_bs_set_bstype;
|
||||
spdk_blob_get_esnap_bs_dev;
|
||||
spdk_blob_set_esnap_bs_dev;
|
||||
|
||||
local: *;
|
||||
|
@ -8462,7 +8462,8 @@ blob_esnap_hotplug(void)
|
||||
CU_ASSERT(g_bserrno == 0);
|
||||
CU_ASSERT(destroyed1);
|
||||
CU_ASSERT(!destroyed2);
|
||||
SPDK_CU_ASSERT_FATAL(blob->back_bs_dev != NULL);
|
||||
SPDK_CU_ASSERT_FATAL(bs_dev == blob->back_bs_dev);
|
||||
SPDK_CU_ASSERT_FATAL(bs_dev == spdk_blob_get_esnap_bs_dev(blob));
|
||||
esnap_dev = (struct ut_esnap_dev *)blob->back_bs_dev;
|
||||
CU_ASSERT(strcmp(esnap_dev->ut_opts.name, "esnap2") == 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user