Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1697608rwb; Thu, 29 Sep 2022 00:31:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Sgy3hIZzj1Q1QmEqkSvsuyfr0GmWQsKqDEgHSyDW8F4oiieVO1SJHByrn8/T9jVsfaVPJ X-Received: by 2002:a05:6402:5c9:b0:446:fb0:56bb with SMTP id n9-20020a05640205c900b004460fb056bbmr1938182edx.173.1664436704998; Thu, 29 Sep 2022 00:31:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1664436704; cv=pass; d=google.com; s=arc-20160816; b=Qmexzc1tMoTouNMmw54QHWEWfLp2zcKFDKspfWQwnVsTT0GEq+vNKZiX3vt0cQOfgA b2/IrOBnYN4KJYr5bPAbCu6CBa1EI4owfoNpjwrNuWcA5mDdNzZeh9yh4UnxIUGmAWL1 HrFYh7R9ukEpjXY3iPqnbJjb65sW5bhlCSaNso4+dU8jC5bKa8W30jt65N2aLHZXLF0G 7VCkh6YhnLGvid4lARTaXmBo8S7M64zMDjWNK9fIzGRBCAuP6CO5nsh+xelUEotBzm1O 3E7146sXI9UJuzGnSOVRdvRGgd2my4a0/vtQd5cgPy96GgL9xKuvPH5/j+0USZXfjdCH kaRg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:domainkey-signature; bh=EXlFcHYEvuIDXaU+aP6eHFMdyT/gqxmC/nZG41wQWG8=; b=ocQxwl9H8ORnpkXsfc9ukyVpHZFOFb08Zo50oEc/AZndGx94a1TJCxhVF1HJxcJy1i pwRYAflkY2tF9Go2TU3mx/njaHVbACJ+nmHKbWmScg7DpV+NjlSThC4vgHbKaok7oD6h alPnVyTGResWhVb2D7khjbmmY+LugmdYLgu+GL8toyPs1XBdhsvlFKiuN2jTypNkc+P2 sG014eVEk62cxtCVq1624oSz/KQGvcLF2zETPsNdbJ/NmI24pZNYAfVnZTI88lEjHW/I Bst63T+HFCxO9l9zSuNSEtwiwd/h25OhtjUBLoDtOm1zmuADLRTr983FyqlT5rOwzy1d J3Nw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zoho.com header.s=zm2022 header.b=WMr7uVM7; arc=pass (i=1 spf=pass spfdomain=zoho.com dkim=pass dkdomain=zoho.com dmarc=pass fromdomain=zoho.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=REJECT sp=REJECT dis=NONE) header.from=zoho.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz34-20020a1709077da200b00783c42d2da1si7597142ejc.425.2022.09.29.00.31.19; Thu, 29 Sep 2022 00:31:44 -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=@zoho.com header.s=zm2022 header.b=WMr7uVM7; arc=pass (i=1 spf=pass spfdomain=zoho.com dkim=pass dkdomain=zoho.com dmarc=pass fromdomain=zoho.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=REJECT sp=REJECT dis=NONE) header.from=zoho.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234852AbiI2Gli (ORCPT + 99 others); Thu, 29 Sep 2022 02:41:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233404AbiI2Glh (ORCPT ); Thu, 29 Sep 2022 02:41:37 -0400 Received: from sender4-pp-o92.zoho.com (sender4-pp-o92.zoho.com [136.143.188.92]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8462D128704; Wed, 28 Sep 2022 23:41:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664433693; cv=none; d=zohomail.com; s=zohoarc; b=V+zipX7DGpNT0VfSsSnD8pEBivBRPN2as9BH3sG0fjD4iKbVt3BqOeJ99Lo4msja1Lu6MqwMfcx/oR756xBfcfWMgHeXOu4hFuALdeglxh0yo8+cDuSFPFYs3uYrqNMIIATm5cgStnUx93qbcdyLV8d5qSE8MUfyUn2cayx1NGk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664433693; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=EXlFcHYEvuIDXaU+aP6eHFMdyT/gqxmC/nZG41wQWG8=; b=SIhOHBwQ86TPbgNCFd0kVUkXQFBWyqO7eh7w2tRX9Zmps8ek/rwWdcJC0MoJuoZDYv1ytxCmuPZlwqiL+jYCK0j7ZgjlQdh0TRaIvu3CrjJ2ufPPtRDJXCMg8bu/8rKOsamgQdAYA8UdxWGIdVDME9Ps3Vaiu7FsbCcbKb+MV4M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=zoho.com; spf=pass smtp.mailfrom=hmsjwzb@zoho.com; dmarc=pass header.from= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=message-id:date:mime-version:user-agent:subject:to:cc:references:from:in-reply-to:content-type; b=dsKVwXCus/vx4HZb8Ll7diczxweR21MnfPqtc2FJ3mUBRUyKECuXpvo5wIah+neHVNdgylrBv/Xn QTSEnlB8APM+Vbbrwi0JS7KyXCkK8AV5Ao7k9XGd9DgIf7bdkL45 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1664433693; s=zm2022; d=zoho.com; i=hmsjwzb@zoho.com; h=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:Cc:Cc:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=EXlFcHYEvuIDXaU+aP6eHFMdyT/gqxmC/nZG41wQWG8=; b=WMr7uVM7JpKPho9Gq/y1lhxC2Kekix1/oEIZoVnfHYRSQfoQI3QsrNyrmw2Lh1ge bjQeMrOFPOv+rLACJKDQdU47ti3U41ERo5FZRhhCvnGBdpABeMROv9JBHxmqnnoxc4h 0yzTZeJdxH898XIniAdaglzeH/Xjvc+vXrJKPe3E= Received: from [192.168.0.103] (58.247.201.74 [58.247.201.74]) by mx.zohomail.com with SMTPS id 1664433692706875.4584232941247; Wed, 28 Sep 2022 23:41:32 -0700 (PDT) Message-ID: Date: Thu, 29 Sep 2022 02:41:28 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] btrfs:remove redundant index_rbio_pages in raid56_rmw_stripe Content-Language: en-US To: Qu Wenruo Cc: Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220929014402.2450-1-hmsjwzb@zoho.com> <18acd4e0-9d3d-77a7-a1de-b805bc259bcf@suse.com> From: hmsjwzb In-Reply-To: <18acd4e0-9d3d-77a7-a1de-b805bc259bcf@suse.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ZohoMailClient: External X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 Hi Qu, Thanks for your reply. Here is my plan about destructive RMW. 1. Read all the stripes in through raid56_rmw_stripe. 2. Do xor operation in finish_rmw. 3. If the xor result matches, nothing happened. 4. If the xor result mismatches, we can recover the data or trigger some user space progress to fix the data corruption. But here are some problems. 1. If the stripe is new allocated, the check will fail. 2. Is it convient for kernel get checksum in finish_rmw and recover data? Thanks, Flint On 9/28/22 23:13, Qu Wenruo wrote: > > > 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;