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:
Piotr Pelplinski 2018-06-27 09:26:37 +02:00 committed by Daniel Verkamp
parent dd7b90fac9
commit cf930a450b
2 changed files with 4 additions and 18 deletions

View File

@ -3004,16 +3004,11 @@ _spdk_bs_load_replay_md(spdk_bs_sequence_t *seq, void *cb_arg)
}
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;
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);
if (rc < 0) {
_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;
memcpy(&ctx->bs->bstype, &ctx->super->bstype, sizeof(ctx->super->bstype));
if (ctx->super->clean == 0) {
_spdk_bs_recover(seq, ctx, 0);
} 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);
if (ctx->super->used_blobid_mask_len == 0 || ctx->super->clean == 0) {
_spdk_bs_recover(seq, ctx);
} else {
_spdk_bs_load_read_used_pages(seq, ctx);
}

View File

@ -3133,7 +3133,7 @@ bs_version(void)
spdk_bs_load(dev, &opts, bs_op_with_handle_complete, NULL);
CU_ASSERT(g_bserrno == 0);
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