Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1507479rwb; Wed, 28 Sep 2022 20:43:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7yXCNW1KaKEml1Lw3GfYAY4StDp0kBbT/jxxez1c+hOxuqUxeirCN9er4HS8NUWTAX8lLD X-Received: by 2002:aa7:da99:0:b0:457:fa48:3711 with SMTP id q25-20020aa7da99000000b00457fa483711mr1213253eds.46.1664422982446; Wed, 28 Sep 2022 20:43:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1664422982; cv=pass; d=google.com; s=arc-20160816; b=r7Hh3fBP19iKWAvGPOoK6AGKGbHAerKxmQwrQEzIbKELXaxiWbfWrID/T/Wd0FP7OH cv3fdFEOUT9g9JThQExQLPEcpPuycF8QqFSnhxMZPrLZ+1V8q7qAW2Y6PzYFqJ2tZaIL i6hj05qh5Tdx+MZQ8LUrNLjL1BGvXCIllLZ9rsfckBXW30Wf41oSQc4E9oU0+DXms02D RbKpcWDgz2x0FM7ckuSM1KAs12XBVwBi8rUGfW1tBSXkHFxk9cxzhyqIj8hzMmxFWsCs iadddgDzzQt46nsJuUQrlpw9VIhu/z/OvdbU9Wp6nwdZPYC8+ZIB/o4nYb7SBWloam78 Fp1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:references:cc:to:from:content-language:subject :user-agent:date:message-id:dkim-signature; bh=wmmTBNX/LM9ruv6Ar9rOGhJ+QlAug4/fObhcPTRdjhQ=; b=GKgKBHhACqidvhJrbHvSSCeRO0hgGWot9KmdXAiv80W4MqCclBhrElo9bhYCRZv83g mjqsTLbr/B8zDO3SPtA5K6l3Utg/pljv8XzIZwe7udnj1ZUbhnm/cXycdw0keaTDdCau oQOJSONiYM9C44sOCRgL7gPvTsTJo9ohtgtoRINoq6vJT6eB+pMNFIyrscNSqwotNT7h gPAgV4YN1xFkdU1XLoMy5gmMbFZ6UW2P8E2q9OJzIXakg/r65T49B848/GEyppMLK27q vEoIVxL834d4suA+3cdeAmlEJPQSYQ1wTe0r73U5IC33+E1l0Saya/71qE2T5c0VGcEJ tVJg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b=mN2H2YrO; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js17-20020a17090797d100b007808427b24dsi7620291ejc.370.2022.09.28.20.42.36; Wed, 28 Sep 2022 20:43:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b=mN2H2YrO; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234844AbiI2DNq (ORCPT + 99 others); Wed, 28 Sep 2022 23:13:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234828AbiI2DNn (ORCPT ); Wed, 28 Sep 2022 23:13:43 -0400 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00070.outbound.protection.outlook.com [40.107.0.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CA45127549; Wed, 28 Sep 2022 20:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GJJedoc7b9tEqEGf1gr9fw5CRBpWe3RGCWoiuyhBw8tObjjoC0bu02FvGMVcDef8B3zhB4xNfvsmExvRsFJF1Uin/kvj5PYfp9RHmQFVPBYYwppCTslQ+NFjmkjQVKfSwQNqQDNitbN665vRVQvlQHpVxX84s79crjnHBfeZFaYyiTmvxcVkWpMbyX/ws2bNncZ6MdhC/kx8L5VlluTGbjagVtKW/riq6q29DVKztBQb9dewXvWUVBg+cvjA0YHFgS2Py72lSPyc8+rFRWd9aeA93EMrbmBBAjp7Gw0qRv0JnqwW6GEMkt+MefkDif12NmwDe7e7NQ9ZGVHeQ/17Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wmmTBNX/LM9ruv6Ar9rOGhJ+QlAug4/fObhcPTRdjhQ=; b=J/QcaFj30FpsUN25yyPfhF8Nt9oIH4WcbWXfWxjqLAekCAE/nvC6InXvA1+UeAJtbpt8ImaOLpY2YEu96uMhhFqxN/M9yJpg0a3VkPaHnIawUUb3ntjkeScwhMN1NBSBMJZRfDewtY7JkQ6Wp1pptXYXVJf9lpomB49DE+ojjgx+bPKmmQK0ZRFdgPUcz8ytOP5hPkWDd2TDFC0Mm3xYZKRXwLrkATyfSv+20FLOha6V66oaa3QzQhhkxPIiAvQcf3TmW2S8aymu3XB8l0Sf16n8hA5KUcHzcjCoSG90Eqn67xXiMA9ZBetrzIBfeyuMxheXRz8cxjwy/PF5NF7QZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wmmTBNX/LM9ruv6Ar9rOGhJ+QlAug4/fObhcPTRdjhQ=; b=mN2H2YrOzFICSOs+rBxWzeiMstl/8xOb9zWvPbwavyrJRLJoy9kxk1P5lyAchHkhais00KJeU0jr7zYhj8FNhUdXoAq5W2iUaz3mxWPROyLjB1Eh2WdjtNfF8ovLhP5y6derxS9uDxXIbURRE7zZjdKuf3l9KM8TogUFBN08yHtEV7Ef2QDdyNEmjy88U8JfeDvunBFZHPW5EeRC3aR5AWxjKaltnssD4uWycTzM+Zw4RTyXy6ZpyoTphOmt+RECZtnPR/VcD+5jSJhB3ef2MWVXJw9uj3V3QBNJhGAnBrYbRk9r4Po+ARaMr93XCoeR4MaU17U0EshVSutV5DbexQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from AS8PR04MB8465.eurprd04.prod.outlook.com (2603:10a6:20b:348::19) by PAXPR04MB8704.eurprd04.prod.outlook.com (2603:10a6:102:21f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.19; Thu, 29 Sep 2022 03:13:36 +0000 Received: from AS8PR04MB8465.eurprd04.prod.outlook.com ([fe80::3a32:8047:8c8a:85d9]) by AS8PR04MB8465.eurprd04.prod.outlook.com ([fe80::3a32:8047:8c8a:85d9%5]) with mapi id 15.20.5676.019; Thu, 29 Sep 2022 03:13:36 +0000 Message-ID: <18acd4e0-9d3d-77a7-a1de-b805bc259bcf@suse.com> Date: Thu, 29 Sep 2022 11:13:26 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH] btrfs:remove redundant index_rbio_pages in raid56_rmw_stripe Content-Language: en-US From: Qu Wenruo To: "Flint.Wang" Cc: stringbox8@zoho.com, Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220929014402.2450-1-hmsjwzb@zoho.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BYAPR03CA0022.namprd03.prod.outlook.com (2603:10b6:a02:a8::35) To AS8PR04MB8465.eurprd04.prod.outlook.com (2603:10a6:20b:348::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8465:EE_|PAXPR04MB8704:EE_ X-MS-Office365-Filtering-Correlation-Id: c8a5e1a9-fe8f-4e8d-2763-08daa1c89964 X-LD-Processed: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y7ZSkXv5YeTgm25p078tdI3gbHjAfolZbvoW++nGwgz8cDULpfpqDlToAAe+pXXs0viOR3h/1NMmKRp7IrkwaQZuGTCj7CTEdrh+UJ795vnEfg8UII1hw1RuBXtvHSmhgMJLLgme13naI3MPonSL+38sWI+WdGEPorX+7fW46NFR/jQipZv5zgv9GPmowNmup3axcYyXGXWTxfICwaKqfecRn2xaHaZaQQSqNYQtIA9mnWCx16NmfR7c0vgFJgzARwdYjT6wkF/QXbeA/tAowQk9CgSUM6lGOme1zcIHbg7AHXnx+8gGV/EydM2gTSDJAEdmgvzeo83kWaInQ9sQnh55mbVT7tfEGrrn0QtCBNTA3XO4iUW97J+pywo0WB13R1qHRX754zwdkbZL87QoQdBE5QiSyRy20Hpi36ggGoLfnL4SUD6Kvj9AaanVaqBDB4xhoSjFJ2a7+Wi39yobjf8nWa/EZ2OfuEQnj+Klv0SkddiUYXZ9jhMgElEPVzJ11gKewdmKq82CRiXgSO8U2F8ObeUyRyVGPDPN2qh9QsZfAFCvSiDq6G8+3oj74F7fA+0HWqPJeI7Oa//wFXuROnLxJ3US47MIiqhIqW4Hnwd3/RgEgCiFi1mi1UmvOblffiRsTlSPBRTjy6t+888RESzpIG42M/JlFeD/yHTXwmYOTKHhle44XwcfCVawYE/01QUDGZ7TLSxsF58rxNk/JX1trRnPp6OMyoR9BX8ZY/xS/RRe0ICOh/h+gwv+gIihsUDBrzimxtQqOMKIvPGGh3Rm1TVjnJC/ZTeqoFtjj2U= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8465.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(346002)(136003)(376002)(396003)(39860400002)(451199015)(86362001)(36756003)(31696002)(2906002)(8936002)(5660300002)(186003)(316002)(2616005)(6916009)(54906003)(6486002)(6666004)(478600001)(6512007)(66946007)(53546011)(6506007)(8676002)(66476007)(66556008)(4326008)(41300700001)(38100700002)(83380400001)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Z09VUzNJQm5GeUd0Z2E0dCsrRTdGRENqQU1mR0RlYktkSk1uV1Nwd08vVGNa?= =?utf-8?B?YlVrQjlKMlpkdDBMbjZ5WCtvSGpyUkxXRk9XZTVwSndrOVVtMndWOTVrTHN0?= =?utf-8?B?ZU5FZ1gyT2todXFLaXpxdjVBZ0lPZ3Z1Q1NnVS9JMm5NSUpCNkVRRFRFYmR3?= =?utf-8?B?blJCendnNGlVRGxIeTRtN2dLMGs3YWk3TGhBVjFpcnQ2NTkwN0pVUTNYMVA5?= =?utf-8?B?czJwSGVtTDBDODJRbGpMNHRZZmVYenQ4cEFTbW8wUzViNnF3NUFk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ZVN2RyaHZCc0dEUlVvTzJtYkFsMU5pZkFHRDIz?= =?utf-8?B?Njcya0FmNXdOdVdNSmNaU0pqczAwbmYvejByRm0rTTZhVGhOVEpHR3JRWlpz?= =?utf-8?Q?YVbl5ZFpvjAd0yX7G4lqtKA=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8a5e1a9-fe8f-4e8d-2763-08daa1c89964 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8465.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2022 03:13:36.7386 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MqDHWhe7Egs4NooU6T3nPk69QwmcNVmeG79RtvTNs6VMhiTvLh7t9PJuvYHyRxRn X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8704 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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 On 2022/9/29 11:08, Qu Wenruo wrote: > > > On 2022/9/29 09:44, Flint.Wang wrote: >>    The index_rbio_pages in raid56_rmw_stripe is redundant. > > index_rbio_pages() is to populate the rbio->bio_sectors array. > > In raid56_rmw_stripe() we later calls sector_in_rbio(), which will check > if a sector is belonging to bio_lists. > > If not called, all sector will be returned using the sectors in > rbio->bio_sectors, not using the sectors in bio lists. > > Have you tried your patch with fstests runs? Well, for raid56_rmw_stripe() it's fine, as without the index_rbio_pages() call, we just read all the sectors from the disk. This would include the new pages from bio lists. It would only cause extra IO, but since they can all be merged into one 64K stripe, it should not cause performance problem. Furthermore it would read all old sectors from disk, allowing us later to do the verification before doing the writes. But it should really contain a more detailed explanation. Thanks, Qu > > IMHO it should fail a lot of very basic writes in RAID56. > > Thanks, > Qu > >>    It is invoked in finish_rmw anyway. >> >> Signed-off-by: Flint.Wang >> --- >>   fs/btrfs/raid56.c | 2 -- >>   1 file changed, 2 deletions(-) >> >> diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c >> index f6395e8288d69..44266b2c5b86e 100644 >> --- a/fs/btrfs/raid56.c >> +++ b/fs/btrfs/raid56.c >> @@ -1546,8 +1546,6 @@ static int raid56_rmw_stripe(struct >> btrfs_raid_bio *rbio) >>       if (ret) >>           goto cleanup; >> -    index_rbio_pages(rbio); >> - >>       atomic_set(&rbio->error, 0); >>       /* Build a list of bios to read all the missing data sectors. */ >>       for (total_sector_nr = 0; total_sector_nr < nr_data_sectors;