blob: change spdk_blob_set_read_only to return int
This is needed for an upcoming change which will prevent metadata functions from being called on threads other than the metadata thread. Without this change, there was no way for this function to return an error if it was called from the wrong thread. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I67e591140194ff6ad250878168f6b166a1ff2282 Reviewed-on: https://review.gerrithub.io/400883 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
c8efd8a8b2
commit
e14cdc7d3a
@ -263,7 +263,7 @@ int spdk_blob_resize(struct spdk_blob *blob, size_t sz);
|
||||
* These changes do not take effect until
|
||||
* spdk_blob_sync_md() is called. */
|
||||
|
||||
void spdk_blob_set_read_only(struct spdk_blob *blob);
|
||||
int spdk_blob_set_read_only(struct spdk_blob *blob);
|
||||
|
||||
/* Sync a blob */
|
||||
/* Make a blob persistent. This applies to resize, set xattr,
|
||||
|
@ -3484,13 +3484,14 @@ void spdk_bs_open_blob(struct spdk_blob_store *bs, spdk_blob_id blobid,
|
||||
/* END spdk_bs_open_blob */
|
||||
|
||||
/* START spdk_blob_set_read_only */
|
||||
void spdk_blob_set_read_only(struct spdk_blob *blob)
|
||||
int spdk_blob_set_read_only(struct spdk_blob *blob)
|
||||
{
|
||||
assert(spdk_get_thread() == blob->bs->md_thread);
|
||||
|
||||
blob->data_ro_flags |= SPDK_BLOB_READ_ONLY;
|
||||
|
||||
blob->state = SPDK_BLOB_STATE_DIRTY;
|
||||
return 0;
|
||||
}
|
||||
/* END spdk_blob_set_read_only */
|
||||
|
||||
|
@ -534,6 +534,7 @@ blob_read_only(void)
|
||||
struct spdk_blob *blob;
|
||||
struct spdk_bs_opts opts;
|
||||
spdk_blob_id blobid;
|
||||
int rc;
|
||||
|
||||
dev = init_dev();
|
||||
spdk_bs_opts_init(&opts);
|
||||
@ -554,7 +555,8 @@ blob_read_only(void)
|
||||
SPDK_CU_ASSERT_FATAL(g_blob != NULL);
|
||||
blob = g_blob;
|
||||
|
||||
spdk_blob_set_read_only(blob);
|
||||
rc = spdk_blob_set_read_only(blob);
|
||||
CU_ASSERT(rc == 0);
|
||||
|
||||
CU_ASSERT(blob->data_ro == false);
|
||||
CU_ASSERT(blob->md_ro == false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user