lib/blob: only validate blobid of first page during bs_load

Blob id only is matched to the very first page of md for
that particular blob.

During loading blobstore, we shouldn't verify
further pages in chain against the blobid.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ifc7863ddcb403aedc264c14e6b4c3915bd30dc41
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460607
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
Tomasz Zawadzki 2019-07-05 06:33:53 -04:00 committed by Darek Stojaczyk
parent 5e74b8e653
commit 6ced601526
2 changed files with 15 additions and 1 deletions

View File

@ -3073,7 +3073,8 @@ static bool _spdk_bs_load_cur_md_page_valid(struct spdk_bs_load_ctx *ctx)
return false;
}
if (_spdk_bs_page_to_blobid(ctx->cur_page) != ctx->page->id) {
if (ctx->page->sequence_num == 0 &&
_spdk_bs_page_to_blobid(ctx->cur_page) != ctx->page->id) {
return false;
}
return true;

View File

@ -3664,6 +3664,19 @@ blob_dirty_shutdown(void)
rc = spdk_blob_set_xattr(blob, "length", &length, sizeof(length));
CU_ASSERT(rc == 0);
/* Put xattr that fits exactly single page.
* This results in adding additional pages to MD.
* First is flags and smaller xattr, second the large xattr,
* third are just the extents.
*/
size_t xattr_length = 4072 - sizeof(struct spdk_blob_md_descriptor_xattr) -
strlen("large_xattr");
char *xattr = calloc(xattr_length, sizeof(char));
SPDK_CU_ASSERT_FATAL(xattr != NULL);
rc = spdk_blob_set_xattr(blob, "large_xattr", xattr, xattr_length);
free(xattr);
SPDK_CU_ASSERT_FATAL(rc == 0);
/* Resize the blob */
spdk_blob_resize(blob, 10, blob_op_complete, NULL);
poll_threads();