Btrfs support for RAID1C34
cover Btrfs support for RAID1C34
Hi,
btrfs is going to get support for 3- and 4-copy RAID1,
https://lore.kernel.org/linux-btrfs/[email protected]/
This patch adds the support. The code changes are minimal, it's essentially only extension of what RAID1 does.
I haven't tested it though, the docs don't see to cover filesystem support testing. What I tried:
* make btrfs_test
* ./btrfs_test
It did not find any compressible file from the candidate list, I wonder why a dummy zero-filled file cannot be created instead.
Then running it seems to create only the default profile of the images (mkfs prints only single/dup for data and metadata), the following message seems to repeat without any real progress:
--
Label: grub_;/testé莭莽😁киритi urewfceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoi
UUID: f6d3e26c-4d6c-407d-b981-7aa6d842578a
Node size: 16384
Sector size: 4096
Filesystem size: 5.66GiB
Block group profiles:
Data: single 8.00MiB
Metadata: DUP 256.00MiB
System: DUP 8.00MiB
SSD detected: no
Incompat features: extref, skinny-metadata
Number of devices: 1
Devices:
ID SIZE PATH
1 5.66GiB /dev/loop0Device proc: Filesystem type procfs - Sector size 512B - Total size 0KiB
Device loop0: Filesystem type btrfs - Label `grub_;/testé莭莽😁киритi urewfceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoi', UUID f6d3e26c-4d6c-407d-b981-7aa6d842578a - Sector size 512B - Total size 5939200KiB Device host: Filesystem type hostfs - Sector size 512B - Total size 0KiB
umount: /tmp/tmp.1I3JDrkI64/btrfs_zstd_rw: not mounted. --
There must be something I'm missing, please advise. Thanks.
David Sterba (1):
btrfs: add support for new raid1c34 profiles
grub-core/fs/btrfs.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
Signature · 1 line
2.23.0
PATCH 1/1 btrfs: add support for new raid1c34 profiles
There are new 3- and 4-copy variants of RAID1, estimated to be merged to 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.
--- grub-core/fs/btrfs.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
grub-core/fs/btrfs.c +10 -2
@@ -136,6 +136,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 0x400grub_uint8_t dummy2[0xc ];grub_uint16_t nstripes;grub_uint16_t nsubstripes;
@@ -964,14 +966,20 @@ 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" ); + redundancy++; +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 :
Signature · 1 line
2.23.0
Re: [PATCH 1/1] btrfs: add support for new raid1c34 profiles
Quoted 6 lines · David Sterba
There are new 3- and 4-copy variants of RAID1, estimated to be merged to 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 <[email protected]>
if patches are in Linux kernel 5.5 (or later). So, please drop me a line when it happens.
Daniel
Quoted 42 lines
--- grub-core/fs/btrfs.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)grub-core/fs/btrfs.c +10
-3@@ -136,6 +136,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 0x400grub_uint8_t dummy2[0xc ];grub_uint16_t nstripes;grub_uint16_t nsubstripes;@@ -964,14 +966,20 @@ 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" ); + redundancy++; +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 : --2.23.0
Re: [PATCH 1/1] btrfs: add support for new raid1c34 profiles
Quoted 11 lines · Daniel Kiper
Quoted 6 lines · David Sterba
There are new 3- and 4-copy variants of RAID1, estimated to be merged to 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 <[email protected]>if patches are in Linux kernel 5.5 (or later). So, please drop me a line when it happens.
FYI, the kernel code has been merged, first milestone will be 5.5-rc1 in a week o so.
Re: [PATCH 1/1] btrfs: add support for new raid1c34 profiles
Quoted 7 lines · David Sterba
Quoted 6 lines · Daniel Kiper
Quoted 5 lines · David Sterba
There are new 3- and 4-copy variants of RAID1, estimated to be merged to 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.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by David Sterba <[email protected]>if patches are in Linux kernel 5.5 (or later). So, please drop me a line when it happens.
FYI, the kernel code has been merged, first milestone will be 5.5-rc1 in a week o so.
Great! I will merge this patch next week or so.
Daniel