Message ID | 20231213-btrfs_map_block-cleanup-v2-0-cf5cfb9e2400@wdc.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp7824341dys; Wed, 13 Dec 2023 06:43:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFMLbF6lA4yJ6RAEYJC6fLZxwfzbdQbe9TB2OUJVtbCemyRrrMtYp5n3irBqu5nc/O4Tkjb X-Received: by 2002:a05:6358:9889:b0:16d:e1d8:22c7 with SMTP id q9-20020a056358988900b0016de1d822c7mr8308171rwa.29.1702478599338; Wed, 13 Dec 2023 06:43:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702478599; cv=none; d=google.com; s=arc-20160816; b=f/2W9wH2N7yqPgNT2nJlNpmR5Q/Q4mpHne6Ky9N89uNeBXOIlqna4vRa80aqKrHqgR TWyf3JfAuKASkysVPvbLKyIZIJ6O9hQXQcsy7kKz7Rf0uacWXGDwpnxN5bRe4cqvLRhf 4pB3aRq9yv8A9xozjoOyr2IhZNyYWtL7hHkejtLhNF7I9U8Fhrvs68N9ukZ/qqjahauX WnRE+LNUVwn+e2n0Yp28aL0k7P8UAMrc57RShCXHCL7IpRjYXb76OYUT3jDG3We9e6hQ qreS0RkykVw8KDiTV2y6ba22I6MVAS5yGyI7r8Ic/0R6em2OW6ZtGAEdCYrkx8Y7yLjZ CDMw== 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=l4IVtC/bsbJW7fShbjGjWLvQH0pd6ABSZc4yGLSOZ44=; fh=WpTkEVtBXkq0RoDrgO3Js2s/6swFB/ddJMCfC4s0b8Q=; b=xKc8egP0Y5xxAu3qZ3Z7MU4AerE3IpcbJjPTIbPBkirlji/b7YQOFBoI/ERePBzfYT oncqF+R073VTgq6n6QNHBA5mBcAi31CldmiwTOzet//IwUG/Oxa0cqQTmzJgmO1cnooF 7VjGahtvCpvXyx2bwFO+Fz8lM5YCYDmlwnJW3LjAx5iXEJSZP9OrLM3/TEC4KZkS/PtV YpR5Ljavv5NYeUDhGYwa97qx9jj83XP9sA17NO4J8pzEGwGu9+uEhJtt1+9Ijw1FbCRG Tk9nNGoWL6hUqJDmtjmGkBr1A48o4MihDKR2yDN2Z/NxEVfU31kuqYocKPOkJq+gzalf 2NHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=pLCya56+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id u2-20020a656702000000b005b915369810si9174251pgf.590.2023.12.13.06.43.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 06:43:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=pLCya56+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id B2B368031C54; Wed, 13 Dec 2023 06:43:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235413AbjLMOnH (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Wed, 13 Dec 2023 09:43:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379307AbjLMOnB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 13 Dec 2023 09:43:01 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26D5E116; Wed, 13 Dec 2023 06:43:08 -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=1702478587; x=1734014587; h=from:subject:date:message-id:mime-version: content-transfer-encoding:to:cc; bh=5WVCAfr07jYxoLzMbloFz6OFtEdpfQOpVfwUdN+zweg=; b=pLCya56+UPuEkAnUVvHZOXWE3ezD6c58fR0bMYiDc+pyC9T/2BvS3VO1 bO8gzrgUgN+/MlBb8NsIePK8bDFzC05eC8I5BPLJbvSgSIqBQNDTNwI/R iGG13xhft94UOm6pd0D8v3yfc1ccsVUd9ofBIisJOfISYv6fWn6tRNAgP uR5ipTEPME3FPrFl74Mjw+GbKLeEoWFIqzyrEN9E4W5asYSKgfyDp9Rf8 cjO5O52q8E7wwrmXuD2yR48U+SfnGldcG0hVqAp3Bgd26ZKltONcYgmiX /Nnp/C1wXVIOsq2/ubrwEIiC8ugfX64dzRkeN5G6D2Y7uGrSwTE0PkBy3 g==; X-CSE-ConnectionGUID: 0xId4nYKTOKId+fyts6KlQ== X-CSE-MsgGUID: LC3veFvQRpaTk6b07Sx0iw== X-IronPort-AV: E=Sophos;i="6.04,272,1695657600"; d="scan'208";a="4802933" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 13 Dec 2023 22:43:07 +0800 IronPort-SDR: lrVidY/xkYLJzC5qp1+3SWIUg0cc3aEqpkO9Gu/qUET2zhtR0/wfPU/60Gp3Oy1gV/QBnkZG5o kZsMJlA84fXQ== 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; 13 Dec 2023 05:48:19 -0800 IronPort-SDR: Ge8WnutGkNdHzjRMAwhP1jbkQrE6YzoDhsCg63xNdaeuwszKw7SdP6oyDiku68gZSA2+GeWbJ+ vabbeGDbgzHg== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 13 Dec 2023 06:43:06 -0800 From: Johannes Thumshirn <johannes.thumshirn@wdc.com> Subject: [PATCH v2 00/13] btrfs: clean up RAID I/O geometry calculation Date: Wed, 13 Dec 2023 06:42:55 -0800 Message-Id: <20231213-btrfs_map_block-cleanup-v2-0-cf5cfb9e2400@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAO/CeWUC/3WNTQ7CIBgFr9J8azFAi6aueg/TNPxaYgsNVNQ03 F1s3LqcSd68DaIOVke4VBsEnWy03hWghwrkyN1NI6sKA8W0JhSfkViDicPMl0FMXt6RnDR3jwX VzcmwmhvTYgVlvQRt7GsvX/vCo42rD+/9KJGv/TUJ/dtMBGEkqGpZo1rOmOieSh6ln6HPOX8AB Pzz57wAAAA= To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>, David Sterba <dsterba@suse.com> Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig <hch@lst.de>, Johannes Thumshirn <johannes.thumshirn@wdc.com> X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1702478586; l=1872; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=5WVCAfr07jYxoLzMbloFz6OFtEdpfQOpVfwUdN+zweg=; b=ZhqRgLFD/ytsiyaEc1+zC594UEA1OkCcyXTwj45pnlyI4Yao3FgkY+6Z7C3NwapkEJckugvJf 6gRy42yB5pWDdqHqFbOf2giSg+nGVmobkEx+mNmcSWKDyfy1ptEtSei X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 06:43:17 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785178199970970786 X-GMAIL-MSGID: 1785178199970970786 |
Series |
btrfs: clean up RAID I/O geometry calculation
|
|
Message
Johannes Thumshirn
Dec. 13, 2023, 2:42 p.m. UTC
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 fs/btrfs/volumes.c | 410 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 259 insertions(+), 151 deletions(-) --- base-commit: 14d1d39586246ca9d4ce97049c98be849e3bbcd9 change-id: 20231207-btrfs_map_block-cleanup-346f53aff90d Best regards,
Comments
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.