blob: print extent tables

When blobcli is printing blob metadata, extent tables are now printed.

Signed-off-by: Mike Gerdts <mgerdts@nvidia.com>
Change-Id: Ie748a2f2b3fbc3e6e5ee06a0f2eb9bd491bfed46
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11259
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Mike Gerdts 2021-12-20 16:12:45 +00:00 committed by Jim Harris
parent 8caf8f5ef7
commit 5c29449f4e

View File

@ -4712,6 +4712,30 @@ bs_dump_print_type_flags(struct spdk_bs_load_ctx *ctx, struct spdk_blob_md_descr
SPDK_COUNTOF(md_ro));
}
static void
bs_dump_print_extent_table(struct spdk_bs_load_ctx *ctx, struct spdk_blob_md_descriptor *desc)
{
struct spdk_blob_md_descriptor_extent_table *et_desc;
uint64_t num_extent_pages;
uint32_t et_idx;
et_desc = (struct spdk_blob_md_descriptor_extent_table *)desc;
num_extent_pages = (et_desc->length - sizeof(et_desc->num_clusters)) /
sizeof(et_desc->extent_page[0]);
fprintf(ctx->fp, "Extent table:\n");
for (et_idx = 0; et_idx < num_extent_pages; et_idx++) {
if (et_desc->extent_page[et_idx].page_idx == 0) {
/* Zeroes represent unallocated extent pages. */
continue;
}
fprintf(ctx->fp, "\tExtent page: %5" PRIu32 " length %3" PRIu32
" at LBA %" PRIu64 "\n", et_desc->extent_page[et_idx].page_idx,
et_desc->extent_page[et_idx].num_pages,
bs_md_page_to_lba(ctx->bs, et_desc->extent_page[et_idx].page_idx));
}
}
static void
bs_dump_print_md_page(struct spdk_bs_load_ctx *ctx)
{
@ -4786,6 +4810,8 @@ bs_dump_print_md_page(struct spdk_bs_load_ctx *ctx)
bs_dump_print_xattr(ctx, desc);
} else if (desc->type == SPDK_MD_DESCRIPTOR_TYPE_FLAGS) {
bs_dump_print_type_flags(ctx, desc);
} else if (desc->type == SPDK_MD_DESCRIPTOR_TYPE_EXTENT_TABLE) {
bs_dump_print_extent_table(ctx, desc);
} else {
/* Error */
fprintf(ctx->fp, "Unknown descriptor type %" PRIu8 "\n", desc->type);