bdev/compress: insert vol unload into base bdev hotremove path

Change-Id: I0c23746fb210a8c209e98276fe0830185ee81407
Signed-off-by: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447372
Tested-by: SPDK CI Jenkins <sys_sgci@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:
paul luse 2019-03-07 12:37:10 -05:00 committed by Jim Harris
parent dd54dff78b
commit aa3fdd01bd

View File

@ -766,6 +766,20 @@ _comp_reduce_unmap(struct spdk_reduce_backing_dev *dev,
} }
} }
/* Called by reduceLib after performing unload vol actions following base bdev hotremove */
static void
bdev_hotremove_vol_unload_cb(void *cb_arg, int reduce_errno)
{
struct vbdev_compress *comp_bdev = (struct vbdev_compress *)cb_arg;
if (reduce_errno) {
SPDK_ERRLOG("error %d\n", reduce_errno);
}
spdk_bdev_unregister(&comp_bdev->comp_bdev, NULL, NULL);
}
/* Called when the underlying base bdev goes away. */ /* Called when the underlying base bdev goes away. */
static void static void
vbdev_compress_base_bdev_hotremove_cb(void *ctx) vbdev_compress_base_bdev_hotremove_cb(void *ctx)
@ -775,7 +789,8 @@ vbdev_compress_base_bdev_hotremove_cb(void *ctx)
TAILQ_FOREACH_SAFE(comp_bdev, &g_vbdev_comp, link, tmp) { TAILQ_FOREACH_SAFE(comp_bdev, &g_vbdev_comp, link, tmp) {
if (bdev_find == comp_bdev->base_bdev) { if (bdev_find == comp_bdev->base_bdev) {
spdk_bdev_unregister(&comp_bdev->comp_bdev, NULL, NULL); /* Tell reducelib that we're done with this volume. */
spdk_reduce_vol_unload(comp_bdev->vol, bdev_hotremove_vol_unload_cb, comp_bdev);
} }
} }
} }