grub2/0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch

52 lines
1.9 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: David Sterba <dave@jikos.cz>
Date: Mon, 4 Nov 2019 17:23:22 +0100
Subject: [PATCH] btrfs: Add support for new RAID1C34 profiles
New 3- and 4-copy variants of RAID1 were merged into Linux kernel 5.5.
Add the two new profiles to the list of recognized ones. As this builds
on the same code as RAID1, only the redundancy level needs to be
adjusted, the rest is done by the existing code.
Signed-off-by: David Sterba <dsterba@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
grub-core/fs/btrfs.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 0d8c666aea1..78f5de37b27 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -144,6 +144,8 @@ struct grub_btrfs_chunk_item
#define GRUB_BTRFS_CHUNK_TYPE_RAID10 0x40
#define GRUB_BTRFS_CHUNK_TYPE_RAID5 0x80
#define GRUB_BTRFS_CHUNK_TYPE_RAID6 0x100
+#define GRUB_BTRFS_CHUNK_TYPE_RAID1C3 0x200
+#define GRUB_BTRFS_CHUNK_TYPE_RAID1C4 0x400
grub_uint8_t dummy2[0xc];
grub_uint16_t nstripes;
grub_uint16_t nsubstripes;
@@ -1003,14 +1005,19 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
csize = (stripen + 1) * stripe_length - off;
break;
}
+ case GRUB_BTRFS_CHUNK_TYPE_RAID1C4:
+ redundancy++;
+ /* fall through */
+ case GRUB_BTRFS_CHUNK_TYPE_RAID1C3:
+ redundancy++;
+ /* fall through */
case GRUB_BTRFS_CHUNK_TYPE_DUPLICATED:
case GRUB_BTRFS_CHUNK_TYPE_RAID1:
{
- grub_dprintf ("btrfs", "RAID1\n");
+ grub_dprintf ("btrfs", "RAID1 (copies: %d)\n", ++redundancy);
stripen = 0;
stripe_offset = off;
csize = grub_le_to_cpu64 (chunk->size) - off;
- redundancy = 2;
break;
}
case GRUB_BTRFS_CHUNK_TYPE_RAID0: