Commit 73763d40 authored by Artur Paszkiewicz's avatar Artur Paszkiewicz Committed by Tomasz Zawadzki
Browse files

module/raid: raid5 module



Add raid5 module and unit tests. Use './configure' with option
'--with-raid5' to enable it.

Change-Id: I9f07da8c3567fa65499444899c899adaa2e29550
Signed-off-by: default avatarArtur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/855


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
parent b992bb4e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -160,3 +160,6 @@ CONFIG_URING_PATH=

# Build with FUSE support
CONFIG_FUSE=n

# Build with RAID5 support
CONFIG_RAID5=n
+8 −0
Original line number Diff line number Diff line
@@ -96,6 +96,8 @@ function usage()
	echo "                           No path required."
	echo " nvme-cuse                 Build NVMe driver with support for CUSE-based character devices."
	echo "                           No path required."
	echo " raid5                     Build with bdev_raid module RAID5 support."
	echo "                           No path required."
	echo ""
	echo "Environment variables:"
	echo ""
@@ -409,6 +411,12 @@ for i in "$@"; do
		--without-nvme-cuse)
			CONFIG[NVME_CUSE]=n
			;;
		--with-raid5)
			CONFIG[RAID5]=y
			;;
		--without-raid5)
			CONFIG[RAID5]=n
			;;
		--)
			break
			;;
+5 −0
Original line number Diff line number Diff line
@@ -36,6 +36,11 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

CFLAGS += -I$(SPDK_ROOT_DIR)/lib/bdev/
C_SRCS = bdev_raid.c bdev_raid_rpc.c raid0.c

ifeq ($(CONFIG_RAID5),y)
C_SRCS += raid5.c
endif

LIBNAME = bdev_raid

include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk
+2 −0
Original line number Diff line number Diff line
@@ -846,6 +846,8 @@ static struct {
} g_raid_level_names[] = {
	{ "raid0", RAID0 },
	{ "0", RAID0 },
	{ "raid5", RAID5 },
	{ "5", RAID5 },
	{ }
};

+10 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
enum raid_level {
	INVALID_RAID_LEVEL	= -1,
	RAID0			= 0,
	RAID5			= 5,
};

/*
@@ -162,6 +163,9 @@ struct raid_bdev {

	/* Module for RAID-level specific operations */
	struct raid_bdev_module		*module;

	/* Private data for the raid module */
	void				*module_private;
};

#define RAID_FOR_EACH_BASE_BDEV(r, i) \
@@ -262,6 +266,12 @@ struct raid_bdev_module {
	/* Minimum required number of base bdevs. Must be > 0. */
	uint8_t base_bdevs_min;

	/*
	 * Maximum number of base bdevs that can be removed without failing
	 * the array.
	 */
	uint8_t base_bdevs_max_degraded;

	/*
	 * Called when the raid is starting, right before changing the state to
	 * online and registering the bdev. Parameters of the bdev like blockcnt
Loading