History

btrfs: add support for 4-copy replication (raid1c4)

Add new block group profile to store 4 copies in a simliar way that current RAID1 does. The profile attributes and constraints are defined in the raid table and used by the same code that already handles the 2- and 3-copy RAID1. The minimum number of devices is 4, the maximum number of devices/chunks that can be lost/damaged is 3. There is no comparable traditional RAID level, the profile is added for future needs to accompany triple-parity and beyond.

David Sterba committed 8 years ago

Commit 8d6fac01 parent 47e6f746 files · +24 −3Browse files

Showing the changes to include/uapi/linux (2 of 6 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/btrfs.h +1 −0
  2. include/uapi/linux/btrfs_tree.h +5 −1
include/uapi/linux/btrfs.h+1−0
@@ -833,6 +833,7 @@ enum btrfs_err_code { · 832 unmodified lines
833833 BTRFS_ERROR_DEV_ONLY_WRITABLE,
834834 BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS,
835835 BTRFS_ERROR_DEV_RAID1C3_MIN_NOT_MET,
836+ BTRFS_ERROR_DEV_RAID1C4_MIN_NOT_MET,
836837 };
837838
838839 #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
include/uapi/linux/btrfs_tree.h+5−1
@@ -842,6 +842,7 @@ struct btrfs_dev_replace_item { · 841 unmodified lines
842842 #define BTRFS_BLOCK_GROUP_RAID5 (1ULL << 7)
843843 #define BTRFS_BLOCK_GROUP_RAID6 (1ULL << 8)
844844 #define BTRFS_BLOCK_GROUP_RAID1C3 (1ULL << 9)
845+#define BTRFS_BLOCK_GROUP_RAID1C4 (1ULL << 10)
845846 #define BTRFS_BLOCK_GROUP_RESERVED (BTRFS_AVAIL_ALLOC_BIT_SINGLE | \
846847 BTRFS_SPACE_INFO_GLOBAL_RSV)
847848
@@ -854,6 +855,7 @@ enum btrfs_raid_types { · 6 unmodified lines
854855 BTRFS_RAID_RAID5,
855856 BTRFS_RAID_RAID6,
856857 BTRFS_RAID_RAID1C3,
858+ BTRFS_RAID_RAID1C4,
857859 BTRFS_NR_RAID_TYPES
858860 };
859861
@@ -864,6 +866,7 @@ enum btrfs_raid_types { · 4 unmodified lines
864866 #define BTRFS_BLOCK_GROUP_PROFILE_MASK (BTRFS_BLOCK_GROUP_RAID0 | \
865867 BTRFS_BLOCK_GROUP_RAID1 | \
866868 BTRFS_BLOCK_GROUP_RAID1C3 | \
869+ BTRFS_BLOCK_GROUP_RAID1C4 | \
867870 BTRFS_BLOCK_GROUP_RAID5 | \
868871 BTRFS_BLOCK_GROUP_RAID6 | \
869872 BTRFS_BLOCK_GROUP_DUP | \
@@ -872,7 +875,8 @@ enum btrfs_raid_types { · 2 unmodified lines
872875 BTRFS_BLOCK_GROUP_RAID6)
873876
874877 #define BTRFS_BLOCK_GROUP_RAID1_MASK (BTRFS_BLOCK_GROUP_RAID1 | \
875− BTRFS_BLOCK_GROUP_RAID1C3)
878+ BTRFS_BLOCK_GROUP_RAID1C3 | \
879+ BTRFS_BLOCK_GROUP_RAID1C4)
876880
877881 /*
878882 * We need a bit for restriper to be able to tell when chunks of type