Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4695185rdb; Fri, 15 Sep 2023 09:28:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbB2IQR3ER8kgEMYUIckPygcZdkTCPYw9Z24I0zx5y+QomS0gD3YjlKhno6kSFPh/dx+fK X-Received: by 2002:a17:903:1109:b0:1c3:bbad:9b7c with SMTP id n9-20020a170903110900b001c3bbad9b7cmr2463104plh.31.1694795324532; Fri, 15 Sep 2023 09:28:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694795324; cv=none; d=google.com; s=arc-20160816; b=WLMO6L021IENFxBkZpwxEJrP2KHokLPc/n2nqYJp+kyvq9YycaHaSQu7yEFdwkwPuF oZG8h1U5fhWKJuYUL68Z+XjUhAqkAg+xjBTfujGv9ULI9RSQmxo35kMfFHiW6OPZ0RDK rKah/yWoVD/sgFvyf+mHYEq8V5CM+IOTrU/3qN6FA6AMEqLnoje16L1diGQpnciw4g71 IpmXiNJ4xLkrdhjxrs9cEsueIgx56j02bzqnilFLZr7wdt4a3MZYHp7YGof/oxvpkP4i fDODdccyVEOHN5fnSY6kJAszg5vMeuk+a4S4J/USulXfSrNTLZcRsTBKZQt1T03H2ZOl OhQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=vCbzNRBSiNbcpATSiwwTAa7ZeVAspWv2qzOjCLb874I=; fh=R3qgRc5nJjIfDlf4voXoUkJ8dyOKx0qaZ1Xr6J5SPRw=; b=P0F/G1ce/mm4+qC/xRqsMrzIHKtCvywdvUc3Yk853un1LejkNxhghWg4JqULIw98sW a9FwuJnbRVJXD1rUylSmje9uEEIWa4siB+b1bPDjCRSSPR8pONJKGLCgMsSuvooQN5R4 T4a/m17b1nMJojdNpsCjnH9snMJQTyTejvEcAdU8YUXFzcvJGt1Klfss1EcZEXyDLTyo r5QZAScJT6f2DgumxemTzSqiIAXIxnatD4M0wOj1PkBNZD4gBv35Vo/nFox01lHFhyG6 RostKlpqvxValg3YAaXaK4UKAN0/450yB4NlCEgCh0yGW5m3uOojlcVuifxuZueR7Lud oVDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=PDqPCLvZ; dkim=neutral (no key) header.i=@suse.cz header.b=71RNcZfp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id c12-20020a170902d48c00b001c44c2a2fcasi53472plg.222.2023.09.15.09.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 09:28:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=PDqPCLvZ; dkim=neutral (no key) header.i=@suse.cz header.b=71RNcZfp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 9DA6C82DAFC4; Fri, 15 Sep 2023 07:18:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235541AbjIOOSP (ORCPT + 99 others); Fri, 15 Sep 2023 10:18:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235323AbjIOOSO (ORCPT ); Fri, 15 Sep 2023 10:18:14 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85668F3; Fri, 15 Sep 2023 07:18:09 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 354E7218B5; Fri, 15 Sep 2023 14:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1694787488; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vCbzNRBSiNbcpATSiwwTAa7ZeVAspWv2qzOjCLb874I=; b=PDqPCLvZNABVAagFQiKTNot44blQfSZcmNzLG5mRwWPcmEzprKheChiTI5m4DWi2oA+gZ7 sDOMTaePuhG035TH23bVfYWme1x4u7n0eXYQMj/TELPX93FqFh/e1NdDD+IK2kqnl4Gk3L lMaaEh8XcEQ9nb7kA88G7TKDERP6QaQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1694787488; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vCbzNRBSiNbcpATSiwwTAa7ZeVAspWv2qzOjCLb874I=; b=71RNcZfp06PhQoiJXlzA5TwIaYBxjcPCi3Jr9IRX6wVDpAfmESMhS0Hb+RPNAXOO/9orjs MHtr4quhGnIUJuBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D35CF13251; Fri, 15 Sep 2023 14:18:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EWDSMp9nBGXTeAAAMHmgww (envelope-from ); Fri, 15 Sep 2023 14:18:07 +0000 Date: Fri, 15 Sep 2023 16:11:34 +0200 From: David Sterba To: Qu Wenruo Cc: Johannes Thumshirn , Chris Mason , Josef Bacik , David Sterba , Christoph Hellwig , Naohiro Aota , Qu Wenruo , Damien Le Moal , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v9 06/11] btrfs: implement RST version of scrub Message-ID: <20230915141133.GA2747@suse.cz> Reply-To: dsterba@suse.cz References: <20230914-raid-stripe-tree-v9-0-15d423829637@wdc.com> <20230914-raid-stripe-tree-v9-6-15d423829637@wdc.com> <33f4c547-65bc-4523-b1c0-bae0c7ad1e65@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <33f4c547-65bc-4523-b1c0-bae0c7ad1e65@gmx.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Fri, 15 Sep 2023 07:18:17 -0700 (PDT) On Fri, Sep 15, 2023 at 10:28:50AM +0930, Qu Wenruo wrote: > > > On 2023/9/15 01:37, Johannes Thumshirn wrote: > > A filesystem that uses the RAID stripe tree for logical to physical > > address translation can't use the regular scrub path, that reads all > > stripes and then checks if a sector is unused afterwards. > > > > When using the RAID stripe tree, this will result in lookup errors, as the > > stripe tree doesn't know the requested logical addresses. > > > > Instead, look up stripes that are backed by the extent bitmap. > > > > Signed-off-by: Johannes Thumshirn > > --- > > fs/btrfs/bio.c | 2 ++ > > fs/btrfs/raid-stripe-tree.c | 8 ++++++- > > fs/btrfs/scrub.c | 53 +++++++++++++++++++++++++++++++++++++++++++++ > > fs/btrfs/volumes.h | 1 + > > 4 files changed, 63 insertions(+), 1 deletion(-) > > > > diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c > > index ddbe6f8d4ea2..bdb6e3effdbb 100644 > > --- a/fs/btrfs/bio.c > > +++ b/fs/btrfs/bio.c > > @@ -663,6 +663,8 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num) > > blk_status_t ret; > > int error; > > > > + smap.is_scrub = !bbio->inode; > > + > > btrfs_bio_counter_inc_blocked(fs_info); > > error = btrfs_map_block(fs_info, btrfs_op(bio), logical, &map_length, > > &bioc, &smap, &mirror_num, 1); > > diff --git a/fs/btrfs/raid-stripe-tree.c b/fs/btrfs/raid-stripe-tree.c > > index 697a6e1fd255..63bf62c33436 100644 > > --- a/fs/btrfs/raid-stripe-tree.c > > +++ b/fs/btrfs/raid-stripe-tree.c > > @@ -334,6 +334,11 @@ int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info, > > if (!path) > > return -ENOMEM; > > > > + if (stripe->is_scrub) { > > + path->skip_locking = 1; > > + path->search_commit_root = 1; > > + } > > + > > ret = btrfs_search_slot(NULL, stripe_root, &stripe_key, path, 0, 0); > > if (ret < 0) > > goto free_path; > > @@ -420,7 +425,8 @@ int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info, > > out: > > if (ret > 0) > > ret = -ENOENT; > > - if (ret && ret != -EIO) { > > + if (ret && ret != -EIO && !stripe->is_scrub) { > > + > > One extra newline. There were way more stray newlines, you don't have to point that out in reviews, I fix them once we have version that would not change too much.