Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5361502rdb; Wed, 13 Dec 2023 06:43:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHttp/ApZCk4SypvUuIyBVEr69AJNfqYfzdYMffIWsDvdYrqcjX0ilf5ZJNEDhEo30MJtyg X-Received: by 2002:a17:902:ea11:b0:1d0:a357:7224 with SMTP id s17-20020a170902ea1100b001d0a3577224mr4724289plg.132.1702478603717; Wed, 13 Dec 2023 06:43:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702478603; cv=none; d=google.com; s=arc-20160816; b=ef1vC43XQz8qcn2FDChMPrlutcBJGzlGZsN82yIECiFaoB3ZBjJTbYQITzd47+AxsS NFDfJT9lsN196Fkc5oBjQxLZ2xPJXfLs2MCUNNOhqEZXTV1c5Cvi8AQqcJx0IPVX3X9m ffYoE5DvAbrVn+y97LIvgqtMS3Z0FjqSnW242T7ofb0z2U3CVdhXeKjW5snqjgDhK/V6 rqR/nbCXAn+R510C8YrFex5bVKofnsPHgHrO8dDyrEMXq81xRzJUPdbUGlb1muMrTm4P FeF0okqw1oElvycRlDkAHO+iBeDYbtD0VoZa/ODeukc3rjHM7sUdKJYFPiTSsszeo1QJ X0GQ== 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 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wdc.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id iz14-20020a170902ef8e00b001cfb84c92fasi9586603plb.70.2023.12.13.06.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 06:43:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; 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 23.128.96.37 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 2F8438031B22; Wed, 13 Dec 2023 06:43:19 -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 + 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 ); 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 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 , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Johannes Thumshirn 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: 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:19 -0800 (PST) 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, -- Johannes Thumshirn