From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1fGPQR-0006A0-IA for mharc-grub-devel@gnu.org; Wed, 09 May 2018 09:46:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGPQP-00069s-Ew for grub-devel@gnu.org; Wed, 09 May 2018 09:46:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGPQL-000206-J4 for grub-devel@gnu.org; Wed, 09 May 2018 09:46:33 -0400 Received: from boksu.net-space.pl ([185.15.1.105]:44990) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.71) (envelope-from ) id 1fGPQL-0001xC-66 for grub-devel@gnu.org; Wed, 09 May 2018 09:46:29 -0400 Received: (from localhost user: 'dkiper' uid#4000 fake: STDIN (dkiper@boksu.net-space.pl)) by router-fw-old.local.net-space.pl id S1838950AbeEINq0 (ORCPT ); Wed, 9 May 2018 15:46:26 +0200 Date: Wed, 9 May 2018 15:46:26 +0200 From: Daniel Kiper To: The development of GNU GRUB Cc: Goffredo Baroncelli Subject: Re: [PATCH 1/7] Add support for reading a filesystem with a raid5 or raid6 profile. Message-ID: <20180509134626.GB25320@router-fw-old.local.net-space.pl> References: <20180424191316.11031-1-kreijack@inwind.it> <20180424191316.11031-2-kreijack@inwind.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180424191316.11031-2-kreijack@inwind.it> User-Agent: Mutt/1.3.28i X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.15.1.105 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2018 13:46:34 -0000 On Tue, Apr 24, 2018 at 09:13:10PM +0200, Goffredo Baroncelli wrote: > Signed-off-by: Goffredo Baroncelli > --- > grub-core/fs/btrfs.c | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c > index be195448d..b0032ea46 100644 > --- a/grub-core/fs/btrfs.c > +++ b/grub-core/fs/btrfs.c > @@ -119,6 +119,8 @@ struct grub_btrfs_chunk_item > #define GRUB_BTRFS_CHUNK_TYPE_RAID1 0x10 > #define GRUB_BTRFS_CHUNK_TYPE_DUPLICATED 0x20 > #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_RAID5 0x80 #define GRUB_BTRFS_CHUNK_TYPE_RAID6 0x100 Please start in one column... ----> ^^^^^ > grub_uint8_t dummy2[0xc]; > grub_uint16_t nstripes; > grub_uint16_t nsubstripes; > @@ -764,6 +766,36 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, > stripe_offset = low + chunk_stripe_length > * high; > csize = chunk_stripe_length - low; > + break; > + } > + case GRUB_BTRFS_CHUNK_TYPE_RAID5: > + case GRUB_BTRFS_CHUNK_TYPE_RAID6: > + { > + grub_uint64_t nparities; > + grub_uint64_t stripe_nr, high; > + grub_uint64_t low; Could you define all in one line? > + redundancy = 1; /* no redundancy for now */ > + > + if (grub_le_to_cpu64 (chunk->type) & GRUB_BTRFS_CHUNK_TYPE_RAID5) > + { > + grub_dprintf ("btrfs", "RAID5\n"); > + nparities = 1; > + } > + else > + { > + grub_dprintf ("btrfs", "RAID6\n"); > + nparities = 2; > + } > + > + stripe_nr = grub_divmod64 (off, chunk_stripe_length, &low); This is clear for me... > + high = grub_divmod64 (stripe_nr, nstripes - nparities, &stripen); > + grub_divmod64 (high + stripen, nstripes, &stripen); ... but not these two. Could you enlighten me? > + stripe_offset = low + chunk_stripe_length * high; ??? > + csize = chunk_stripe_length - low; Chunk size to read? Daniel