From nobody Wed Feb 11 16:14:13 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9514C61DA4 for ; Mon, 13 Mar 2023 13:21:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230422AbjCMNV1 (ORCPT ); Mon, 13 Mar 2023 09:21:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229996AbjCMNVP (ORCPT ); Mon, 13 Mar 2023 09:21:15 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A3C1360B7; Mon, 13 Mar 2023 06:21:13 -0700 (PDT) Received: from kwepemm600013.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4PZxzq5GCxz17KfZ; Mon, 13 Mar 2023 21:18:15 +0800 (CST) Received: from huawei.com (10.175.127.227) by kwepemm600013.china.huawei.com (7.193.23.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Mon, 13 Mar 2023 21:21:09 +0800 From: Zhihao Cheng To: , , , CC: , , , Subject: [PATCH v2 1/5] ext4: Fix reusing stale buffer heads from last failed mounting Date: Mon, 13 Mar 2023 21:20:17 +0800 Message-ID: <20230313132021.672134-2-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313132021.672134-1-chengzhihao1@huawei.com> References: <20230313132021.672134-1-chengzhihao1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600013.china.huawei.com (7.193.23.68) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Following process makes ext4 load stale buffer heads from last failed mounting in a new mounting operation: mount_bdev ext4_fill_super | ext4_load_and_init_journal | ext4_load_journal | jbd2_journal_load | load_superblock | journal_get_superblock | set_buffer_verified(bh) // buffer head is verified | jbd2_journal_recover // failed caused by EIO | goto failed_mount3a // skip 'sb->s_root' initialization deactivate_locked_super kill_block_super generic_shutdown_super if (sb->s_root) // false, skip ext4_put_super->invalidate_bdev-> // invalidate_mapping_pages->mapping_evict_folio-> // filemap_release_folio->try_to_free_buffers, which // cannot drop buffer head. blkdev_put blkdev_put_whole if (atomic_dec_and_test(&bdev->bd_openers)) // false, systemd-udev happens to open the device. Then // blkdev_flush_mapping->kill_bdev->truncate_inode_pages-> // truncate_inode_folio->truncate_cleanup_folio-> // folio_invalidate->block_invalidate_folio-> // filemap_release_folio->try_to_free_buffers will be skipped, // dropping buffer head is missed again. Second mount: ext4_fill_super ext4_load_and_init_journal ext4_load_journal ext4_get_journal jbd2_journal_init_inode journal_init_common bh =3D getblk_unmovable bh =3D __find_get_block // Found stale bh in last failed mounting journal->j_sb_buffer =3D bh jbd2_journal_load load_superblock journal_get_superblock if (buffer_verified(bh)) // true, skip journal->j_format_version =3D 2, value is 0 jbd2_journal_recover do_one_pass next_log_block +=3D count_tags(journal, bh) // According to journal_tag_bytes(), 'tag_bytes' calculating is // affected by jbd2_has_feature_csum3(), jbd2_has_feature_csum3() // returns false because 'j->j_format_version >=3D 2' is not true, // then we get wrong next_log_block. The do_one_pass may exit // early whenoccuring non JBD2_MAGIC_NUMBER in 'next_log_block'. The filesystem is corrupted here, journal is partially replayed, and new journal sequence number actually is already used by last mounting. The invalidate_bdev() can drop all buffer heads even racing with bare reading block device(eg. systemd-udev), so we can fix it by invalidating bdev in error handling path in __ext4_fill_super(). Fetch a reproducer in [Link]. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D217171 Fixes: 25ed6e8a54df ("jbd2: enable journal clients to enable v2 checksummin= g") Cc: stable@vger.kernel.org # v3.5 Signed-off-by: Zhihao Cheng --- fs/ext4/super.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 88f7b8a88c76..7e990637bc48 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1126,6 +1126,12 @@ static void ext4_blkdev_remove(struct ext4_sb_info *= sbi) struct block_device *bdev; bdev =3D sbi->s_journal_bdev; if (bdev) { + /* + * Invalidate the journal device's buffers. We don't want them + * floating about in memory - the physical journal device may + * hotswapped, and it breaks the `ro-after' testing code. + */ + invalidate_bdev(bdev); ext4_blkdev_put(bdev); sbi->s_journal_bdev =3D NULL; } @@ -1271,14 +1277,8 @@ static void ext4_put_super(struct super_block *sb) =20 sync_blockdev(sb->s_bdev); invalidate_bdev(sb->s_bdev); - if (sbi->s_journal_bdev && sbi->s_journal_bdev !=3D sb->s_bdev) { - /* - * Invalidate the journal device's buffers. We don't want them - * floating about in memory - the physical journal device may - * hotswapped, and it breaks the `ro-after' testing code. - */ + if (sbi->s_journal_bdev) { sync_blockdev(sbi->s_journal_bdev); - invalidate_bdev(sbi->s_journal_bdev); ext4_blkdev_remove(sbi); } =20 @@ -5610,6 +5610,7 @@ static int __ext4_fill_super(struct fs_context *fc, s= truct super_block *sb) brelse(sbi->s_sbh); ext4_blkdev_remove(sbi); out_fail: + invalidate_bdev(sb->s_bdev); sb->s_fs_info =3D NULL; return err ? err : ret; } --=20 2.31.1 From nobody Wed Feb 11 16:14:13 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7300C61DA4 for ; Mon, 13 Mar 2023 13:21:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229493AbjCMNVY (ORCPT ); Mon, 13 Mar 2023 09:21:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbjCMNVP (ORCPT ); Mon, 13 Mar 2023 09:21:15 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3288734008; Mon, 13 Mar 2023 06:21:13 -0700 (PDT) Received: from kwepemm600013.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4PZxzr3M6dz17KjY; Mon, 13 Mar 2023 21:18:16 +0800 (CST) Received: from huawei.com (10.175.127.227) by kwepemm600013.china.huawei.com (7.193.23.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Mon, 13 Mar 2023 21:21:10 +0800 From: Zhihao Cheng To: , , , CC: , , , Subject: [PATCH v2 2/5] jbd2: remove unused feature macros Date: Mon, 13 Mar 2023 21:20:18 +0800 Message-ID: <20230313132021.672134-3-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313132021.672134-1-chengzhihao1@huawei.com> References: <20230313132021.672134-1-chengzhihao1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600013.china.huawei.com (7.193.23.68) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhang Yi JBD2_HAS_[IN|RO_]COMPAT_FEATURE macros are no longer used, just remove them. Signed-off-by: Zhang Yi Signed-off-by: Zhihao Cheng --- include/linux/jbd2.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 5962072a4b19..ad7bb6861143 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -274,17 +274,6 @@ typedef struct journal_superblock_s /* 0x0400 */ } journal_superblock_t; =20 -/* Use the jbd2_{has,set,clear}_feature_* helpers; these will be removed */ -#define JBD2_HAS_COMPAT_FEATURE(j,mask) \ - ((j)->j_format_version >=3D 2 && \ - ((j)->j_superblock->s_feature_compat & cpu_to_be32((mask)))) -#define JBD2_HAS_RO_COMPAT_FEATURE(j,mask) \ - ((j)->j_format_version >=3D 2 && \ - ((j)->j_superblock->s_feature_ro_compat & cpu_to_be32((mask)))) -#define JBD2_HAS_INCOMPAT_FEATURE(j,mask) \ - ((j)->j_format_version >=3D 2 && \ - ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask)))) - #define JBD2_FEATURE_COMPAT_CHECKSUM 0x00000001 =20 #define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001 --=20 2.31.1 From nobody Wed Feb 11 16:14:13 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8734C61DA4 for ; Mon, 13 Mar 2023 13:21:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230428AbjCMNVc (ORCPT ); Mon, 13 Mar 2023 09:21:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229997AbjCMNVP (ORCPT ); Mon, 13 Mar 2023 09:21:15 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05B1C303F6; Mon, 13 Mar 2023 06:21:14 -0700 (PDT) Received: from kwepemm600013.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PZy2D0l9FzrScw; Mon, 13 Mar 2023 21:20:20 +0800 (CST) Received: from huawei.com (10.175.127.227) by kwepemm600013.china.huawei.com (7.193.23.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Mon, 13 Mar 2023 21:21:11 +0800 From: Zhihao Cheng To: , , , CC: , , , Subject: [PATCH v2 3/5] jbd2: switch to check format version in superblock directly Date: Mon, 13 Mar 2023 21:20:19 +0800 Message-ID: <20230313132021.672134-4-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313132021.672134-1-chengzhihao1@huawei.com> References: <20230313132021.672134-1-chengzhihao1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600013.china.huawei.com (7.193.23.68) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhang Yi We should only check and set extented features if journal format version is 2, and now we check the in memory copy of the superblock 'journal->j_format_version', which relys on the parameter initialization sequence, switch to use the h_blocktype in superblock cloud be more clear. Signed-off-by: Zhang Yi Signed-off-by: Zhihao Cheng --- fs/jbd2/journal.c | 16 +++++++--------- include/linux/jbd2.h | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index e80c781731f8..b991d5c21d16 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -2059,10 +2059,12 @@ int jbd2_journal_load(journal_t *journal) return err; =20 sb =3D journal->j_superblock; - /* If this is a V2 superblock, then we have to check the - * features flags on it. */ =20 - if (journal->j_format_version >=3D 2) { + /* + * If this is a V2 superblock, then we have to check the + * features flags on it. + */ + if (jbd2_format_support_feature(journal)) { if ((sb->s_feature_ro_compat & ~cpu_to_be32(JBD2_KNOWN_ROCOMPAT_FEATURES)) || (sb->s_feature_incompat & @@ -2224,7 +2226,7 @@ int jbd2_journal_check_used_features(journal_t *journ= al, unsigned long compat, if (journal->j_format_version =3D=3D 0 && journal_get_superblock(journal) !=3D 0) return 0; - if (journal->j_format_version =3D=3D 1) + if (!jbd2_format_support_feature(journal)) return 0; =20 sb =3D journal->j_superblock; @@ -2254,11 +2256,7 @@ int jbd2_journal_check_available_features(journal_t = *journal, unsigned long comp if (!compat && !ro && !incompat) return 1; =20 - /* We can support any known requested features iff the - * superblock is in version 2. Otherwise we fail to support any - * extended sb features. */ - - if (journal->j_format_version !=3D 2) + if (!jbd2_format_support_feature(journal)) return 0; =20 if ((compat & JBD2_KNOWN_COMPAT_FEATURES) =3D=3D compat && diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index ad7bb6861143..7095c0f17ad0 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -1305,11 +1305,22 @@ struct journal_s rwsem_release(&j->j_trans_commit_map, _THIS_IP_); \ } while (0) =20 +/* + * We can support any known requested features iff the + * superblock is not in version 1. Otherwise we fail to support any + * extended sb features. + */ +static inline bool jbd2_format_support_feature(journal_t *j) +{ + return j->j_superblock->s_header.h_blocktype !=3D + cpu_to_be32(JBD2_SUPERBLOCK_V1); +} + /* journal feature predicate functions */ #define JBD2_FEATURE_COMPAT_FUNCS(name, flagname) \ static inline bool jbd2_has_feature_##name(journal_t *j) \ { \ - return ((j)->j_format_version >=3D 2 && \ + return (jbd2_format_support_feature(j) && \ ((j)->j_superblock->s_feature_compat & \ cpu_to_be32(JBD2_FEATURE_COMPAT_##flagname)) !=3D 0); \ } \ @@ -1327,7 +1338,7 @@ static inline void jbd2_clear_feature_##name(journal_= t *j) \ #define JBD2_FEATURE_RO_COMPAT_FUNCS(name, flagname) \ static inline bool jbd2_has_feature_##name(journal_t *j) \ { \ - return ((j)->j_format_version >=3D 2 && \ + return (jbd2_format_support_feature(j) && \ ((j)->j_superblock->s_feature_ro_compat & \ cpu_to_be32(JBD2_FEATURE_RO_COMPAT_##flagname)) !=3D 0); \ } \ @@ -1345,7 +1356,7 @@ static inline void jbd2_clear_feature_##name(journal_= t *j) \ #define JBD2_FEATURE_INCOMPAT_FUNCS(name, flagname) \ static inline bool jbd2_has_feature_##name(journal_t *j) \ { \ - return ((j)->j_format_version >=3D 2 && \ + return (jbd2_format_support_feature(j) && \ ((j)->j_superblock->s_feature_incompat & \ cpu_to_be32(JBD2_FEATURE_INCOMPAT_##flagname)) !=3D 0); \ } \ --=20 2.31.1 From nobody Wed Feb 11 16:14:13 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55661C6FD1C for ; Mon, 13 Mar 2023 13:21:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230429AbjCMNVi (ORCPT ); Mon, 13 Mar 2023 09:21:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229578AbjCMNVP (ORCPT ); Mon, 13 Mar 2023 09:21:15 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41CA04AFEB; Mon, 13 Mar 2023 06:21:14 -0700 (PDT) Received: from kwepemm600013.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4PZxzs6ZtHz17KJ4; Mon, 13 Mar 2023 21:18:17 +0800 (CST) Received: from huawei.com (10.175.127.227) by kwepemm600013.china.huawei.com (7.193.23.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Mon, 13 Mar 2023 21:21:11 +0800 From: Zhihao Cheng To: , , , CC: , , , Subject: [PATCH v2 4/5] jbd2: factor out journal initialization from journal_get_superblock() Date: Mon, 13 Mar 2023 21:20:20 +0800 Message-ID: <20230313132021.672134-5-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313132021.672134-1-chengzhihao1@huawei.com> References: <20230313132021.672134-1-chengzhihao1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600013.china.huawei.com (7.193.23.68) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhang Yi Current journal_get_superblock() couple journal superblock checking and partial journal initialization, factor out initialization part from it to make things clear. Signed-off-by: Zhang Yi Signed-off-by: Zhihao Cheng --- fs/jbd2/journal.c | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index b991d5c21d16..f99c46d880b2 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1922,21 +1922,13 @@ static int journal_get_superblock(journal_t *journa= l) goto out; } =20 - switch(be32_to_cpu(sb->s_header.h_blocktype)) { - case JBD2_SUPERBLOCK_V1: - journal->j_format_version =3D 1; - break; - case JBD2_SUPERBLOCK_V2: - journal->j_format_version =3D 2; - break; - default: + if (be32_to_cpu(sb->s_header.h_blocktype) !=3D JBD2_SUPERBLOCK_V1 && + be32_to_cpu(sb->s_header.h_blocktype) !=3D JBD2_SUPERBLOCK_V2) { printk(KERN_WARNING "JBD2: unrecognised superblock format ID\n"); goto out; } =20 - if (be32_to_cpu(sb->s_maxlen) < journal->j_total_len) - journal->j_total_len =3D be32_to_cpu(sb->s_maxlen); - else if (be32_to_cpu(sb->s_maxlen) > journal->j_total_len) { + if (be32_to_cpu(sb->s_maxlen) > journal->j_total_len) { printk(KERN_WARNING "JBD2: journal file too short\n"); goto out; } @@ -1979,25 +1971,14 @@ static int journal_get_superblock(journal_t *journa= l) journal->j_chksum_driver =3D NULL; goto out; } - } - - if (jbd2_journal_has_csum_v2or3(journal)) { /* Check superblock checksum */ if (sb->s_checksum !=3D jbd2_superblock_csum(journal, sb)) { printk(KERN_ERR "JBD2: journal checksum error\n"); err =3D -EFSBADCRC; goto out; } - - /* Precompute checksum seed for all metadata */ - journal->j_csum_seed =3D jbd2_chksum(journal, ~0, sb->s_uuid, - sizeof(sb->s_uuid)); } - - journal->j_revoke_records_per_block =3D - journal_revoke_records_per_block(journal); set_buffer_verified(bh); - return 0; =20 out: @@ -2022,12 +2003,30 @@ static int load_superblock(journal_t *journal) =20 sb =3D journal->j_superblock; =20 + switch (be32_to_cpu(sb->s_header.h_blocktype)) { + case JBD2_SUPERBLOCK_V1: + journal->j_format_version =3D 1; + break; + case JBD2_SUPERBLOCK_V2: + journal->j_format_version =3D 2; + break; + } + journal->j_tail_sequence =3D be32_to_cpu(sb->s_sequence); journal->j_tail =3D be32_to_cpu(sb->s_start); journal->j_first =3D be32_to_cpu(sb->s_first); journal->j_errno =3D be32_to_cpu(sb->s_errno); journal->j_last =3D be32_to_cpu(sb->s_maxlen); =20 + if (be32_to_cpu(sb->s_maxlen) < journal->j_total_len) + journal->j_total_len =3D be32_to_cpu(sb->s_maxlen); + /* Precompute checksum seed for all metadata */ + if (jbd2_journal_has_csum_v2or3(journal)) + journal->j_csum_seed =3D jbd2_chksum(journal, ~0, sb->s_uuid, + sizeof(sb->s_uuid)); + journal->j_revoke_records_per_block =3D + journal_revoke_records_per_block(journal); + if (jbd2_has_feature_fast_commit(journal)) { journal->j_fc_last =3D be32_to_cpu(sb->s_maxlen); num_fc_blocks =3D jbd2_journal_get_num_fc_blks(sb); @@ -2223,8 +2222,7 @@ int jbd2_journal_check_used_features(journal_t *journ= al, unsigned long compat, if (!compat && !ro && !incompat) return 1; /* Load journal superblock if it is not loaded yet. */ - if (journal->j_format_version =3D=3D 0 && - journal_get_superblock(journal) !=3D 0) + if (journal_get_superblock(journal)) return 0; if (!jbd2_format_support_feature(journal)) return 0; --=20 2.31.1 From nobody Wed Feb 11 16:14:13 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DBADC6FD19 for ; Mon, 13 Mar 2023 13:21:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230444AbjCMNVf (ORCPT ); Mon, 13 Mar 2023 09:21:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230114AbjCMNVQ (ORCPT ); Mon, 13 Mar 2023 09:21:16 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87093305F0; Mon, 13 Mar 2023 06:21:15 -0700 (PDT) Received: from kwepemm600013.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4PZy305DJDzKmR5; Mon, 13 Mar 2023 21:21:00 +0800 (CST) Received: from huawei.com (10.175.127.227) by kwepemm600013.china.huawei.com (7.193.23.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Mon, 13 Mar 2023 21:21:12 +0800 From: Zhihao Cheng To: , , , CC: , , , Subject: [PATCH v2 5/5] jbd2: remove j_format_version Date: Mon, 13 Mar 2023 21:20:21 +0800 Message-ID: <20230313132021.672134-6-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313132021.672134-1-chengzhihao1@huawei.com> References: <20230313132021.672134-1-chengzhihao1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600013.china.huawei.com (7.193.23.68) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhang Yi journal->j_format_version is no longer used, remove it. Signed-off-by: Zhang Yi Signed-off-by: Zhihao Cheng --- fs/jbd2/journal.c | 9 --------- include/linux/jbd2.h | 5 ----- 2 files changed, 14 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index f99c46d880b2..c19cdd402a5f 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -2003,15 +2003,6 @@ static int load_superblock(journal_t *journal) =20 sb =3D journal->j_superblock; =20 - switch (be32_to_cpu(sb->s_header.h_blocktype)) { - case JBD2_SUPERBLOCK_V1: - journal->j_format_version =3D 1; - break; - case JBD2_SUPERBLOCK_V2: - journal->j_format_version =3D 2; - break; - } - journal->j_tail_sequence =3D be32_to_cpu(sb->s_sequence); journal->j_tail =3D be32_to_cpu(sb->s_start); journal->j_first =3D be32_to_cpu(sb->s_first); diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 7095c0f17ad0..b7c79f68f7ca 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -792,11 +792,6 @@ struct journal_s */ journal_superblock_t *j_superblock; =20 - /** - * @j_format_version: Version of the superblock format. - */ - int j_format_version; - /** * @j_state_lock: Protect the various scalars in the journal. */ --=20 2.31.1