module/raid: io metadata support
* generic metadata support for raid modules * raid is not created when metadata formats for base bdevs differ Signed-off-by: Krzysztof Smolinski <krzysztof.smolinski@intel.com> Change-Id: Ifaf9cfc4f2472c3820da1070deda758c5334edb2 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13549 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
33833272ea
commit
357c038ce0
@ -1027,6 +1027,47 @@ raid_bdev_create(const char *name, uint32_t strip_size, uint8_t num_base_bdevs,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* brief:
|
||||||
|
* Check underlying block devices against support for metadata. Do not configure
|
||||||
|
* md support when parameters from block devices are inconsistent.
|
||||||
|
* params:
|
||||||
|
* raid_bdev - pointer to raid bdev
|
||||||
|
* returns:
|
||||||
|
* 0 - The raid bdev md parameters were successfully configured.
|
||||||
|
* non zero - Failed to configure md.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
raid_bdev_configure_md(struct raid_bdev *raid_bdev)
|
||||||
|
{
|
||||||
|
struct spdk_bdev *base_bdev;
|
||||||
|
uint8_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < raid_bdev->num_base_bdevs; i++) {
|
||||||
|
base_bdev = raid_bdev->base_bdev_info[i].bdev;
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
raid_bdev->bdev.md_len = spdk_bdev_get_md_size(base_bdev);
|
||||||
|
raid_bdev->bdev.md_interleave = spdk_bdev_is_md_interleaved(base_bdev);
|
||||||
|
raid_bdev->bdev.dif_type = spdk_bdev_get_dif_type(base_bdev);
|
||||||
|
raid_bdev->bdev.dif_is_head_of_md = spdk_bdev_is_dif_head_of_md(base_bdev);
|
||||||
|
raid_bdev->bdev.dif_check_flags = base_bdev->dif_check_flags;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (raid_bdev->bdev.md_len != spdk_bdev_get_md_size(base_bdev) ||
|
||||||
|
raid_bdev->bdev.md_interleave != spdk_bdev_is_md_interleaved(base_bdev) ||
|
||||||
|
raid_bdev->bdev.dif_type != spdk_bdev_get_dif_type(base_bdev) ||
|
||||||
|
raid_bdev->bdev.dif_is_head_of_md != spdk_bdev_is_dif_head_of_md(base_bdev) ||
|
||||||
|
raid_bdev->bdev.dif_check_flags != base_bdev->dif_check_flags) {
|
||||||
|
SPDK_ERRLOG("base bdevs are configured with different metadata formats\n");
|
||||||
|
return -EPERM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* brief:
|
* brief:
|
||||||
* If raid bdev config is complete, then only register the raid bdev to
|
* If raid bdev config is complete, then only register the raid bdev to
|
||||||
@ -1075,6 +1116,12 @@ raid_bdev_configure(struct raid_bdev *raid_bdev)
|
|||||||
raid_bdev_gen = &raid_bdev->bdev;
|
raid_bdev_gen = &raid_bdev->bdev;
|
||||||
raid_bdev_gen->blocklen = blocklen;
|
raid_bdev_gen->blocklen = blocklen;
|
||||||
|
|
||||||
|
rc = raid_bdev_configure_md(raid_bdev);
|
||||||
|
if (rc != 0) {
|
||||||
|
SPDK_ERRLOG("raid metadata configuration failed\n");
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
rc = raid_bdev->module->start(raid_bdev);
|
rc = raid_bdev->module->start(raid_bdev);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
SPDK_ERRLOG("raid module startup callback failed\n");
|
SPDK_ERRLOG("raid module startup callback failed\n");
|
||||||
|
@ -115,6 +115,11 @@ DEFINE_STUB(spdk_bdev_queue_io_wait, int, (struct spdk_bdev *bdev, struct spdk_i
|
|||||||
DEFINE_STUB(spdk_bdev_get_memory_domains, int, (struct spdk_bdev *bdev,
|
DEFINE_STUB(spdk_bdev_get_memory_domains, int, (struct spdk_bdev *bdev,
|
||||||
struct spdk_memory_domain **domains, int array_size), 0);
|
struct spdk_memory_domain **domains, int array_size), 0);
|
||||||
DEFINE_STUB(spdk_bdev_get_name, const char *, (const struct spdk_bdev *bdev), "test_bdev");
|
DEFINE_STUB(spdk_bdev_get_name, const char *, (const struct spdk_bdev *bdev), "test_bdev");
|
||||||
|
DEFINE_STUB(spdk_bdev_get_md_size, uint32_t, (const struct spdk_bdev *bdev), 0);
|
||||||
|
DEFINE_STUB(spdk_bdev_is_md_interleaved, bool, (const struct spdk_bdev *bdev), false);
|
||||||
|
DEFINE_STUB(spdk_bdev_get_dif_type, enum spdk_dif_type, (const struct spdk_bdev *bdev),
|
||||||
|
SPDK_DIF_DISABLE);
|
||||||
|
DEFINE_STUB(spdk_bdev_is_dif_head_of_md, bool, (const struct spdk_bdev *bdev), false);
|
||||||
|
|
||||||
struct spdk_io_channel *
|
struct spdk_io_channel *
|
||||||
spdk_bdev_get_io_channel(struct spdk_bdev_desc *desc)
|
spdk_bdev_get_io_channel(struct spdk_bdev_desc *desc)
|
||||||
|
Loading…
Reference in New Issue
Block a user