diff --git a/include/spdk/blob.h b/include/spdk/blob.h index eb394a5e9..77dae7f4a 100644 --- a/include/spdk/blob.h +++ b/include/spdk/blob.h @@ -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. * diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index e736da9be..ad6a91958 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -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) diff --git a/lib/blob/blobstore.h b/lib/blob/blobstore.h index 4b509a930..ce8a11b08 100644 --- a/lib/blob/blobstore.h +++ b/lib/blob/blobstore.h @@ -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;