From patchwork Tue Dec 12 12:38:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 177324 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7692501vqy; Tue, 12 Dec 2023 04:39:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IF6E6tnHxg6Dr7RYOWiupf29OeMvUTGdFcYZZZXtFjhq5n1iMeyuIiM0S+L1y7mcYsEsm8a X-Received: by 2002:a17:902:e885:b0:1ca:7f91:aa5d with SMTP id w5-20020a170902e88500b001ca7f91aa5dmr6710742plg.16.1702384757579; Tue, 12 Dec 2023 04:39:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702384757; cv=none; d=google.com; s=arc-20160816; b=bK2Ecl3ar2m03FS4f7WW7llrFEoQpQNPXzir7B2CfMFWGDhx2DL6Z9NnwYKZsshCL+ PZWCRp1O8Q5j7P0NsuaG+PK0uQHIeLk3Pg2hGHhSaHUayc2eJQ0i4O3dJh3/XhB550LG vxCn8p5eDOz7X0fUBb4wvYYwkcFUbR18O0wfuLhtBP3mzOenQNR9HZ1jq2GMk1v2KnYS y7MVSdt5DvxXaztuI73mnIpB9hZ1hF6goefR/cjgJ++CVPvc8FXeCHbJH+eQrcyOHlJ+ bz6ijgI+3flvx0HcROou9Gn2JSuXyluP7REpJEh8OMH1Phnky/7tZHlV1pNuPKU7Ww/5 9oyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :wdcironportexception:ironport-sdr:ironport-sdr:dkim-signature; bh=At+hls3D6DBQLKNLgMK3qn7xHxqvXh3uB5AMaLua6jM=; fh=RkzPy8j9Bgyvxc5aNhoOEUjthII6WQwvTfVAiEIVvUg=; b=CbAvDppvOQOAiH0/zRjidf0jmQXrudDFWUFdOvgkyHgphkvAkIRu1aGLCldNug7U9W WDh8Vyj0cFho+ZsFrwfMVy/tEJLZPgA98V8x6nQLPVl0TcIyp9zq7h2/R9Qde/rD7bBA drn4AFTnjoRjbYaPksnqhd5RZ3wIiH+ot4n3k3c1g79LudL25rE9iYFN8YZ/EYk+EVzS B4It95bYaT/TzA9B6vUptdvR8jSay1rvuycns1UkR4x2x2i9hxrCTybj16TG5DQdB3vB odzqKIuvD1MuTBVi6fPBSb0bLBwTwHEkz4EK0VVp0G6rOAH29s5EdLJQM245dZE4Atw6 VyqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=HpJqw8zq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id q14-20020a170902eb8e00b001d0bdb270a7si7889756plg.259.2023.12.12.04.39.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 04:39:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=HpJqw8zq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 5C312804C577; Tue, 12 Dec 2023 04:39:14 -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 S1346720AbjLLMjD (ORCPT + 99 others); Tue, 12 Dec 2023 07:39:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346713AbjLLMii (ORCPT ); Tue, 12 Dec 2023 07:38:38 -0500 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FDDB1AE; Tue, 12 Dec 2023 04:38:36 -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=1702384716; x=1733920716; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=m+k8zZj7fOiwTsk10O7T+w0cafCSoG6d6aneRjaYfXI=; b=HpJqw8zqjpnIcr6+/FtBRwUNWkzc/ONLklWqRpLVv7gvMq75ktQzGZhD XrvAUHcEHZgswvBUWDKBrbHWLMgNYAspFAlD1u2QFL2zllRPkDRBSxRCM +KL4hx3y4KMvQc77sXJgu1EQeU2buOdAsk2nbRoTD8orqfTzzyHFj3pQ6 vUz/zAJg4VATn8dlx5H8BAtYzjhdWCzt4GVCOy7qiVuUcTUHet/OG21og 9VI8eGRuvss/aZSwcckhzEq0sMDxV0+KCy9Sd6ilqYs/g+AzC8ExEjhph 5JNLhyU3JNtfFLiH3f/G+NV1iSC3Mo2gOHDsV7ETtM1YXU6Fwi09zm6GP A==; X-CSE-ConnectionGUID: IOXfBpj9SzmwLK28ikQpeA== X-CSE-MsgGUID: zlpYzwIKTPeDpf7laSGAUg== X-IronPort-AV: E=Sophos;i="6.04,270,1695657600"; d="scan'208";a="4629805" 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:28 +0800 IronPort-SDR: EEZx+MTXO5/EPfiEE0Oqo3Y+V7UigsN4Syyf7I8P7QAy9DwuxGXUslS55HOyNj4viY/v4jWdYb Pj/lRF0LEBig== 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:41 -0800 IronPort-SDR: fsU/wqkD+KVd+7gZJQZyM/42QDym7jl2WKEY8ZV6rVeYnw/77LWRt4Ax0M273k/kZL5F6hMNBT 2pCl9aEMoPag== 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:27 -0800 From: Johannes Thumshirn Date: Tue, 12 Dec 2023 04:38:09 -0800 Subject: [PATCH 11/13] btrfs: open code set_io_stripe for RAID56 MIME-Version: 1.0 Message-Id: <20231212-btrfs_map_block-cleanup-v1-11-b2d954d9a55b@wdc.com> References: <20231212-btrfs_map_block-cleanup-v1-0-b2d954d9a55b@wdc.com> In-Reply-To: <20231212-btrfs_map_block-cleanup-v1-0-b2d954d9a55b@wdc.com> 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=1349; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=m+k8zZj7fOiwTsk10O7T+w0cafCSoG6d6aneRjaYfXI=; b=xbO8DGuIlP9LDF+dOqBn9tQlgUQ3uaT19PWrwV0MrDVeQCBR9suWMeo8QrFScmaHU0ztpPxSS q8Vd2PG2TF4Dgo7pmaOOJKF9oElSi9Vsvn0xWedCUaDzEeKjv3OAlu3 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:39:14 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785079799348323467 X-GMAIL-MSGID: 1785079799348323467 Open code set_io_stripe() for RAID56, as it a) uses a different method to calculate the stripe_index and b) doesn't need to go through raid-stripe-tree mapping code. Signed-off-by: Johannes Thumshirn Reviewed-by: Christoph Hellwig Signed-off-by: Christoph Hellwig --- fs/btrfs/volumes.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 946333c8c331..7df991a81c4b 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -6670,13 +6670,16 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op, btrfs_stripe_nr_to_offset(io_geom.stripe_nr * nr_data_stripes(map)); for (int i = 0; i < io_geom.num_stripes; i++) { - ret = set_io_stripe(fs_info, op, logical, length, - &bioc->stripes[i], map, - (i + io_geom.stripe_nr) % io_geom.num_stripes, - io_geom.stripe_offset, - io_geom.stripe_nr); - if (ret < 0) - break; + struct btrfs_io_stripe *dst = &bioc->stripes[i]; + u32 stripe_index; + + stripe_index = + (i + io_geom.stripe_nr) % io_geom.num_stripes; + dst->dev = map->stripes[stripe_index].dev; + dst->physical = + map->stripes[stripe_index].physical + + io_geom.stripe_offset + + btrfs_stripe_nr_to_offset(io_geom.stripe_nr); } } else { /*