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.
Showing the changes to include/uapi/linux (2 of 6 files). Show all
Unified · Split
| @@ -833,6 +833,7 @@ enum btrfs_err_code { · 832 unmodified lines | ||
| 833 | 833 | BTRFS_ERROR_DEV_ONLY_WRITABLE, |
| 834 | 834 | BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS, |
| 835 | 835 | BTRFS_ERROR_DEV_RAID1C3_MIN_NOT_MET, |
| 836 | + BTRFS_ERROR_DEV_RAID1C4_MIN_NOT_MET, | |
| 836 | 837 | }; |
| 837 | 838 | |
| 838 | 839 | #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \ |
| @@ -842,6 +842,7 @@ struct btrfs_dev_replace_item { · 841 unmodified lines | ||
| 842 | 842 | #define BTRFS_BLOCK_GROUP_RAID5 (1ULL << 7) |
| 843 | 843 | #define BTRFS_BLOCK_GROUP_RAID6 (1ULL << 8) |
| 844 | 844 | #define BTRFS_BLOCK_GROUP_RAID1C3 (1ULL << 9) |
| 845 | +#define BTRFS_BLOCK_GROUP_RAID1C4 (1ULL << 10) | |
| 845 | 846 | #define BTRFS_BLOCK_GROUP_RESERVED (BTRFS_AVAIL_ALLOC_BIT_SINGLE | \ |
| 846 | 847 | BTRFS_SPACE_INFO_GLOBAL_RSV) |
| 847 | 848 | |
| @@ -854,6 +855,7 @@ enum btrfs_raid_types { · 6 unmodified lines | ||
| 854 | 855 | BTRFS_RAID_RAID5, |
| 855 | 856 | BTRFS_RAID_RAID6, |
| 856 | 857 | BTRFS_RAID_RAID1C3, |
| 858 | + BTRFS_RAID_RAID1C4, | |
| 857 | 859 | BTRFS_NR_RAID_TYPES |
| 858 | 860 | }; |
| 859 | 861 | |
| @@ -864,6 +866,7 @@ enum btrfs_raid_types { · 4 unmodified lines | ||
| 864 | 866 | #define BTRFS_BLOCK_GROUP_PROFILE_MASK (BTRFS_BLOCK_GROUP_RAID0 | \ |
| 865 | 867 | BTRFS_BLOCK_GROUP_RAID1 | \ |
| 866 | 868 | BTRFS_BLOCK_GROUP_RAID1C3 | \ |
| 869 | + BTRFS_BLOCK_GROUP_RAID1C4 | \ | |
| 867 | 870 | BTRFS_BLOCK_GROUP_RAID5 | \ |
| 868 | 871 | BTRFS_BLOCK_GROUP_RAID6 | \ |
| 869 | 872 | BTRFS_BLOCK_GROUP_DUP | \ |
| @@ -872,7 +875,8 @@ enum btrfs_raid_types { · 2 unmodified lines | ||
| 872 | 875 | BTRFS_BLOCK_GROUP_RAID6) |
| 873 | 876 | |
| 874 | 877 | #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) | |
| 876 | 880 | |
| 877 | 881 | /* |
| 878 | 882 | * We need a bit for restriper to be able to tell when chunks of type |