bdev/part: use part_base as base desc remove ctx

Currently in the base bdev remove callback we don't
have access to anything but the spdk_bdev that's
being removed. Subsequent patches require the access
to more than that - e.g. some local metadata related
to that bdev.

By passing the part base object, we automatically get
access to e.g. spdk_bdev_part_base_get_ctx - a context
tightly associated with the part base, which can be
anything the upper layer (vbdev module) sets up.

Change-Id: Ifb99323978ef71ff6dd3b4ebf84fd21ef2920eb8
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/434834
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Darek Stojaczyk 2018-11-26 13:45:53 +01:00 committed by Jim Harris
parent 5704be8987
commit 4d1894b3c4
4 changed files with 16 additions and 7 deletions

View File

@ -254,9 +254,12 @@ static struct spdk_bdev_fn_table vbdev_error_fn_table = {
};
static void
spdk_vbdev_error_base_bdev_hotremove_cb(void *_base_bdev)
spdk_vbdev_error_base_bdev_hotremove_cb(void *_part_base)
{
spdk_bdev_part_base_hotremove(_base_bdev, &g_error_disks);
struct spdk_bdev_part_base *part_base = _part_base;
struct spdk_bdev *base_bdev = spdk_bdev_part_base_get_bdev(part_base);
spdk_bdev_part_base_hotremove(base_bdev, &g_error_disks);
}
static int

View File

@ -103,9 +103,12 @@ spdk_gpt_base_free(void *ctx)
}
static void
spdk_gpt_base_bdev_hotremove_cb(void *_base_bdev)
spdk_gpt_base_bdev_hotremove_cb(void *_part_base)
{
spdk_bdev_part_base_hotremove(_base_bdev, &g_gpt_disks);
struct spdk_bdev_part_base *part_base = _part_base;
struct spdk_bdev *base_bdev = spdk_bdev_part_base_get_bdev(part_base);
spdk_bdev_part_base_hotremove(base_bdev, &g_gpt_disks);
}
static int vbdev_gpt_destruct(void *ctx);

View File

@ -307,7 +307,7 @@ struct spdk_bdev_part_base *
base->ch_create_cb = ch_create_cb;
base->ch_destroy_cb = ch_destroy_cb;
rc = spdk_bdev_open(bdev, false, remove_cb, bdev, &base->desc);
rc = spdk_bdev_open(bdev, false, remove_cb, base, &base->desc);
if (rc) {
spdk_bdev_part_base_free(base);
SPDK_ERRLOG("could not open bdev %s\n", spdk_bdev_get_name(bdev));

View File

@ -117,9 +117,12 @@ vbdev_split_destruct(void *ctx)
}
static void
vbdev_split_base_bdev_hotremove_cb(void *_base_bdev)
vbdev_split_base_bdev_hotremove_cb(void *_part_base)
{
spdk_bdev_part_base_hotremove(_base_bdev, &g_split_disks);
struct spdk_bdev_part_base *part_base = _part_base;
struct spdk_bdev *base_bdev = spdk_bdev_part_base_get_bdev(part_base);
spdk_bdev_part_base_hotremove(base_bdev, &g_split_disks);
}
static void