blob_bdev: hotremove support

This is in preparation for enabling hot remove of logical volumes when
their underlying blobstore device is hot-removed.


Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I310a3f64f0de5d628609c20a1a3b4d38df0755aa
Reviewed-on: https://review.gerrithub.io/377041
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Maciej Szwed 2017-09-04 15:10:14 +02:00 committed by Jim Harris
parent 8fbbfccdd5
commit 4338d3c9a7
8 changed files with 11 additions and 10 deletions

View File

@ -427,7 +427,7 @@ hello_start(void *arg1, void *arg2)
* However blobstore can be more tightly integrated into
* any lower layer, such as NVMe for example.
*/
bs_dev = spdk_bdev_create_bs_dev(bdev);
bs_dev = spdk_bdev_create_bs_dev(bdev, NULL, NULL);
if (bs_dev == NULL) {
SPDK_ERRLOG("Could not create blob bdev!!\n");
spdk_app_stop(-1);

View File

@ -39,6 +39,7 @@
#define SPDK_BLOB_BDEV_H
#include "spdk/stdinc.h"
#include "spdk/bdev.h"
#ifdef __cplusplus
extern "C" {
@ -47,7 +48,8 @@ extern "C" {
struct spdk_bs_dev;
struct spdk_bdev;
struct spdk_bs_dev *spdk_bdev_create_bs_dev(struct spdk_bdev *);
struct spdk_bs_dev *spdk_bdev_create_bs_dev(struct spdk_bdev *bdev, spdk_bdev_remove_cb_t remove_cb,
void *remove_ctx);
#ifdef __cplusplus
}

View File

@ -91,7 +91,7 @@ vbdev_lvs_create(struct spdk_bdev *base_bdev,
return -ENOMEM;
}
bs_dev = spdk_bdev_create_bs_dev(base_bdev);
bs_dev = spdk_bdev_create_bs_dev(base_bdev, NULL, NULL);
if (!bs_dev) {
SPDK_ERRLOG("Cannot create blobstore device\n");
free(lvs_req);

View File

@ -35,7 +35,6 @@
#include "spdk/blob_bdev.h"
#include "spdk/blob.h"
#include "spdk/bdev.h"
#include "spdk/io_channel.h"
#include "spdk/log.h"
#include "spdk/endian.h"
@ -159,7 +158,7 @@ bdev_blob_destroy(struct spdk_bs_dev *bs_dev)
}
struct spdk_bs_dev *
spdk_bdev_create_bs_dev(struct spdk_bdev *bdev)
spdk_bdev_create_bs_dev(struct spdk_bdev *bdev, spdk_bdev_remove_cb_t remove_cb, void *remove_ctx)
{
struct blob_bdev *b;
struct spdk_bdev_desc *desc;
@ -172,7 +171,7 @@ spdk_bdev_create_bs_dev(struct spdk_bdev *bdev)
return NULL;
}
rc = spdk_bdev_open(bdev, true, NULL, NULL, &desc);
rc = spdk_bdev_open(bdev, true, remove_cb, remove_ctx, &desc);
if (rc != 0) {
SPDK_ERRLOG("could not open bdev, error=%d\n", rc);
free(b);

View File

@ -550,7 +550,7 @@ spdk_rocksdb_run(void *arg1, void *arg2)
g_lcore = spdk_env_get_first_core();
g_bs_dev = spdk_bdev_create_bs_dev(bdev);
g_bs_dev = spdk_bdev_create_bs_dev(bdev, NULL, NULL);
printf("using bdev %s\n", g_bdev_name.c_str());
spdk_fs_load(g_bs_dev, __send_request, fs_load_cb, NULL);
}

View File

@ -246,7 +246,7 @@ construct_targets(void)
exit(1);
}
g_bs_dev = spdk_bdev_create_bs_dev(bdev);
g_bs_dev = spdk_bdev_create_bs_dev(bdev, NULL, NULL);
printf("Mounting BlobFS on bdev %s\n", spdk_bdev_get_name(bdev));
}

View File

@ -81,7 +81,7 @@ spdk_mkfs_run(void *arg1, void *arg2)
printf("Initializing filesystem on bdev %s...", g_bdev_name);
fflush(stdout);
g_bs_dev = spdk_bdev_create_bs_dev(bdev);
g_bs_dev = spdk_bdev_create_bs_dev(bdev, NULL, NULL);
spdk_fs_init(g_bs_dev, NULL, init_cb, NULL);
}

View File

@ -78,7 +78,7 @@ bdev_blob_destroy(struct spdk_bs_dev *bs_dev)
}
struct spdk_bs_dev *
spdk_bdev_create_bs_dev(struct spdk_bdev *bdev)
spdk_bdev_create_bs_dev(struct spdk_bdev *bdev, spdk_bdev_remove_cb_t remove_cb, void *remove_ctx)
{
struct spdk_bs_dev *bs_dev;