blobstore: postpone all superblock writes to first metadata sync
Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com> Change-Id: I49d23d2af40ff909757a5fd15b80a7a8cbbff399 Reviewed-on: https://review.gerrithub.io/416922 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Seth Howell <seth.howell5141@gmail.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
dd7b90fac9
commit
cf930a450b
@ -3004,16 +3004,11 @@ _spdk_bs_load_replay_md(spdk_bs_sequence_t *seq, void *cb_arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_spdk_bs_recover(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
|
_spdk_bs_recover(spdk_bs_sequence_t *seq, void *cb_arg)
|
||||||
{
|
{
|
||||||
struct spdk_bs_load_ctx *ctx = cb_arg;
|
struct spdk_bs_load_ctx *ctx = cb_arg;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (bserrno != 0) {
|
|
||||||
_spdk_bs_load_ctx_fail(seq, ctx, -EIO);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = spdk_bit_array_resize(&ctx->bs->used_md_pages, ctx->super->md_len);
|
rc = spdk_bit_array_resize(&ctx->bs->used_md_pages, ctx->super->md_len);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
_spdk_bs_load_ctx_fail(seq, ctx, -ENOMEM);
|
_spdk_bs_load_ctx_fail(seq, ctx, -ENOMEM);
|
||||||
@ -3085,17 +3080,8 @@ _spdk_bs_load_super_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
|
|||||||
ctx->bs->super_blob = ctx->super->super_blob;
|
ctx->bs->super_blob = ctx->super->super_blob;
|
||||||
memcpy(&ctx->bs->bstype, &ctx->super->bstype, sizeof(ctx->super->bstype));
|
memcpy(&ctx->bs->bstype, &ctx->super->bstype, sizeof(ctx->super->bstype));
|
||||||
|
|
||||||
if (ctx->super->clean == 0) {
|
if (ctx->super->used_blobid_mask_len == 0 || ctx->super->clean == 0) {
|
||||||
_spdk_bs_recover(seq, ctx, 0);
|
_spdk_bs_recover(seq, ctx);
|
||||||
} else if (ctx->super->used_blobid_mask_len == 0) {
|
|
||||||
/*
|
|
||||||
* Metadata is clean, but this is an old metadata format without
|
|
||||||
* a blobid mask. Clear the clean bit and then build the masks
|
|
||||||
* using _spdk_bs_recover.
|
|
||||||
*/
|
|
||||||
ctx->super->clean = 0;
|
|
||||||
ctx->bs->clean = 0;
|
|
||||||
_spdk_bs_write_super(seq, ctx->bs, ctx->super, _spdk_bs_recover, ctx);
|
|
||||||
} else {
|
} else {
|
||||||
_spdk_bs_load_read_used_pages(seq, ctx);
|
_spdk_bs_load_read_used_pages(seq, ctx);
|
||||||
}
|
}
|
||||||
|
@ -3133,7 +3133,7 @@ bs_version(void)
|
|||||||
spdk_bs_load(dev, &opts, bs_op_with_handle_complete, NULL);
|
spdk_bs_load(dev, &opts, bs_op_with_handle_complete, NULL);
|
||||||
CU_ASSERT(g_bserrno == 0);
|
CU_ASSERT(g_bserrno == 0);
|
||||||
SPDK_CU_ASSERT_FATAL(g_bs != NULL);
|
SPDK_CU_ASSERT_FATAL(g_bs != NULL);
|
||||||
CU_ASSERT(super->clean == 0);
|
CU_ASSERT(super->clean == 1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a blob - just to make sure that when we unload it
|
* Create a blob - just to make sure that when we unload it
|
||||||
|
Loading…
Reference in New Issue
Block a user