blob: blobcli should use hex for blob IDs

Blob IDs are sequentially assigned starting at 0x100000000.
When debugging with a small number of blob IDs, it is much
more intuitive to see blob ID 0x100000000 rather than blob
ID 4294967296. If blob IDs are displayed in hex, the things
that parse commands should also accept hex to facilitate
copy and paste.

Signed-off-by: Mike Gerdts <mgerdts@nvidia.com>
Change-Id: Ic71eaaf1987609b4f705d372ced4240650b12684
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11245
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Mike Gerdts 2021-11-17 15:40:37 +00:00 committed by Jim Harris
parent 047c067c05
commit 76a577b082
3 changed files with 20 additions and 18 deletions

View File

@ -3,6 +3,7 @@
*
* Copyright (c) Intel Corporation.
* All rights reserved.
* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -350,7 +351,7 @@ blob_create_cb(void *arg1, spdk_blob_id blobid, int bserrno)
}
cli_context->blobid = blobid;
printf("New blob id %" PRIu64 "\n", cli_context->blobid);
printf("New blob id 0x%" PRIx64 "\n", cli_context->blobid);
/* if we're in script mode, we need info on all blobids for later */
if (cli_context->cli_mode == CLI_MODE_SCRIPT) {
@ -393,7 +394,7 @@ show_bs_cb(void *arg1, spdk_blob_id blobid, int bserrno)
printf("\tAPI Version: %d\n", SPDK_BS_VERSION);
if (bserrno != -ENOENT) {
printf("\tsuper blob ID: %" PRIu64 "\n", cli_context->superid);
printf("\tsuper blob ID: 0x%" PRIx64 "\n", cli_context->superid);
} else {
printf("\tsuper blob ID: none assigned\n");
}
@ -437,7 +438,7 @@ show_blob(struct cli_context_t *cli_context)
printf("Blob Public Info:\n");
printf("blob ID: %" PRIu64 "\n", cli_context->blobid);
printf("blob ID: 0x%" PRIx64 "\n", cli_context->blobid);
val = spdk_blob_get_num_clusters(cli_context->blob);
printf("# of clusters: %" PRIu64 "\n", val);
@ -512,7 +513,7 @@ blob_iter_cb(void *arg1, struct spdk_blob *blob, int bserrno)
if (cli_context->action == CLI_LIST_BLOBS) {
printf("\nList BLOBS:\n");
printf("Found blob with ID# %" PRIu64 "\n",
printf("Found blob with ID# 0x%" PRIx64 "\n",
spdk_blob_get_id(blob));
} else if (spdk_blob_get_id(blob) == cli_context->blobid) {
/*
@ -1049,7 +1050,7 @@ cmd_parser(int argc, char **argv, struct cli_context_t *cli_context)
if (argv[optind] != NULL) {
cmd_chosen++;
cli_context->action = CLI_DUMP_BLOB;
cli_context->blobid = spdk_strtoll(optarg, 10);
cli_context->blobid = spdk_strtoll(optarg, 0);
snprintf(cli_context->file, BUFSIZE, "%s", argv[optind]);
} else {
usage(cli_context, "ERROR: missing parameter.\n");
@ -1059,8 +1060,8 @@ cmd_parser(int argc, char **argv, struct cli_context_t *cli_context)
if (argv[optind] != NULL) {
cmd_chosen++;
cli_context->action = CLI_FILL;
cli_context->blobid = spdk_strtoll(optarg, 10);
cli_context->fill_value = spdk_strtol(argv[optind], 10);
cli_context->blobid = spdk_strtoll(optarg, 0);
cli_context->fill_value = spdk_strtol(argv[optind], 0);
} else {
usage(cli_context, "ERROR: missing parameter.\n");
}
@ -1099,7 +1100,7 @@ cmd_parser(int argc, char **argv, struct cli_context_t *cli_context)
if (argv[optind] != NULL) {
cmd_chosen++;
cli_context->action = CLI_REM_XATTR;
cli_context->blobid = spdk_strtoll(optarg, 10);
cli_context->blobid = spdk_strtoll(optarg, 0);
snprintf(cli_context->key, BUFSIZE, "%s", argv[optind]);
} else {
usage(cli_context, "ERROR: missing parameter.\n");
@ -1120,7 +1121,7 @@ cmd_parser(int argc, char **argv, struct cli_context_t *cli_context)
if (argv[optind] != NULL) {
cmd_chosen++;
cli_context->action = CLI_IMPORT_BLOB;
cli_context->blobid = spdk_strtoll(optarg, 10);
cli_context->blobid = spdk_strtoll(optarg, 0);
snprintf(cli_context->file, BUFSIZE, "%s", argv[optind]);
} else {
usage(cli_context, "ERROR: missing parameter.\n");
@ -1138,7 +1139,7 @@ cmd_parser(int argc, char **argv, struct cli_context_t *cli_context)
case 'p':
cmd_chosen++;
cli_context->action = CLI_SET_SUPER;
cli_context->superid = spdk_strtoll(optarg, 10);
cli_context->superid = spdk_strtoll(optarg, 0);
break;
case 'S':
if (cli_context->cli_mode == CLI_MODE_CMD) {
@ -1153,7 +1154,7 @@ cmd_parser(int argc, char **argv, struct cli_context_t *cli_context)
cli_context->action = CLI_SHOW_BS;
} else {
cli_context->action = CLI_SHOW_BLOB;
cli_context->blobid = spdk_strtoll(optarg, 10);
cli_context->blobid = spdk_strtoll(optarg, 0);
}
break;
case 'T':
@ -1178,7 +1179,7 @@ cmd_parser(int argc, char **argv, struct cli_context_t *cli_context)
if (argv[optind] != NULL || argv[optind + 1] != NULL) {
cmd_chosen++;
cli_context->action = CLI_SET_XATTR;
cli_context->blobid = spdk_strtoll(optarg, 10);
cli_context->blobid = spdk_strtoll(optarg, 0);
snprintf(cli_context->key, BUFSIZE, "%s", argv[optind]);
snprintf(cli_context->value, BUFSIZE, "%s", argv[optind + 1]);
} else {

View File

@ -3,6 +3,7 @@
*
* Copyright (c) Intel Corporation.
* All rights reserved.
* Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -4684,7 +4685,7 @@ bs_dump_super_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
if (ctx->super->super_blob == SPDK_BLOBID_INVALID) {
fprintf(ctx->fp, "(None)\n");
} else {
fprintf(ctx->fp, "%" PRIu64 "\n", ctx->super->super_blob);
fprintf(ctx->fp, "0x%" PRIx64 "\n", ctx->super->super_blob);
}
fprintf(ctx->fp, "Clean: %" PRIu32 "\n", ctx->super->clean);
fprintf(ctx->fp, "Used Metadata Page Mask Start: %" PRIu32 "\n", ctx->super->used_page_mask_start);

View File

@ -13,14 +13,14 @@ List bdevs:
SCRIPT NOW PROCESSING: -n 1
New blob id $(N)
New blob id $(XX)
blob now has USED clusters of 1
SCRIPT NOW PROCESSING: -p $B0
Super Blob ID has been set.
SCRIPT NOW PROCESSING: -n 1
New blob id $(N)
New blob id $(XX)
blob now has USED clusters of 1
SCRIPT NOW PROCESSING: -m $B1 test.pattern
@ -38,7 +38,7 @@ SCRIPT NOW PROCESSING: -s bs
Blobstore Public Info:
Using bdev Product Name: NVMe disk
API Version: $(N)
super blob ID: $(N)
super blob ID: $(XX)
page size: $(N)
io unit size: $(N)
cluster size: 1048576
@ -52,7 +52,7 @@ Blobstore Private Info:
SCRIPT NOW PROCESSING: -s $B1
Blob Public Info:
blob ID: $(N)
blob ID: $(XX)
# of clusters: 1
# of bytes: 1048576
# of pages: 256
@ -75,7 +75,7 @@ SCRIPT NOW PROCESSING: -s bs
Blobstore Public Info:
Using bdev Product Name: NVMe disk
API Version: 3
super blob ID: $(N)
super blob ID: $(XX)
page size: $(N)
io unit size: $(N)
cluster size: 1048576