Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2288199rwo; Thu, 3 Aug 2023 07:24:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlGdWlB3++VSLZTewgVagODYWYyw7fDytdhFVXO3y/ed+EhHMJlI4w3s2IrfxffAot2JU48N X-Received: by 2002:a17:902:d2d1:b0:1b2:fa8:d9c9 with SMTP id n17-20020a170902d2d100b001b20fa8d9c9mr22770398plc.49.1691072695945; Thu, 03 Aug 2023 07:24:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691072695; cv=none; d=google.com; s=arc-20160816; b=GWhxy9s9tmnV8NIf/KsyJwBcbcVIsl06l9pk0sFVJ/Esb0cWWDjFdCnJIgt327Bgn6 PRVEGIZJvX4OAe6pXf5OYosaOj2wki7OsrRoaPW+ETvh4WpjwTsAcnLwGd9LISnyO98A J0yD1W/dtEPhSb/8o3ec0e2oZ2zwySu45DnlG1dtj4hk08ZGCzzyHuoazdD5081hih58 Ci9ipETeFSl1qxCLyHX1aGNfz28iSwQkISRLClD3j/HKzrczEfGDL/kbSu1TNsEjG+u2 gs7bRvrhaooWHO/slnadtqx6rky4+uZQxpcUBZsH3ZARNv9Bs7at9ktcX9j884fxZQFt KfHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=5kH4FHNdWFBSwFaEcTyu76qRD4K+M2NBrHwhDcx+Qek=; fh=2Cn0oHhRunYO+MqeElF523wQvgmjxkSAMpH3Se99YF8=; b=uAGWTkuRaQkBs9vkPT5Lal7pA7zY3fC32vCvZCLSP5KvZmmj6F1WXexXVufO6JSt9B P0cAmCvhooYrabOV3kl4G4uQ2n1Qzl0L+HuiKTzgYMoyTNA5tzQnRrMcVghKGRzj0d3L XQwQNRLz5p3OLsQBbH7MnNXeZwMxbTZvqQPTgWdztMMZMfwUr1wy6jJGUHTvCmqiHi9S 8kRn4aFStXwXbAPwsfnf6+UhY62Uf0ZmpGkRw0IZUN9HP0NlO1LSu0EvnhWrvRSknXVK G9h9NRK7PSlBLoJoMJtSvoDJpiz7rpraIesPJZYDmxnjJ9ISLOClRhkTJ0OB8U+A1kWD vYvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=v9QAWrQL; dkim=neutral (no key) header.i=@suse.cz header.b=1c8bQqLk; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a170902d48600b001b88ff529cfsi13515265plg.619.2023.08.03.07.24.33; Thu, 03 Aug 2023 07:24:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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.cz header.s=susede2_rsa header.b=v9QAWrQL; dkim=neutral (no key) header.i=@suse.cz header.b=1c8bQqLk; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236166AbjHCOOV (ORCPT + 99 others); Thu, 3 Aug 2023 10:14:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231599AbjHCOOF (ORCPT ); Thu, 3 Aug 2023 10:14:05 -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 C0DA510F0 for ; Thu, 3 Aug 2023 07:13:38 -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 3C689218B0; Thu, 3 Aug 2023 14:13:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1691072017; h=from:from: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=5kH4FHNdWFBSwFaEcTyu76qRD4K+M2NBrHwhDcx+Qek=; b=v9QAWrQLSCjQ7/+Sqq03ql2HD10ZEpAK52uX1f759wxcCknPWbzNiDw2ZRiLgxhesZlDrB apDlP0TBwzrK5OV8IiVEyxQ6HAZHvHUTWhQO5XSxR2ApV1gd6OZeEZOO4oThERhHxMkzJN LiNsyKMleLTEwmLzqbpe3upZZWicSjs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1691072017; h=from:from: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=5kH4FHNdWFBSwFaEcTyu76qRD4K+M2NBrHwhDcx+Qek=; b=1c8bQqLkyjoe/N6FDBuBRzLakyj3t4EsPpw9Zm9neziHizbQaNN1ztaAsykdFYLq9oTFIu OqFdtuCkMWBe+nCA== 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 2C36A1333C; Thu, 3 Aug 2023 14:13:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ONfAChG2y2RUCQAAMHmgww (envelope-from ); Thu, 03 Aug 2023 14:13:37 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id B1635A076B; Thu, 3 Aug 2023 16:13:36 +0200 (CEST) Date: Thu, 3 Aug 2023 16:13:36 +0200 From: Jan Kara To: Zhang Yi Cc: linux-ext4@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: Re: [PATCH 02/12] jbd2: move load_superblock() into journal_init_common() Message-ID: <20230803141336.23ce6xams3x333hd@quack3> References: <20230704134233.110812-1-yi.zhang@huaweicloud.com> <20230704134233.110812-3-yi.zhang@huaweicloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230704134233.110812-3-yi.zhang@huaweicloud.com> X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_SOFTFAIL,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-ext4@vger.kernel.org On Tue 04-07-23 21:42:23, Zhang Yi wrote: > From: Zhang Yi > > Moving the call to load_superblock() from jbd2_journal_load() and ^^ Move > jbd2_journal_wipe() eraly into journal_init_common(), the journal ^^^ early > superblock gets read and the in-memory jounal_t structure gets ^^ journal_t > initialised after calling jbd2_journal_init_{dev,inode}, it's safe to > do following initialization according to it. > > Signed-off-by: Zhang Yi Otherwise the patch looks good to me. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/jbd2/journal.c | 16 +++++----------- > 1 file changed, 5 insertions(+), 11 deletions(-) > > diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c > index 48c44c7fccf4..b247d374e7a6 100644 > --- a/fs/jbd2/journal.c > +++ b/fs/jbd2/journal.c > @@ -1582,6 +1582,10 @@ static journal_t *journal_init_common(struct block_device *bdev, > journal->j_sb_buffer = bh; > journal->j_superblock = (journal_superblock_t *)bh->b_data; > > + err = load_superblock(journal); > + if (err) > + goto err_cleanup; > + > journal->j_shrink_transaction = NULL; > journal->j_shrinker.scan_objects = jbd2_journal_shrink_scan; > journal->j_shrinker.count_objects = jbd2_journal_shrink_count; > @@ -2056,13 +2060,7 @@ EXPORT_SYMBOL(jbd2_journal_update_sb_errno); > int jbd2_journal_load(journal_t *journal) > { > int err; > - journal_superblock_t *sb; > - > - err = load_superblock(journal); > - if (err) > - return err; > - > - sb = journal->j_superblock; > + journal_superblock_t *sb = journal->j_superblock; > > /* > * If this is a V2 superblock, then we have to check the > @@ -2521,10 +2519,6 @@ int jbd2_journal_wipe(journal_t *journal, int write) > > J_ASSERT (!(journal->j_flags & JBD2_LOADED)); > > - err = load_superblock(journal); > - if (err) > - return err; > - > if (!journal->j_tail) > goto no_recovery; > > -- > 2.39.2 > -- Jan Kara SUSE Labs, CR