blobstore: clone-snapshot classification
This patch introduces API to get some blobs capabilites: bool spdk_blob_is_read_only(struct spdk_blob *blob); bool spdk_blob_is_thin_provisioned(struct spdk_blob *blob); to be used in upper level in the unified way. Change-Id: I4411bb3f4dd0c64826ae16a66141b2911cbaab79 Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com> Reviewed-on: https://review.gerrithub.io/405022 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
aa749442cb
commit
0d1c3aefc3
@ -390,6 +390,24 @@ void spdk_bs_create_clone(struct spdk_blob_store *bs, spdk_blob_id blobid,
|
||||
const struct spdk_blob_xattr_opts *clone_xattrs,
|
||||
spdk_blob_op_with_id_complete cb_fn, void *cb_arg);
|
||||
|
||||
/**
|
||||
* Check if blob is read only.
|
||||
*
|
||||
* \param blob Blob.
|
||||
*
|
||||
* \return true if blob is read only.
|
||||
*/
|
||||
bool spdk_blob_is_read_only(struct spdk_blob *blob);
|
||||
|
||||
/**
|
||||
* Check if blob is thin-provisioned.
|
||||
*
|
||||
* \param blob Blob.
|
||||
*
|
||||
* \return true if blob is thin-provisioned.
|
||||
*/
|
||||
bool spdk_blob_is_thin_provisioned(struct spdk_blob *blob);
|
||||
|
||||
/**
|
||||
* Delete an existing blob from the given blobstore.
|
||||
*
|
||||
|
@ -4679,4 +4679,18 @@ spdk_bs_set_bstype(struct spdk_blob_store *bs, struct spdk_bs_type bstype)
|
||||
memcpy(&bs->bstype, &bstype, sizeof(bstype));
|
||||
}
|
||||
|
||||
bool
|
||||
spdk_blob_is_read_only(struct spdk_blob *blob)
|
||||
{
|
||||
assert(blob != NULL);
|
||||
return (blob->data_ro || blob->md_ro);
|
||||
}
|
||||
|
||||
bool
|
||||
spdk_blob_is_thin_provisioned(struct spdk_blob *blob)
|
||||
{
|
||||
assert(blob != NULL);
|
||||
return !!(blob->invalid_flags & SPDK_BLOB_THIN_PROV);
|
||||
}
|
||||
|
||||
SPDK_LOG_REGISTER_COMPONENT("blob", SPDK_LOG_BLOB)
|
||||
|
@ -259,8 +259,6 @@ struct spdk_blob_md_descriptor_extent {
|
||||
#define SPDK_BLOB_DATA_RO_FLAGS_MASK SPDK_BLOB_READ_ONLY
|
||||
#define SPDK_BLOB_MD_RO_FLAGS_MASK 0
|
||||
|
||||
#define spdk_blob_is_thin_provisioned(blob) (blob->invalid_flags & SPDK_BLOB_THIN_PROV)
|
||||
|
||||
struct spdk_blob_md_descriptor_flags {
|
||||
uint8_t type;
|
||||
uint32_t length;
|
||||
|
Loading…
Reference in New Issue
Block a user