blob: move bs_release_cluster
We will use it earlier in this file in a future patch. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I554f2073185d466bd0b4e98bdeec721f763c1b44 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3969 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
8ba7450e8c
commit
3fe748f728
@ -118,6 +118,21 @@ bs_claim_cluster(struct spdk_blob_store *bs, uint32_t cluster_num)
|
||||
bs->num_free_clusters--;
|
||||
}
|
||||
|
||||
static void
|
||||
bs_release_cluster(struct spdk_blob_store *bs, uint32_t cluster_num)
|
||||
{
|
||||
assert(cluster_num < spdk_bit_array_capacity(bs->used_clusters));
|
||||
assert(spdk_bit_array_get(bs->used_clusters, cluster_num) == true);
|
||||
assert(bs->num_free_clusters < bs->total_clusters);
|
||||
|
||||
SPDK_DEBUGLOG(SPDK_LOG_BLOB, "Releasing cluster %u\n", cluster_num);
|
||||
|
||||
pthread_mutex_lock(&bs->used_clusters_mutex);
|
||||
spdk_bit_array_clear(bs->used_clusters, cluster_num);
|
||||
bs->num_free_clusters++;
|
||||
pthread_mutex_unlock(&bs->used_clusters_mutex);
|
||||
}
|
||||
|
||||
static int
|
||||
blob_insert_cluster(struct spdk_blob *blob, uint32_t cluster_num, uint64_t cluster)
|
||||
{
|
||||
@ -178,21 +193,6 @@ bs_allocate_cluster(struct spdk_blob *blob, uint32_t cluster_num,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
bs_release_cluster(struct spdk_blob_store *bs, uint32_t cluster_num)
|
||||
{
|
||||
assert(cluster_num < spdk_bit_array_capacity(bs->used_clusters));
|
||||
assert(spdk_bit_array_get(bs->used_clusters, cluster_num) == true);
|
||||
assert(bs->num_free_clusters < bs->total_clusters);
|
||||
|
||||
SPDK_DEBUGLOG(SPDK_LOG_BLOB, "Releasing cluster %u\n", cluster_num);
|
||||
|
||||
pthread_mutex_lock(&bs->used_clusters_mutex);
|
||||
spdk_bit_array_clear(bs->used_clusters, cluster_num);
|
||||
bs->num_free_clusters++;
|
||||
pthread_mutex_unlock(&bs->used_clusters_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
blob_xattrs_init(struct spdk_blob_xattr_opts *xattrs)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user