blob: add is_degraded() to spdk_blob_bs_dev

The health of clones of esnap clones depends on the health of the esnap
clone. This allows recursion through a chain of clones so that degraded
state propagates up from any back_bs_dev that is degraded.

Signed-off-by: Mike Gerdts <mgerdts@nvidia.com>
Change-Id: Iadd879d589f6ce4d0b654945db065d304b0c8357
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17517
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Mike Gerdts 2023-04-06 09:13:01 -05:00 committed by David Ko
parent 42e50f66d0
commit 7d9bc09008

View File

@ -154,6 +154,14 @@ blob_bs_translate_lba(struct spdk_bs_dev *dev, uint64_t lba, uint64_t *base_lba)
base_lba); base_lba);
} }
static bool
blob_bs_is_degraded(struct spdk_bs_dev *dev)
{
struct spdk_blob_bs_dev *b = (struct spdk_blob_bs_dev *)dev;
return spdk_blob_is_degraded(b->blob);
}
struct spdk_bs_dev * struct spdk_bs_dev *
bs_create_blob_bs_dev(struct spdk_blob *blob) bs_create_blob_bs_dev(struct spdk_blob *blob)
{ {
@ -180,6 +188,7 @@ bs_create_blob_bs_dev(struct spdk_blob *blob)
b->bs_dev.unmap = blob_bs_dev_unmap; b->bs_dev.unmap = blob_bs_dev_unmap;
b->bs_dev.is_zeroes = blob_bs_is_zeroes; b->bs_dev.is_zeroes = blob_bs_is_zeroes;
b->bs_dev.translate_lba = blob_bs_translate_lba; b->bs_dev.translate_lba = blob_bs_translate_lba;
b->bs_dev.is_degraded = blob_bs_is_degraded;
b->blob = blob; b->blob = blob;
return &b->bs_dev; return &b->bs_dev;