Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27704305rwd; Tue, 4 Jul 2023 06:47:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlFRYNmyUzPthDi+oKJFkjLpEgN9+sSCYr1sI22p1LpkVtlHHrryxEh4NB91vNZpwApXYBuj X-Received: by 2002:a05:6359:282:b0:132:fd75:9889 with SMTP id ek2-20020a056359028200b00132fd759889mr9262904rwb.7.1688478453668; Tue, 04 Jul 2023 06:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688478453; cv=none; d=google.com; s=arc-20160816; b=bWklqJy96uBSH0ZwfIWCLuWj6ODud6zFeM/BKhNU6ISyD7WLsAhTL4mLinkmvbBqMk flUR6pUKskk3B40vw0GkobKXxyzlD2lnFtAPNkVwZHUogao8les6T7Vs279YC1zHhw2F MgjPEF8tF9u05ejGCb9RO2LyCfq/t0/OjUpbPQYRvulHhbElmsKygHen0pDZNFQhgK9n 8Rl2GE7iwpqXzgz15gcQTGJyKjEdv5GZCIQNfhZ2e1IkPq4q/O/GxaJTOdHmd9GIeQ4F L4imihSD1VY+ZF/BA9sDp8Uxt3bxKfNoIMbKBSF1QZGS5LSk1Y90d89p1eN5Imc5J8OM gpzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=QEqGAL6KwOJhMUQ3JhYm7F52BsMQvl15n5hF1zrrzPE=; fh=Uq/HK0tePPZ4uFSrjmAoQ+8fm8HBRKIYZPcFTEYnhm4=; b=WTPDkq8JSLXc7zqWzO04GBJUgs5sOtpTkt0Kfy13XjQHI1nUYfJqnfaGXFhmZNKuKU KzE0DnjwOlrojBjsaUpD4LfoJ06NMHg1Vl8qyb1I0NnuM+uoHPUh42Wgbtw0qqP2gwmK naxdmE93eYc209NKarSDZyftVR7MB9PEzoy/Iad56rS8PQy5IYHMus7t8Iuz7gyEDKkF /M1PN4mWC77oFruGOw51T/A+6cDWfhfrJGVqn0WU6N3ECzThveE4hAR9CTEEXxIWCWU7 RlJBzt8LwcDMS0fN+8XKJnvjmS740QXAL+JyYYMZWmr7EaDDCY9ULr/P89bcfVYE8CEI lJjA== ARC-Authentication-Results: i=1; mx.google.com; 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 q8-20020a056a00088800b00681c3725a98si12510458pfj.82.2023.07.04.06.47.21; Tue, 04 Jul 2023 06:47:33 -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; 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 S229994AbjGDNoJ (ORCPT + 99 others); Tue, 4 Jul 2023 09:44:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231392AbjGDNoG (ORCPT ); Tue, 4 Jul 2023 09:44:06 -0400 Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 680BF10A for ; Tue, 4 Jul 2023 06:44:05 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4QwPCL5Hsmz4f3lxB for ; Tue, 4 Jul 2023 21:43:58 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgD3rLASIqRk9WjENA--.31120S6; Tue, 04 Jul 2023 21:44:00 +0800 (CST) From: Zhang Yi To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: [PATCH 02/12] jbd2: move load_superblock() into journal_init_common() Date: Tue, 4 Jul 2023 21:42:23 +0800 Message-Id: <20230704134233.110812-3-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704134233.110812-1-yi.zhang@huaweicloud.com> References: <20230704134233.110812-1-yi.zhang@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgD3rLASIqRk9WjENA--.31120S6 X-Coremail-Antispam: 1UD129KBjvJXoW7uw4rAw1kXr17GFW8ZFyxKrg_yoW8ArWrpr y3C348ArWvvrWUZ3W8ZF4kGFWUX3y0kFW7Gr4Duw1ktayrXrnxtw1Dtrn5JFy8ZFWUGw18 XFyUCasrCw1Dta7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9m14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_Jryl82xGYIkIc2 x26xkF7I0E14v26r4j6ryUM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJw A2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS 0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2 IY67AKxVWUXVWUAwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0 Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCF04k20xvY0x0EwIxGrwCFx2 IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v2 6r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67 AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IY s7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr 0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUI4E_UUUUU= X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, MAY_BE_FORGED,SPF_HELO_NONE,SPF_NONE,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 From: Zhang Yi Moving the call to load_superblock() from jbd2_journal_load() and jbd2_journal_wipe() eraly into journal_init_common(), the journal superblock gets read and the in-memory jounal_t structure gets initialised after calling jbd2_journal_init_{dev,inode}, it's safe to do following initialization according to it. Signed-off-by: Zhang Yi --- 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