lib/blob: use common pointer to md page in load replay path
This is refactoring change for future patches. struct spdk_bs_load_ctx will contain array of pages instead of single one. Having to change just single line for selection of page will make it easier to read next patches in series. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: If3dc1e7da7e61c7b4866307d859e55131a32d38b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/982 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
f422548ea7
commit
2a51c755db
@ -3790,15 +3790,16 @@ static bool _spdk_bs_load_cur_extent_page_valid(struct spdk_blob_md_page *page)
|
||||
static bool _spdk_bs_load_cur_md_page_valid(struct spdk_bs_load_ctx *ctx)
|
||||
{
|
||||
uint32_t crc;
|
||||
struct spdk_blob_md_page *page = ctx->page;
|
||||
|
||||
crc = _spdk_blob_md_page_calc_crc(ctx->page);
|
||||
if (crc != ctx->page->crc) {
|
||||
crc = _spdk_blob_md_page_calc_crc(page);
|
||||
if (crc != page->crc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* First page of a sequence should match the blobid. */
|
||||
if (ctx->page->sequence_num == 0 &&
|
||||
_spdk_bs_page_to_blobid(ctx->cur_page) != ctx->page->id) {
|
||||
if (page->sequence_num == 0 &&
|
||||
_spdk_bs_page_to_blobid(ctx->cur_page) != page->id) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -3941,6 +3942,7 @@ _spdk_bs_load_replay_md_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
|
||||
{
|
||||
struct spdk_bs_load_ctx *ctx = cb_arg;
|
||||
uint32_t page_num;
|
||||
struct spdk_blob_md_page *page;
|
||||
|
||||
if (bserrno != 0) {
|
||||
_spdk_bs_load_ctx_fail(ctx, bserrno);
|
||||
@ -3948,19 +3950,20 @@ _spdk_bs_load_replay_md_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
|
||||
}
|
||||
|
||||
page_num = ctx->cur_page;
|
||||
page = ctx->page;
|
||||
if (_spdk_bs_load_cur_md_page_valid(ctx) == true) {
|
||||
if (ctx->page->sequence_num == 0 || ctx->in_page_chain == true) {
|
||||
if (page->sequence_num == 0 || ctx->in_page_chain == true) {
|
||||
_spdk_bs_claim_md_page(ctx->bs, page_num);
|
||||
if (ctx->page->sequence_num == 0) {
|
||||
if (page->sequence_num == 0) {
|
||||
spdk_bit_array_set(ctx->bs->used_blobids, page_num);
|
||||
}
|
||||
if (_spdk_bs_load_replay_md_parse_page(ctx)) {
|
||||
_spdk_bs_load_ctx_fail(ctx, -EILSEQ);
|
||||
return;
|
||||
}
|
||||
if (ctx->page->next != SPDK_INVALID_MD_PAGE) {
|
||||
if (page->next != SPDK_INVALID_MD_PAGE) {
|
||||
ctx->in_page_chain = true;
|
||||
ctx->cur_page = ctx->page->next;
|
||||
ctx->cur_page = page->next;
|
||||
_spdk_bs_load_replay_cur_md_page(ctx);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user