Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5521252rdb; Wed, 13 Dec 2023 10:59:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGOEtQO4O5wgQteS+P75HG3yJraOE+9lZH4UWEgwtxhIzt2cO2UUBNDO3aa9U/OVEnZzGM X-Received: by 2002:a17:902:8a88:b0:1d0:6ffd:9e24 with SMTP id p8-20020a1709028a8800b001d06ffd9e24mr7537831plo.118.1702493969102; Wed, 13 Dec 2023 10:59:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702493969; cv=none; d=google.com; s=arc-20160816; b=HI2eH1bsxocbScPY2r843FJTOzsIXwySEdj33v8yA4gyBOSdYJePLuMjdGF4gekyET 4rPm9/9JjruGgsloTK1GVoYLYgdpvTx02cqQWBWyInL+eq4YT4ss4xyfMAY8diYCF/pa 7QHk0UfzIDIaBbIYEkIYuqnYEutufo/XvUTb2iJFdUzR9EdNPMX+6j0yNmxh5nvReBtO P/rqWEy6el6Qk+mqJwDH0A9cyHHqdetKkwozJrnNj/ZL0yyiO1R5Texs3yOoHaTrs0OQ MbMX+ynHOvy/1jmmNvtmU2p3dtuwM2T8SrhDZTCafwqckFk4C+5fdFBvEHss1tOAlHPv cKtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature:dkim-signature:dkim-signature; bh=u0h2ZNG6X6V2rHTRwXj9IAT1q7q1TXEd0rgOFUzHYeY=; fh=Uu4a/AU5tD3hBZjEl4F4SpkgSGbxvrRFP6Mdc/DLpTk=; b=l1ZrzEH+hFehxCV7S2pLPsnO03mt7B0sxKg2ZJ3PFBT8BpQKILyVeeu3LxdUJZJlhk arsi9yZKSzHNcqR5EpiDZOmnMnNT8+uiBKcIuirjFZaNzszpMNin0CibL20hjyU6zYWv eFQEiydyKdwloKUg7c0e6CMkUd/x6d2yQGxVfxM/DcjSEEM7+iBTTGUSaxJSnnbqjcrG RO2gIfPpJv2a7aH0YHlC4Vu1h2jd7c70zkUJ/5STBfG8AM9RYHJ28tHuXKAXBBOXDE6X vSCV5FAu/TrzpNhpFg+bOu+aY5xpdv9jbozI/Ibvy1JT/N8LwF/YswgSF+cmLwpYO4D+ /SrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=MfhlQCGV; dkim=neutral (no key) header.i=@suse.cz; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=YHxopBlF; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=iZDRitE9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id bb8-20020a170902bc8800b001cfd66f31ccsi10023130plb.55.2023.12.13.10.59.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 10:59:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=MfhlQCGV; dkim=neutral (no key) header.i=@suse.cz; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=YHxopBlF; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=iZDRitE9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 880DB826ED00; Wed, 13 Dec 2023 10:59:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233779AbjLMS7N (ORCPT + 99 others); Wed, 13 Dec 2023 13:59:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233264AbjLMS7L (ORCPT ); Wed, 13 Dec 2023 13:59:11 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1593BD0; Wed, 13 Dec 2023 10:59:18 -0800 (PST) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id EF39A1F45E; Wed, 13 Dec 2023 18:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1702493956; 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=u0h2ZNG6X6V2rHTRwXj9IAT1q7q1TXEd0rgOFUzHYeY=; b=MfhlQCGVwnNe56TOW67WFbF+2HU+1C9glnpl2r1vXB8KJ+OLnUo8jyTk0usuSA3W7mWRBg hKCVlE853dhVb8IsRNOQhlM6CXTDvPF9AyVLGSUlogwwppnOviptXNn3cuX6ayvNUMjdDj kkk+C4TuxsCQUjHfdZDC4yq4B7aez7s= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1702493956; 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=u0h2ZNG6X6V2rHTRwXj9IAT1q7q1TXEd0rgOFUzHYeY=; b=Zr+cwYeA+iiBGRJNwiweahOa8+iBthNY3+h2LkPmkHj8032uhYuyi04XGfthRts2exMSQj Rzlb6h/0QGFSFbDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1702493935; 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=u0h2ZNG6X6V2rHTRwXj9IAT1q7q1TXEd0rgOFUzHYeY=; b=YHxopBlFh3TlniK7EMx1Is3WBXkn9FdKnhT2H4gpQHDUMfpfWXFEo9cKNjKjt3/DKefF1x HFVM0ME7e5vXQ2QttZcvIK28U3OtTpycJDiO8R2MBJHd4UqfNEZ3z/+gqlxZvWC3cUPfEV av+C4oGeB56u1qQlGzXaziHLkAXUtlw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1702493935; 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=u0h2ZNG6X6V2rHTRwXj9IAT1q7q1TXEd0rgOFUzHYeY=; b=iZDRitE92MqWAO1DQ1/7z3VfOc91vMBQYVEU3t4nwaaRfX3d4RBl4Tg6k2rQR/KN5qyBtV Yt0sY5j518cgu+BQ== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id B5B911391D; Wed, 13 Dec 2023 18:58:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id upEyK+/+eWWgCwAAn2gu4w (envelope-from ); Wed, 13 Dec 2023 18:58:55 +0000 Date: Wed, 13 Dec 2023 19:52:04 +0100 From: David Sterba To: Johannes Thumshirn Cc: Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: Re: [PATCH v2 00/13] btrfs: clean up RAID I/O geometry calculation Message-ID: <20231213185204.GE3001@twin.jikos.cz> Reply-To: dsterba@suse.cz References: <20231213-btrfs_map_block-cleanup-v2-0-cf5cfb9e2400@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231213-btrfs_map_block-cleanup-v2-0-cf5cfb9e2400@wdc.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) X-Spam-Level: X-Spam-Score: -4.00 Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: -3.00 X-Spamd-Result: default: False [-3.00 / 50.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.30)[dsterba@suse.cz]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-0.998]; RCPT_COUNT_SEVEN(0.00)[7]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 13 Dec 2023 10:59:26 -0800 (PST) On Wed, Dec 13, 2023 at 06:42:55AM -0800, Johannes Thumshirn wrote: > The calculation of the RAID I/O geometry in btrfs_map_block has been a maze of > if-else statements for a very long time and the advent of the > raid-stripe-tree made the situation even worse. > > This patchset refactors btrfs_map_block() to untagle the maze and make I/O > geometry setting easier to follow, but does not introduce any functional > changes. > > I've also run it through Josef's CI and there have been test failures, but > none of them introduced by these patches. > > --- > Changes in v2: > - add btrfs_map_op into struct btrfs_io_geometry > - split RAID56 read and write into two different helpers > - drop redundand 'for' in helper function names > - kept dev_replace_is_ongoing variable name > - Link to v1: https://lore.kernel.org/r/20231212-btrfs_map_block-cleanup-v1-0-b2d954d9a55b@wdc.com > > --- > Johannes Thumshirn (13): > btrfs: factor out helper for single device IO check > btrfs: re-introduce struct btrfs_io_geometry > btrfs: factor out block-mapping for RAID0 > btrfs: factor out RAID1 block mapping > btrfs: factor out block mapping for DUP profiles > btrfs: factor out block mapping for RAID10 > btrfs: reduce scope of data_stripes in btrfs_map_block > btrfs: factor out block mapping for RAID5/6 > btrfs: factor out block mapping for single profiles > btrfs: btrfs: untagle if else maze in btrfs_map_block > btrfs: open code set_io_stripe for RAID56 > btrfs: pass struct btrfs_io_geometry to set_io_stripe > btrfs: pass btrfs_io_geometry into btrfs_max_io_len Added to misc-next with some adjustments, thanks. I've noticed some of the helpers can take const parameters, some lines that can be joined so the expression is one one line, but there are calculations like in "btrfs: open code set_io_stripe for RAID56" where it's up to your creativity.