Linux-BTRFS Archive on lore.kernel.org
 help / color / Atom feed
* [RFC] GRUB: add support for RAID1C3 and RAID1C4
@ 2019-12-02 18:19 Goffredo Baroncelli
  2019-12-02 18:19 ` [PATCH] btrfs: " Goffredo Baroncelli
  2019-12-03 13:23 ` [RFC] GRUB: " David Sterba
  0 siblings, 2 replies; 4+ messages in thread
From: Goffredo Baroncelli @ 2019-12-02 18:19 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs


The enclosed patch adds support for RAID1C3 and RAID1C4 to grub.
I know that David already told that he want to write one; however
recently I looked to the grub source and so I make a patch.

I tested the patch as following:
- computing the checksum of a file bigger than 64KB in a RAID1C3 
  filesystem (so the file is in a data bG)
- computing the checksum of a file smaller than 64KB in a RAID1C3
  filesystem (so the file is in the metadata BG)
- computing the checksum of a file bigger than 64KB in a RAID1C4 
  filesystem (so the file is in a data bG)
- computing the checksum of a file smaller than 64KB in a RAID1C4
  filesystem (so the file is in the metadata BG)
- perform the tests abowe removing some disks in order to test all the
  possible missing disks combination

Of course the test is considered passed if the checksum matches with
its correct value.

Comments are welcome.

BR
G.Baroncelli

-- 
gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D  17B2 0EDA 9B37 8B82 E0B5


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] btrfs: add support for RAID1C3 and RAID1C4
  2019-12-02 18:19 [RFC] GRUB: add support for RAID1C3 and RAID1C4 Goffredo Baroncelli
@ 2019-12-02 18:19 ` " Goffredo Baroncelli
  2019-12-03 13:23 ` [RFC] GRUB: " David Sterba
  1 sibling, 0 replies; 4+ messages in thread
From: Goffredo Baroncelli @ 2019-12-02 18:19 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs, Goffredo Baroncelli

From: Goffredo Baroncelli <kreijack@inwind.it>

Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
---
 grub-core/fs/btrfs.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 48bd3d04a..191c5cd63 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -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       0x400
   grub_uint8_t dummy2[0xc];
   grub_uint16_t nstripes;
   grub_uint16_t nsubstripes;
@@ -1088,6 +1090,24 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
 	      stripe_offset = chunk_stripe_length * high + low;
 	      csize = chunk_stripe_length - low;
 
+	      break;
+	    }
+	  case GRUB_BTRFS_CHUNK_TYPE_RAID1C3:
+	    {
+	      grub_dprintf ("btrfs", "RAID1C3\n");
+	      stripen = 0;
+	      stripe_offset = off;
+	      csize = grub_le_to_cpu64 (chunk->size) - off;
+	      redundancy = 3;
+	      break;
+	    }
+	  case GRUB_BTRFS_CHUNK_TYPE_RAID1C4:
+	    {
+	      grub_dprintf ("btrfs", "RAID1C4\n");
+	      stripen = 0;
+	      stripe_offset = off;
+	      csize = grub_le_to_cpu64 (chunk->size) - off;
+	      redundancy = 4;
 	      break;
 	    }
 	  default:
-- 
2.24.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] GRUB: add support for RAID1C3 and RAID1C4
  2019-12-02 18:19 [RFC] GRUB: add support for RAID1C3 and RAID1C4 Goffredo Baroncelli
  2019-12-02 18:19 ` [PATCH] btrfs: " Goffredo Baroncelli
@ 2019-12-03 13:23 ` " David Sterba
  2019-12-03 17:30   ` Goffredo Baroncelli
  1 sibling, 1 reply; 4+ messages in thread
From: David Sterba @ 2019-12-03 13:23 UTC (permalink / raw)
  To: Goffredo Baroncelli; +Cc: linux-btrfs

On Mon, Dec 02, 2019 at 07:19:27PM +0100, Goffredo Baroncelli wrote:
> 
> The enclosed patch adds support for RAID1C3 and RAID1C4 to grub.
> I know that David already told that he want to write one; however
> recently I looked to the grub source and so I make a patch.

I sent the support patches some time ago, the were held back until the
kernel support lands. This happened in 5.5-rc1 and Daniel is about to
add the patch to grub git.

https://lists.gnu.org/archive/html/grub-devel/2019-11/msg00012.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] GRUB: add support for RAID1C3 and RAID1C4
  2019-12-03 13:23 ` [RFC] GRUB: " David Sterba
@ 2019-12-03 17:30   ` Goffredo Baroncelli
  0 siblings, 0 replies; 4+ messages in thread
From: Goffredo Baroncelli @ 2019-12-03 17:30 UTC (permalink / raw)
  To: dsterba, linux-btrfs

On 03/12/2019 14.23, David Sterba wrote:
> On Mon, Dec 02, 2019 at 07:19:27PM +0100, Goffredo Baroncelli wrote:
>>
>> The enclosed patch adds support for RAID1C3 and RAID1C4 to grub.
>> I know that David already told that he want to write one; however
>> recently I looked to the grub source and so I make a patch.
> 
> I sent the support patches some time ago, the were held back until the
> kernel support lands. This happened in 5.5-rc1 and Daniel is about to
> add the patch to grub git.
> 
> https://lists.gnu.org/archive/html/grub-devel/2019-11/msg00012.html
> 
Perfect, so please ignore my patch
BR


-- 
gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D  17B2 0EDA 9B37 8B82 E0B5

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-02 18:19 [RFC] GRUB: add support for RAID1C3 and RAID1C4 Goffredo Baroncelli
2019-12-02 18:19 ` [PATCH] btrfs: " Goffredo Baroncelli
2019-12-03 13:23 ` [RFC] GRUB: " David Sterba
2019-12-03 17:30   ` Goffredo Baroncelli

Linux-BTRFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-btrfs/0 linux-btrfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-btrfs linux-btrfs/ https://lore.kernel.org/linux-btrfs \
		linux-btrfs@vger.kernel.org
	public-inbox-index linux-btrfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git