From patchwork Tue Dec 12 12:37:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 17909 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7692012vqy; Tue, 12 Dec 2023 04:38:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFV71OW96out+LWglaZwa1TErDrFc4x2LRcspC8PiTY+gErAqu+nxWkY7kuDEfMY3nVzNe0 X-Received: by 2002:a05:6a20:3d09:b0:190:1cf7:1322 with SMTP id y9-20020a056a203d0900b001901cf71322mr3733043pzi.61.1702384705515; Tue, 12 Dec 2023 04:38:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702384705; cv=none; d=google.com; s=arc-20160816; b=S9SeBdSJCYrQKvkQK2wGtrgXdO4YITNDGZ6sHzOiROPd74XeNKp5aGamNWD8BK7Kxb 8gXaRvW1RfXDRcMfFJfUbTRkhsah9CMN6b7UIpSAifh+0p4/I6V+cT8CTlcZlVRNtWdI NuzOn1k0AW6ZTITLpP10JXvgknLV5LKkjoAuvsojMC/FLW2pQaiQjRVSgW5iKd2NMgQo djM8nHPoZlAC/JkTWTX1bVHL1qGeuwms7M8H1q73jAELRD8oGDNJmlVZvYLZCxEYCi05 8i4IPJRDAu/lVzadiKRPf5sL7sh//WRYFPfBgRVvFXQxg2XELzBlAUAQb6okVvM7/qot 2UGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :message-id:date:subject:from:wdcironportexception:ironport-sdr :ironport-sdr:dkim-signature; bh=w/+6153T9FCHrhM3LNfDbrTSxUM9/L3e5+FhAlMQ2ZI=; fh=RkzPy8j9Bgyvxc5aNhoOEUjthII6WQwvTfVAiEIVvUg=; b=RfZeNE9INLB3lUQoQjUveDfuJ9sUgdxro7r3cscnZvHmlv5Gf2zpNmpEp6v/y4UkHr c/beAy58FU/impBDpQy0CGLxzh+mGo92hUt67LZ1mGElCz63TJX3fknNlP5/ZjmSHiDZ TnMPacBlbnB8VdVLmr48cYB567fjb1ytjOcHmsy1GkhPS9nby2ApsfE/bLxNlJmbItDg 5qc+/DWOhykmTYodo+D1TBrAMWIxUt825TYXFSn6dQqtQ/SA+y46nGTwLRCMfq4v4wZL YSOkBIwgq+VR3JjWEzqey9WgekHHpD1yb+Pinex8kJHRt1Ys0yJ0b0tJEXg3IPnVc1UQ Vzug== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=fuh3S6cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wdc.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id v124-20020a632f82000000b005b11e5a69f8si7519072pgv.531.2023.12.12.04.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 04:38:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=fuh3S6cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wdc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id E1AA18063CCF; Tue, 12 Dec 2023 04:38:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346609AbjLLMiM (ORCPT + 99 others); Tue, 12 Dec 2023 07:38:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346615AbjLLMiK (ORCPT ); Tue, 12 Dec 2023 07:38:10 -0500 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 444DB110; Tue, 12 Dec 2023 04:38:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1702384695; x=1733920695; h=from:subject:date:message-id:mime-version: content-transfer-encoding:to:cc; bh=HxLnsy+1wzJFDbdBgEWHFKFPXH75LHkJH8uVaiHdWO0=; b=fuh3S6cznHcmN0xl/8jz9/9DUQDWiGPV+EN8qb6RRVk356qSfZwAccfW bWqmKur7LZIAYoUV+tp0gRZh8VaPwP8Zw79vAqo93gV2UzCA3eq+9iQtG Et/f+z54200iCT+BbAHRVQn1+hjolXb0zuFOhitMieha9mZhMA3/sgkJl Vc7iIGV+1QhEDlKNteIdCcK55i6JuTniwUX4+XcsLacG94qvu9S33OkVa +V84U64utzSwCPPzFNkCbFiPSzgiiptAlfzawa7vaJgfs5vOdFepsK0xy +j4hLgbiaCpEdCIDBB5zyyY9eNzLFxJkjpOBfj+lf33ponx5c/0GbYTDH Q==; X-CSE-ConnectionGUID: xCwpIT7FSHaErwldKyunDg== X-CSE-MsgGUID: UdtOej1lRbKvuC80Tl2gXQ== X-IronPort-AV: E=Sophos;i="6.04,270,1695657600"; d="scan'208";a="4629785" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 12 Dec 2023 20:38:13 +0800 IronPort-SDR: 5Fhmkq7VxQSiyP2WOKOmkC97fn6L5aMvXcdglI8a0KvblJDJ/Yt56eNDh2bWmqIG5gjC1gWHkt vz+OcEYEGPqw== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 12 Dec 2023 03:43:26 -0800 IronPort-SDR: WzDIvKQqA3LLyuNHm+UkZVLffG9NuRobe5ag3IJc77mUmdGQv/ZThDS0U338FLmLswjLsOAfWe R9teZsu2MpUw== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 12 Dec 2023 04:38:12 -0800 From: Johannes Thumshirn Subject: [PATCH 00/13] btrfs: clean up RAID I/O geometry calculation Date: Tue, 12 Dec 2023 04:37:58 -0800 Message-Id: <20231212-btrfs_map_block-cleanup-v1-0-b2d954d9a55b@wdc.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIACZUeGUC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDI2NDIwNz3aSSorTi+NzEgviknPzkbN3knNTEvNICXWMTszRT48S0NEuDFCW g7oKi1LTMCrDJ0bG1tQCdbVldaQAAAA== To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1702384691; l=1540; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=HxLnsy+1wzJFDbdBgEWHFKFPXH75LHkJH8uVaiHdWO0=; b=s0YTYTdmfza6AEe2dcweU8WfdAEb56Vd6rQELH/ft5wMIDIdr8u7D8NPLSKllTdu6Wn2fHsRE Dg/6r7NPbA+BWojqQDifnWwlMwyFN5b6IB2XbUlDuMbqISpXTbgTXPD X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 12 Dec 2023 04:38:22 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785079744618541322 X-GMAIL-MSGID: 1785079744618541322 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. --- 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: 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 fs/btrfs/volumes.c | 388 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 245 insertions(+), 143 deletions(-) --- base-commit: 14d1d39586246ca9d4ce97049c98be849e3bbcd9 change-id: 20231207-btrfs_map_block-cleanup-346f53aff90d Best regards,