bdev/compress: use base bdev alias as base for comp_bdev name
If available, if not use the bdev unique name. This results in a much friendlier comp_bdev naem for the user. For example, now it would look something like this: COMP_lvs0/lvs as opposed to like this COMP_0b149b31-b66b-4cf7-ab39-a55b50788cd1 Change-Id: I319a141221ed8880edcec930ca5be9f256b105e0 Signed-off-by: paul luse <paul.e.luse@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463246 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
e9211cbf45
commit
ca1a3bf18e
@ -1359,11 +1359,21 @@ static void
|
|||||||
vbdev_compress_claim(struct vbdev_compress *comp_bdev)
|
vbdev_compress_claim(struct vbdev_compress *comp_bdev)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
struct spdk_bdev_alias *aliases;
|
||||||
|
|
||||||
comp_bdev->comp_bdev.name = spdk_sprintf_alloc("COMP_%s", comp_bdev->base_bdev->name);
|
if (!TAILQ_EMPTY(spdk_bdev_get_aliases(comp_bdev->base_bdev))) {
|
||||||
if (!comp_bdev->comp_bdev.name) {
|
aliases = TAILQ_FIRST(spdk_bdev_get_aliases(comp_bdev->base_bdev));
|
||||||
SPDK_ERRLOG("could not allocate comp_bdev name\n");
|
comp_bdev->comp_bdev.name = spdk_sprintf_alloc("COMP_%s", aliases->alias);
|
||||||
goto error_bdev_name;
|
if (!comp_bdev->comp_bdev.name) {
|
||||||
|
SPDK_ERRLOG("could not allocate comp_bdev name for alias\n");
|
||||||
|
goto error_bdev_name;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
comp_bdev->comp_bdev.name = spdk_sprintf_alloc("COMP_%s", comp_bdev->base_bdev->name);
|
||||||
|
if (!comp_bdev->comp_bdev.name) {
|
||||||
|
SPDK_ERRLOG("could not allocate comp_bdev name for unique name\n");
|
||||||
|
goto error_bdev_name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note: some of the fields below will change in the future - for example,
|
/* Note: some of the fields below will change in the future - for example,
|
||||||
|
@ -233,6 +233,8 @@ spdk_reduce_vol_readv(struct spdk_reduce_vol *vol, struct iovec *iov, int iovcnt
|
|||||||
#include "bdev/compress/vbdev_compress.c"
|
#include "bdev/compress/vbdev_compress.c"
|
||||||
|
|
||||||
/* SPDK stubs */
|
/* SPDK stubs */
|
||||||
|
DEFINE_STUB(spdk_bdev_get_aliases, const struct spdk_bdev_aliases_list *,
|
||||||
|
(const struct spdk_bdev *bdev), NULL);
|
||||||
DEFINE_STUB_V(spdk_bdev_module_list_add, (struct spdk_bdev_module *bdev_module));
|
DEFINE_STUB_V(spdk_bdev_module_list_add, (struct spdk_bdev_module *bdev_module));
|
||||||
DEFINE_STUB_V(spdk_bdev_free_io, (struct spdk_bdev_io *g_bdev_io));
|
DEFINE_STUB_V(spdk_bdev_free_io, (struct spdk_bdev_io *g_bdev_io));
|
||||||
DEFINE_STUB(spdk_bdev_io_type_supported, bool, (struct spdk_bdev *bdev,
|
DEFINE_STUB(spdk_bdev_io_type_supported, bool, (struct spdk_bdev *bdev,
|
||||||
|
Loading…
Reference in New Issue
Block a user