lib/blob: split loading next md_chain to separate function
Replaying md through _spdk_bs_load_replay_md_cpl() starts with md page 0 in search of first valid md page starting a chain for particular blob. When it is found, next pages read are from the current pages `next` page - next in chain. After whole chain is read, it goes back to first page in chain and starts search for next valid chain from there. This patch adds separation between reading particular chain, and moving to the next one. Moving on to the next one happens in _spdk_bs_load_replay_md_chain_cpl(). Further in the series, extent pages will be added in the metadata. Those are not within any particular blobs chain of metadata, but spread out over the md region. It is not enough to read all md and read extent pages. In case of power failure, only extent pages known to be valid are the ones which are pointed to by some valid md chain. In futher patches, a step will be added after reading particular valid md chain to go read extent pages pointed by it. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I6e7cd64af66ce5db0abd2ad5962d604ac2b30994 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481900 Community-CI: SPDK CI Jenkins <sys_sgci@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
bb25821c7e
commit
1fdee03c3c
@ -3174,12 +3174,36 @@ _spdk_bs_load_write_used_md(struct spdk_bs_load_ctx *ctx)
|
|||||||
_spdk_bs_write_used_md(ctx->seq, ctx, _spdk_bs_load_write_used_pages_cpl);
|
_spdk_bs_write_used_md(ctx->seq, ctx, _spdk_bs_load_write_used_pages_cpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_spdk_bs_load_replay_md_chain_cpl(struct spdk_bs_load_ctx *ctx)
|
||||||
|
{
|
||||||
|
uint64_t num_md_clusters;
|
||||||
|
uint64_t i;
|
||||||
|
|
||||||
|
ctx->in_page_chain = false;
|
||||||
|
|
||||||
|
do {
|
||||||
|
ctx->page_index++;
|
||||||
|
} while (spdk_bit_array_get(ctx->bs->used_md_pages, ctx->page_index) == true);
|
||||||
|
|
||||||
|
if (ctx->page_index < ctx->super->md_len) {
|
||||||
|
ctx->cur_page = ctx->page_index;
|
||||||
|
_spdk_bs_load_replay_cur_md_page(ctx);
|
||||||
|
} else {
|
||||||
|
/* 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++) {
|
||||||
|
_spdk_bs_claim_cluster(ctx->bs, i);
|
||||||
|
}
|
||||||
|
spdk_free(ctx->page);
|
||||||
|
_spdk_bs_load_write_used_md(ctx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_spdk_bs_load_replay_md_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
|
_spdk_bs_load_replay_md_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
|
||||||
{
|
{
|
||||||
struct spdk_bs_load_ctx *ctx = cb_arg;
|
struct spdk_bs_load_ctx *ctx = cb_arg;
|
||||||
uint64_t num_md_clusters;
|
|
||||||
uint64_t i;
|
|
||||||
uint32_t page_num;
|
uint32_t page_num;
|
||||||
|
|
||||||
if (bserrno != 0) {
|
if (bserrno != 0) {
|
||||||
@ -3206,25 +3230,7 @@ _spdk_bs_load_replay_md_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_spdk_bs_load_replay_md_chain_cpl(ctx);
|
||||||
ctx->in_page_chain = false;
|
|
||||||
|
|
||||||
do {
|
|
||||||
ctx->page_index++;
|
|
||||||
} while (spdk_bit_array_get(ctx->bs->used_md_pages, ctx->page_index) == true);
|
|
||||||
|
|
||||||
if (ctx->page_index < ctx->super->md_len) {
|
|
||||||
ctx->cur_page = ctx->page_index;
|
|
||||||
_spdk_bs_load_replay_cur_md_page(ctx);
|
|
||||||
} else {
|
|
||||||
/* 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++) {
|
|
||||||
_spdk_bs_claim_cluster(ctx->bs, i);
|
|
||||||
}
|
|
||||||
spdk_free(ctx->page);
|
|
||||||
_spdk_bs_load_write_used_md(ctx);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user