From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAC64C433F5 for ; Fri, 13 May 2022 11:43:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380036AbiEMLnq (ORCPT ); Fri, 13 May 2022 07:43:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380029AbiEMLnS (ORCPT ); Fri, 13 May 2022 07:43:18 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 749B6FD36C for ; Fri, 13 May 2022 04:42:44 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 26C9A1F460; Fri, 13 May 2022 11:42:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1652442163; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ATb7NIJE0UbXKg+jMu55Ix4KBBTrGWyleP1/nJCRXw4=; b=0LTSR9uPAaXNE8GiepSAy9GwwPmfrco00lXfqudkL/tsOyLZwIhZcTRs2vgrtGbq4rneNu 1hOYZMfrz+KjtCONZbQXaZHLQKWTbrPTSAtyobFD+IDX7Wrw6aZ+o9vo6xiP5RAyadn2/4 mflSgvOaSTAVy6u2A+rPIhH6CLNI/Ms= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1652442163; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ATb7NIJE0UbXKg+jMu55Ix4KBBTrGWyleP1/nJCRXw4=; b=IsFLQQJZCUeRDVxCDc7aZ3PHwBOohcxu0mAXEPwwURUdLHp66gXEIWkSWPeHfcxPDHRxF1 brHkxjuvPyKd13DQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0149D13A84; Fri, 13 May 2022 11:42:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mXT5OjJEfmJFPwAAMHmgww (envelope-from ); Fri, 13 May 2022 11:42:42 +0000 Date: Fri, 13 May 2022 13:38:26 +0200 From: David Sterba To: Qu Wenruo Cc: linux-btrfs@vger.kernel.org Subject: Re: [PATCH 0/4] btrfs: cleanups and preparation for the incoming RAID56J features Message-ID: <20220513113826.GV18596@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Qu Wenruo , linux-btrfs@vger.kernel.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Fri, May 13, 2022 at 04:34:27PM +0800, Qu Wenruo wrote: > Since I'm going to introduce two new chunk profiles, RAID5J and RAID6J > (J for journal), Do you need to introduce completely new profiles? IIRC in my drafts I was more inclined to reuse a dedicated raid1c3 block group, of an arbitrary size and not used by anything else. A new profile would technically work too but it brings other issues. As a related feature to the raid56, I was working on the striped raid10c34 profiles but was not able to make it work. In a sense this is easier as it reuses existing code, but if you make the journal work we won't need that. > if we're relying on ad-hoc if () else if () branches to > calculate thing like number of p/q stripes, it will cause a lot of > problems. > > In fact, during my development, I have hit tons of bugs related to this. > > One example is alloc_rbio(), it will assign rbio->nr_data, if we forgot > to update the check for RAID5 and RAID6 profiles, we will got a bad > nr_data == num_stripes, and screw up later writeback. > > 90% of my suffering comes from such ad-hoc usage doing manual checks on > RAID56. > > Another example is, scrub_stripe() which due to the extra per-device > reservation, @dev_extent_len is no longer the same the data stripe > length calculated from extent_map. > > So this patchset will do the following cleanups preparing for the > incoming RAID56J (already finished coding, functionality and on-disk > format are fine, although no journal yet): > > - Calculate device stripe length in-house inside scrub_stripe() > This removes one of the nasty mismatch which is less obvious. > > - Use btrfs_raid_array[] based calculation instead of ad-hoc check > The only exception is scrub_nr_raid_mirrors(), which has several > difference against btrfs_num_copies(): > > * No iteration on all RAID6 combinations > No sure if it's planned or not. > > * Use bioc->num_stripes directly > In that context, bioc is already all the mirrors for the same > stripe, thus no need to lookup using btrfs_raid_array[]. > > With all these cleanups, the RAID56J will be much easier to implement. > > Qu Wenruo (4): > btrfs: remove @dev_extent_len argument from scrub_stripe() function > btrfs: use btrfs_chunk_max_errors() to replace weird tolerance > calculation > btrfs: use btrfs_raid_array[] to calculate the number of parity > stripes > btrfs: use btrfs_raid_array[].ncopies in btrfs_num_copies() The preparatory patches look good to me.