examples/blob_cli: Use spdk_bdev_create_bs_dev_ext() to pass bdev_name
Update a few print outputs to out not product name but bdev name because bdev pointer is not available there after replacing spdk_bdev_get_by_name() and spdk_bdev_open() by spdk_bdev_open_ext(). Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I624fea3a0a12c1049e950bddae8cea9f88b16db5 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4702 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
97901dca7c
commit
c865839736
@ -857,25 +857,26 @@ load_bs_cb(void *arg1, struct spdk_blob_store *bs, int bserrno)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
base_bdev_event_cb(enum spdk_bdev_event_type type, struct spdk_bdev *bdev,
|
||||
void *event_ctx)
|
||||
{
|
||||
printf("Unsupported bdev event: type %d\n", type);
|
||||
}
|
||||
|
||||
/*
|
||||
* Load the blobstore.
|
||||
*/
|
||||
static void
|
||||
load_bs(struct cli_context_t *cli_context)
|
||||
{
|
||||
struct spdk_bdev *bdev = NULL;
|
||||
struct spdk_bs_dev *bs_dev = NULL;
|
||||
int rc;
|
||||
|
||||
bdev = spdk_bdev_get_by_name(cli_context->bdev_name);
|
||||
if (bdev == NULL) {
|
||||
printf("Could not find a bdev\n");
|
||||
spdk_app_stop(-1);
|
||||
return;
|
||||
}
|
||||
|
||||
bs_dev = spdk_bdev_create_bs_dev(bdev, NULL, NULL);
|
||||
if (bs_dev == NULL) {
|
||||
printf("Could not create blob bdev!!\n");
|
||||
rc = spdk_bdev_create_bs_dev_ext(cli_context->bdev_name, base_bdev_event_cb,
|
||||
NULL, &bs_dev);
|
||||
if (rc != 0) {
|
||||
printf("Could not create blob bdev, %s!!\n", spdk_strerror(-rc));
|
||||
spdk_app_stop(-1);
|
||||
return;
|
||||
}
|
||||
@ -939,20 +940,14 @@ bs_init_cb(void *cb_arg, struct spdk_blob_store *bs,
|
||||
static void
|
||||
init_bs(struct cli_context_t *cli_context)
|
||||
{
|
||||
struct spdk_bdev *bdev = NULL;
|
||||
int rc;
|
||||
|
||||
bdev = spdk_bdev_get_by_name(cli_context->bdev_name);
|
||||
if (bdev == NULL) {
|
||||
printf("Could not find a bdev\n");
|
||||
spdk_app_stop(-1);
|
||||
return;
|
||||
}
|
||||
printf("Init blobstore using bdev Product Name: %s\n",
|
||||
spdk_bdev_get_product_name(bdev));
|
||||
printf("Init blobstore using bdev Name: %s\n", cli_context->bdev_name);
|
||||
|
||||
cli_context->bs_dev = spdk_bdev_create_bs_dev(bdev, NULL, NULL);
|
||||
if (cli_context->bs_dev == NULL) {
|
||||
printf("Could not create blob bdev!!\n");
|
||||
rc = spdk_bdev_create_bs_dev_ext(cli_context->bdev_name, base_bdev_event_cb, NULL,
|
||||
&cli_context->bs_dev);
|
||||
if (rc != 0) {
|
||||
printf("Could not create blob bdev, %s!!\n", spdk_strerror(-rc));
|
||||
spdk_app_stop(-1);
|
||||
return;
|
||||
}
|
||||
@ -1011,20 +1006,14 @@ bsdump_print_xattr(FILE *fp, const char *bstype, const char *name, const void *v
|
||||
static void
|
||||
dump_bs(struct cli_context_t *cli_context)
|
||||
{
|
||||
struct spdk_bdev *bdev = NULL;
|
||||
int rc;
|
||||
|
||||
bdev = spdk_bdev_get_by_name(cli_context->bdev_name);
|
||||
if (bdev == NULL) {
|
||||
printf("Could not find a bdev\n");
|
||||
spdk_app_stop(-1);
|
||||
return;
|
||||
}
|
||||
printf("Init blobstore using bdev Product Name: %s\n",
|
||||
spdk_bdev_get_product_name(bdev));
|
||||
printf("Init blobstore using bdev Name: %s\n", cli_context->bdev_name);
|
||||
|
||||
cli_context->bs_dev = spdk_bdev_create_bs_dev(bdev, NULL, NULL);
|
||||
if (cli_context->bs_dev == NULL) {
|
||||
printf("Could not create blob bdev!!\n");
|
||||
rc = spdk_bdev_create_bs_dev_ext(cli_context->bdev_name, base_bdev_event_cb, NULL,
|
||||
&cli_context->bs_dev);
|
||||
if (rc != 0) {
|
||||
printf("Could not create blob bdev, %s!!\n", spdk_strerror(-rc));
|
||||
spdk_app_stop(-1);
|
||||
return;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ Starting SPDK v19.10.1 / DPDK 19.08.0 initialization...
|
||||
[ DPDK EAL parameters: blobcli --no-shconf -c 0x1 --log-level=lib.eal:6 --log-level=lib.cryptodev:5 --log-level=user1:6 --iova-mode=pa --base-virtaddr=0x200000000000 --match-allocations --file-prefix=spdk_pid1641656 ]
|
||||
|
||||
SCRIPT NOW PROCESSING: -i
|
||||
Init blobstore using bdev Product Name: NVMe disk
|
||||
Init blobstore using bdev Name: Nvme0n1
|
||||
blobstore init'd: ($(XX))
|
||||
|
||||
SCRIPT NOW PROCESSING: -l bdevs
|
||||
|
Loading…
Reference in New Issue
Block a user