From 2d87587fe50dc5f3228e5bbb9d37854e76953cc0 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Thu, 27 Aug 2020 14:28:24 -0700 Subject: [PATCH] blob: claim clusters inline during initialization When claiming clusters as part of blobstore initialization or recovery, just call spdk_bit_array_set directly rather than going through the bs_claim_cluster function. We will be modifying how runtime cluster allocation works so need to separate the two use cases. This code is very small so inlining it has minimal code impact. Signed-off-by: Jim Harris Change-Id: Iaaa1c817e57b4a2eea62eb4683407364bac1fcc0 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3966 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Changpeng Liu Reviewed-by: Tomasz Zawadzki --- lib/blob/blobstore.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index 80f5b148b..fcde9569e 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -3903,8 +3903,9 @@ bs_load_replay_md_chain_cpl(struct spdk_bs_load_ctx *ctx) /* Claim all of the clusters used by the metadata */ num_md_clusters = spdk_divide_round_up(ctx->super->md_len, ctx->bs->pages_per_cluster); for (i = 0; i < num_md_clusters; i++) { - bs_claim_cluster(ctx->bs, i); + spdk_bit_array_set(ctx->bs->used_clusters, i); } + ctx->bs->num_free_clusters -= num_md_clusters; spdk_free(ctx->page); bs_load_write_used_md(ctx); } @@ -4709,9 +4710,10 @@ spdk_bs_init(struct spdk_bs_dev *dev, struct spdk_bs_opts *o, } /* Claim all of the clusters used by the metadata */ for (i = 0; i < num_md_clusters; i++) { - bs_claim_cluster(bs, i); + spdk_bit_array_set(bs->used_clusters, i); } + bs->num_free_clusters -= num_md_clusters; bs->total_data_clusters = bs->num_free_clusters; cpl.type = SPDK_BS_CPL_TYPE_BS_HANDLE;