From patchwork Fri Mar 10 12:52:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhihao Cheng X-Patchwork-Id: 67387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp859774wrd; Fri, 10 Mar 2023 05:06:45 -0800 (PST) X-Google-Smtp-Source: AK7set8xZfjbn6uT3Z1RSl4E9ZvMr6c7CV0kWhDHy3tG/x+yScFcvZrd2L0kwVR9LJieO6wH+DSX X-Received: by 2002:a17:902:864b:b0:19e:7889:f9fb with SMTP id y11-20020a170902864b00b0019e7889f9fbmr22730014plt.68.1678453605011; Fri, 10 Mar 2023 05:06:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678453604; cv=none; d=google.com; s=arc-20160816; b=nzLmbOz2PV9WMkI+SxZO88GFjtfnvHk9JOLszEOKcUhb4LBk31LUelG370yPcsXKtE cJUhj4iW11M2I5F0dYtbT6Bprrp5KQgciqoOJ+RhpYjYMCFELxgQAQMe7quc3hoP119i fWTitnKF5yPZ9xUupbvlfD8eesez2yU6E2CLncmGIG/taxy7wdp6/3OpVSGYuNZY6vlG 67RM0WO3wBjqf+X6cBy38epHoxPySZH58OiVDxWvlRUGsOifxlD1fMjbV3wNaNr9YRKq 0PHRUtp/t6EQmAr3HZ1yrZxwC8AehXYVJcwTZ8v6uXXk9x+3au0V6gb50+N4MIcEHP5X drhA== 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=JrUpRWsprgMjBkZ/u2uTZ6UX0v586TCo2g+0+MKDG3I=; b=om0dlmFl/0Ga57UsLlC11J7eWBLbHumr2wCI2V0ARisxb8CvYeM9NdRIjLtZ6DQ8TP D4ssMust1L2eTPsxsQVhogmtrIAwtoYUWiRPHugWXfHnBqCHKROgBIAhV5k3yjugN0ii i9M00GRaqx2gVI2O1tDMD6i2H6Di0i47iEiA+7N7qGQrCHzEgiRLGWrzONCFdjx78kAS JlNHHCJs/B0+KdHdzIxa15Qj5XIipYYiO6VV3q5Sv+3+PP2mXPPBsltJOqsuHyZcsvxq Z74H0yXYMD1gru1YhLI4UzoQBY474XH/GhejV4pS5MAuyKVU5h3X1t+IWIZ2yaUHVr1l Q8fw== ARC-Authentication-Results: i=1; mx.google.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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q19-20020a170902b11300b0019266fcbd20si1949390plr.623.2023.03.10.05.06.32; Fri, 10 Mar 2023 05:06:44 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230296AbjCJMxD (ORCPT + 99 others); Fri, 10 Mar 2023 07:53:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230165AbjCJMwz (ORCPT ); Fri, 10 Mar 2023 07:52:55 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3F8C10C721; Fri, 10 Mar 2023 04:52:52 -0800 (PST) Received: from kwepemm600013.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PY5WR5MZhzHwTv; Fri, 10 Mar 2023 20:50:43 +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; Fri, 10 Mar 2023 20:52:50 +0800 From: Zhihao Cheng To: , , CC: , , , Subject: [PATCH 1/5] ext4: Fix reusing stale buffer heads from last failed mounting Date: Fri, 10 Mar 2023 20:52:02 +0800 Message-ID: <20230310125206.2867822-2-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230310125206.2867822-1-chengzhihao1@huawei.com> References: <20230310125206.2867822-1-chengzhihao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600013.china.huawei.com (7.193.23.68) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759986167356689441?= X-GMAIL-MSGID: =?utf-8?q?1759986167356689441?= 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 = getblk_unmovable bh = __find_get_block // Found stale bh in last failed mounting journal->j_sb_buffer = bh jbd2_journal_load load_superblock journal_get_superblock if (buffer_verified(bh)) // true, skip journal->j_format_version = 2, value is 0 jbd2_journal_recover do_one_pass next_log_block += 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 >= 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=217171 Cc: Signed-off-by: Zhihao Cheng Reviewed-by: Jan Kara --- 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 = 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 = NULL; } @@ -1271,14 +1277,8 @@ static void ext4_put_super(struct super_block *sb) sync_blockdev(sb->s_bdev); invalidate_bdev(sb->s_bdev); - if (sbi->s_journal_bdev && sbi->s_journal_bdev != 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); } @@ -5610,6 +5610,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) brelse(sbi->s_sbh); ext4_blkdev_remove(sbi); out_fail: + invalidate_bdev(sb->s_bdev); sb->s_fs_info = NULL; return err ? err : ret; } From patchwork Fri Mar 10 12:52:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhihao Cheng X-Patchwork-Id: 67388 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp860196wrd; Fri, 10 Mar 2023 05:07:31 -0800 (PST) X-Google-Smtp-Source: AK7set86S77l/dpgmW2HATr41YjnpyyeT9gZzuSgN9QvJu4iQkJeQ6JjdzEY2SHNannQ3YD0o4lL X-Received: by 2002:a62:19d6:0:b0:5a8:be36:65a8 with SMTP id 205-20020a6219d6000000b005a8be3665a8mr21916287pfz.27.1678453651422; Fri, 10 Mar 2023 05:07:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678453651; cv=none; d=google.com; s=arc-20160816; b=Jq3OGvuAJNtUgv3gZveO2sIhYS8gFhGvw+JyWfBukAhiIPz4Vn4GR4uTc3CIb+js8P i5Nk0nS4yq6JTLKZ6Bb/X0JwaOX5XIzirRqSRQlK83AFK9jPeD7jJzWxYc9SId9oy6GF OuqNN18vVAw0JwnNayUYKSNYXlXDNWhmSobnIYq7C6kwTOI3EnlS9h52bq2B9IWnfGRI OTIjIJC48vKbPzaGC43YxDDZYhYotEki/Lim00qOmfScYa7AwpDWz4KIQ32zvQV14Ynj u5Qo9+fUCztb+yXFlDFn4ORYQbxFVGwDUuTt6+1k4nPnsORx9AyHVvHt6ddWRFVYpGkB DZqw== 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=r9vN5KF/ve1+PIvg2+TaGwq3HMbvIOQ1Vf6hYMEzVq0=; b=CeVbYwBJYHkib7As00B1fyciOtFFgAWRGrhXVNLUzHSFWX7SHBqYAgvYMU3xGp3pTC s9HmpFCEKjaIaOq3QOUYkYdGBi6I+kkIorBfYnFdMkWL3eFPDgtBLm+jnEqC1wCnEb/y A/ysttI6+KqSdyuVfPLy2DQqXytKV+p461B0x1gMi9Pn3zVfLjxasJ74HpW+VGmp7KQm e/rPLBXNwrloacC+FUTVYdfQIM4vIoRgn9l75SBHros9KXmAVdYlcJIjcVVpcpRk21eV JBn+uYkMrd9mJbHiXxsAhW1saW4crJMwUIq3dJ8eKVgjDnurvk5yf+0G/UuBLcBAu0Ie 2Jcw== ARC-Authentication-Results: i=1; mx.google.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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c28-20020aa7953c000000b00593b134c4easi1831808pfp.187.2023.03.10.05.07.18; Fri, 10 Mar 2023 05:07:31 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230039AbjCJMxJ (ORCPT + 99 others); Fri, 10 Mar 2023 07:53:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230236AbjCJMw5 (ORCPT ); Fri, 10 Mar 2023 07:52:57 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94FFA10DE4B; Fri, 10 Mar 2023 04:52:53 -0800 (PST) Received: from kwepemm600013.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4PY5Vc4sCMz16PB8; Fri, 10 Mar 2023 20:50: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; Fri, 10 Mar 2023 20:52:50 +0800 From: Zhihao Cheng To: , , CC: , , , Subject: [PATCH 2/5] jbd2: remove unused feature macros Date: Fri, 10 Mar 2023 20:52:03 +0800 Message-ID: <20230310125206.2867822-3-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230310125206.2867822-1-chengzhihao1@huawei.com> References: <20230310125206.2867822-1-chengzhihao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600013.china.huawei.com (7.193.23.68) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759986215811118131?= X-GMAIL-MSGID: =?utf-8?q?1759986215811118131?= 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 Reviewed-by: Jan Kara --- 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; -/* Use the jbd2_{has,set,clear}_feature_* helpers; these will be removed */ -#define JBD2_HAS_COMPAT_FEATURE(j,mask) \ - ((j)->j_format_version >= 2 && \ - ((j)->j_superblock->s_feature_compat & cpu_to_be32((mask)))) -#define JBD2_HAS_RO_COMPAT_FEATURE(j,mask) \ - ((j)->j_format_version >= 2 && \ - ((j)->j_superblock->s_feature_ro_compat & cpu_to_be32((mask)))) -#define JBD2_HAS_INCOMPAT_FEATURE(j,mask) \ - ((j)->j_format_version >= 2 && \ - ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask)))) - #define JBD2_FEATURE_COMPAT_CHECKSUM 0x00000001 #define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001 From patchwork Fri Mar 10 12:52:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhihao Cheng X-Patchwork-Id: 67385 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp857122wrd; Fri, 10 Mar 2023 05:03:00 -0800 (PST) X-Google-Smtp-Source: AK7set/jRgl07T0weI1PRDPZTyEsN5MBZ0pTi99nAsH7bBFLEjxwQZK6zqQVGg0pJaGGBQv17PFi X-Received: by 2002:a17:902:d506:b0:19e:2717:3de9 with SMTP id b6-20020a170902d50600b0019e27173de9mr31795117plg.52.1678453379772; Fri, 10 Mar 2023 05:02:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678453379; cv=none; d=google.com; s=arc-20160816; b=oW/Z1nbX8fvA+CC5vi6wXIh0ul9goX6shOn205SQ48ifbsAp2+/8PfmmPcdz1A05yy q1ZezayDMFCBamo/xjokHMCpVuiztVXjsklOWH8LfBdjLBxKe/dW5B/vVr61nfj/qjFL 5tP7L1P+zAHEIfTtQ3d395F6TlsuLFzjvmiQDge3bqgJmOknf5DjReDZ13QM+ALbzEKM Fuq8FOo8onX+Px6zFLViHTObpEO0C91q0L+E/bIqxvvbeD6hslTJkkjbjw+5Mhn2lI7C N72HEn51bzB42CvGw+EmpwGPH9Kpd5hnF/jR6dF9vbjrL6abJmfHl03mIg3q5bNZAuIQ /i+Q== 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=Td0nMLfuepwMC8pPH1SytHoONl4ekVV4sCgwly4wkgM=; b=zQdi71ynsRAFdRce2x/fr5kZsG3TiAuXfPuJTMuwHtolvhdQzR9HhiI8bfeKs7a70N 4/C432Dge/D9nfromS3BMroPpzNEUtwAeQCvWtZZoV2LFu9FI11Oe2+qxsZ20/FVnAjq 7X8hMSxMHqzFFgOK91zasGvV+bjfWihLpfN1OznPWmqJkTzgVrGtW2adIWXz9p/Wce7W UmexefKfuLTfNrLB0May4OHUKqp1nOGSIMyFI80uZ0JuuBZysyHfKfDvPlauaKKvsNEX nsxbd/jE9Rcs9f2iBXqHl8xea97XACTPXlojep/IpnaKqRdPViiWd6iYnVR/VKsCsV1c 1VOg== ARC-Authentication-Results: i=1; mx.google.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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iz15-20020a170902ef8f00b0019e69b5fa9esi2016642plb.521.2023.03.10.05.02.46; Fri, 10 Mar 2023 05:02:59 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230350AbjCJMxM (ORCPT + 99 others); Fri, 10 Mar 2023 07:53:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230243AbjCJMxA (ORCPT ); Fri, 10 Mar 2023 07:53:00 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA29810DE5C; Fri, 10 Mar 2023 04:52:53 -0800 (PST) Received: from kwepemm600013.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PY5VJ2FTJzSkkm; Fri, 10 Mar 2023 20:49:44 +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; Fri, 10 Mar 2023 20:52:51 +0800 From: Zhihao Cheng To: , , CC: , , , Subject: [PATCH 3/5] jbd2: switch to check format version in superblock directly Date: Fri, 10 Mar 2023 20:52:04 +0800 Message-ID: <20230310125206.2867822-4-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230310125206.2867822-1-chengzhihao1@huawei.com> References: <20230310125206.2867822-1-chengzhihao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600013.china.huawei.com (7.193.23.68) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759985931221586384?= X-GMAIL-MSGID: =?utf-8?q?1759985931221586384?= 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 Reviewed-by: Jan Kara --- 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; sb = journal->j_superblock; - /* If this is a V2 superblock, then we have to check the - * features flags on it. */ - if (journal->j_format_version >= 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 *journal, unsigned long compat, if (journal->j_format_version == 0 && journal_get_superblock(journal) != 0) return 0; - if (journal->j_format_version == 1) + if (!jbd2_format_support_feature(journal)) return 0; sb = 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; - /* 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 != 2) + if (!jbd2_format_support_feature(journal)) return 0; if ((compat & JBD2_KNOWN_COMPAT_FEATURES) == 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) +/* + * 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 != + 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 >= 2 && \ + return (jbd2_format_support_feature(j) && \ ((j)->j_superblock->s_feature_compat & \ cpu_to_be32(JBD2_FEATURE_COMPAT_##flagname)) != 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 >= 2 && \ + return (jbd2_format_support_feature(j) && \ ((j)->j_superblock->s_feature_ro_compat & \ cpu_to_be32(JBD2_FEATURE_RO_COMPAT_##flagname)) != 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 >= 2 && \ + return (jbd2_format_support_feature(j) && \ ((j)->j_superblock->s_feature_incompat & \ cpu_to_be32(JBD2_FEATURE_INCOMPAT_##flagname)) != 0); \ } \ From patchwork Fri Mar 10 12:52:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhihao Cheng X-Patchwork-Id: 67386 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp857458wrd; Fri, 10 Mar 2023 05:03:26 -0800 (PST) X-Google-Smtp-Source: AK7set8XWMQKGz0HBY70Kii2xJ9eNUiLS/BppkwlDjdF+/vsjl/QnZde/hPE89r5vEtYV8kCCsDl X-Received: by 2002:a05:6a20:3d24:b0:cd:5334:e261 with SMTP id y36-20020a056a203d2400b000cd5334e261mr28154101pzi.12.1678453406152; Fri, 10 Mar 2023 05:03:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678453406; cv=none; d=google.com; s=arc-20160816; b=Bd1bN6Mj/lwNIzFSFGpu6zv3iJcQ6DTQb57Mc+TgYpSWT/h6p9Elg4WZgrFcNrFQHA g3JVZojCos6mWqCsQ/StvrewO6MxR9WW5FUtozTzG/h8vnxD31gPvQXnAnBTUFUS1jc+ PxoeGB29QhCXYMF3awu8/spC7vxMqHChH9eUGyYuLlQL2buMNO9nicFo7lygnoCx7NF1 GqbfOK7b2dFLeTB8t6ULvRhupZC1XsIoG/FXZg18U1uJ3GPqMRZUEfzJp+DLgqfa2N/l byVZS/gVLGof1wkpu/UhzM/uyo1qd/f9wHWAPMoA4a8MQ1iiAjKFF2gPhWIIYuF5oqEP d+pw== 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=527ifxFw/F6NKKKGcEB986sVWs+3j5CkjUNw4F2LE7c=; b=XLmwskz+PxcyIZLzTxF654X3/4ghFGso4qkKFQF+80K0vrE47kvJd2gWrLADwkLe1B uD2LGOABkvsPL2c/RsJZVazjCTH2hYmZV8KHuAu4gJCDS7+8r5sKp+XlJFrbriqYGaqK pN5mPI/104/uWMHwJe/6/lGlU5R1cfwggPL9Xq4NnOlPbGk99o4v5Qze7soTpq5415+Z bEdXpy3HVWQ0sh36azkMaJHVRIl70OG92uAl7IY4scLbYN9GYpewYA2oAxccKiSoRu/t RoUV6JPgqOsRjM35y2FVfoDmxSwD46Jm+P9vMOm4tiM2oihMpOMblakWFGCoXxR+rFgZ 6KTA== ARC-Authentication-Results: i=1; mx.google.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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x9-20020a633109000000b004fbe8661fdfsi1926376pgx.309.2023.03.10.05.03.12; Fri, 10 Mar 2023 05:03:26 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230286AbjCJMxQ (ORCPT + 99 others); Fri, 10 Mar 2023 07:53:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230336AbjCJMxK (ORCPT ); Fri, 10 Mar 2023 07:53:10 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82E17188; Fri, 10 Mar 2023 04:52:54 -0800 (PST) Received: from kwepemm600013.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PY5Vd0tlQznWd9; Fri, 10 Mar 2023 20:50:01 +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; Fri, 10 Mar 2023 20:52:52 +0800 From: Zhihao Cheng To: , , CC: , , , Subject: [PATCH 4/5] jbd2: factor out journal initialization from journal_get_superblock() Date: Fri, 10 Mar 2023 20:52:05 +0800 Message-ID: <20230310125206.2867822-5-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230310125206.2867822-1-chengzhihao1@huawei.com> References: <20230310125206.2867822-1-chengzhihao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600013.china.huawei.com (7.193.23.68) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759985958458690198?= X-GMAIL-MSGID: =?utf-8?q?1759985958458690198?= 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 | 52 ++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index b991d5c21d16..cd94d068b4e6 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1921,26 +1921,15 @@ static int journal_get_superblock(journal_t *journal) printk(KERN_WARNING "JBD2: no valid journal superblock found\n"); goto out; } - - switch(be32_to_cpu(sb->s_header.h_blocktype)) { - case JBD2_SUPERBLOCK_V1: - journal->j_format_version = 1; - break; - case JBD2_SUPERBLOCK_V2: - journal->j_format_version = 2; - break; - default: + if (be32_to_cpu(sb->s_header.h_blocktype) != JBD2_SUPERBLOCK_V1 && + be32_to_cpu(sb->s_header.h_blocktype) != JBD2_SUPERBLOCK_V2) { printk(KERN_WARNING "JBD2: unrecognised superblock format ID\n"); goto out; } - - if (be32_to_cpu(sb->s_maxlen) < journal->j_total_len) - journal->j_total_len = 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; } - if (be32_to_cpu(sb->s_first) == 0 || be32_to_cpu(sb->s_first) >= journal->j_total_len) { printk(KERN_WARNING @@ -1956,7 +1945,6 @@ static int journal_get_superblock(journal_t *journal) "at the same time!\n"); goto out; } - if (jbd2_journal_has_csum_v2or3_feature(journal) && jbd2_has_feature_checksum(journal)) { /* Can't have checksum v1 and v2 on at the same time! */ @@ -1964,12 +1952,10 @@ static int journal_get_superblock(journal_t *journal) "at the same time!\n"); goto out; } - if (!jbd2_verify_csum_type(journal, sb)) { printk(KERN_ERR "JBD2: Unknown checksum type\n"); goto out; } - /* Load the checksum driver */ if (jbd2_journal_has_csum_v2or3_feature(journal)) { journal->j_chksum_driver = crypto_alloc_shash("crc32c", 0, 0); @@ -1979,25 +1965,14 @@ static int journal_get_superblock(journal_t *journal) journal->j_chksum_driver = NULL; goto out; } - } - - if (jbd2_journal_has_csum_v2or3(journal)) { /* Check superblock checksum */ if (sb->s_checksum != jbd2_superblock_csum(journal, sb)) { printk(KERN_ERR "JBD2: journal checksum error\n"); err = -EFSBADCRC; goto out; } - - /* Precompute checksum seed for all metadata */ - journal->j_csum_seed = jbd2_chksum(journal, ~0, sb->s_uuid, - sizeof(sb->s_uuid)); } - - journal->j_revoke_records_per_block = - journal_revoke_records_per_block(journal); set_buffer_verified(bh); - return 0; out: @@ -2022,12 +1997,30 @@ static int load_superblock(journal_t *journal) sb = journal->j_superblock; + switch (be32_to_cpu(sb->s_header.h_blocktype)) { + case JBD2_SUPERBLOCK_V1: + journal->j_format_version = 1; + break; + case JBD2_SUPERBLOCK_V2: + journal->j_format_version = 2; + break; + } + journal->j_tail_sequence = be32_to_cpu(sb->s_sequence); journal->j_tail = be32_to_cpu(sb->s_start); journal->j_first = be32_to_cpu(sb->s_first); journal->j_errno = be32_to_cpu(sb->s_errno); journal->j_last = be32_to_cpu(sb->s_maxlen); + if (be32_to_cpu(sb->s_maxlen) < journal->j_total_len) + journal->j_total_len = be32_to_cpu(sb->s_maxlen); + /* Precompute checksum seed for all metadata */ + if (jbd2_journal_has_csum_v2or3(journal)) + journal->j_csum_seed = jbd2_chksum(journal, ~0, sb->s_uuid, + sizeof(sb->s_uuid)); + journal->j_revoke_records_per_block = + journal_revoke_records_per_block(journal); + if (jbd2_has_feature_fast_commit(journal)) { journal->j_fc_last = be32_to_cpu(sb->s_maxlen); num_fc_blocks = jbd2_journal_get_num_fc_blks(sb); @@ -2223,8 +2216,7 @@ int jbd2_journal_check_used_features(journal_t *journal, unsigned long compat, if (!compat && !ro && !incompat) return 1; /* Load journal superblock if it is not loaded yet. */ - if (journal->j_format_version == 0 && - journal_get_superblock(journal) != 0) + if (journal_get_superblock(journal)) return 0; if (!jbd2_format_support_feature(journal)) return 0; From patchwork Fri Mar 10 12:52:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhihao Cheng X-Patchwork-Id: 67389 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp861308wrd; Fri, 10 Mar 2023 05:09:24 -0800 (PST) X-Google-Smtp-Source: AK7set8HvulAdJDd9S4o2D/SAX+CozvGKSrSkqaGm78JqiscC0PHP6ZNixt3ICqM7ZUCZ5+JYDK/ X-Received: by 2002:a62:1748:0:b0:5dc:6dec:e9b9 with SMTP id 69-20020a621748000000b005dc6dece9b9mr23746758pfx.21.1678453764359; Fri, 10 Mar 2023 05:09:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678453764; cv=none; d=google.com; s=arc-20160816; b=nxhOufF8JMbKXepz7/RQMWpfAEX78fIoDbabwrquEg5nD8QzfJQXUBgseEKFu4HDbS p1fXspWEmgdf0/D4psxqodW8LYSoIOP8m+dApqF/G8rPYOBSbplW6jWX1TqVcPejBetB Mw5v8n9VFwFTGFG/xFVYcO4hz1NBqksJby8riBPvK9S3yOE0vGCvpMxhePMQpjACeof2 LVnfbMncPmdSmJbnvMHsLRk2Pvqj+t99AoQ3+Jn1cGmhYYT4I5+7iFJVUiEbn1HfTFS0 EqSqRhLXMPwtmfg+7Zbp/zpeoJ/LqzHj9oCgT1139SFgG/uDuxXgufVcpk4LXK5YYDlK 9HWA== 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=iojIUI2RQaUvhhjXlvk4T7aq3HaSV0Telni2/k+Smtw=; b=KQyD/7fFTN46QIDIO3cnT3MjS56+IDm/dEXxumzRHqGITYwnM0z4NVUDVyN7cUe+Cz nTFzFPaH+QI/eT6mlI6eS8kaj0hzLuWiUERfqnNFogVi6imBkV+j7eju93BxcV3D3oM9 UYa8STPskLLUjZ+RS/Te69xEOF18/V8tILBrpOKXvvW7tmRvsbdFu8NWvn2Yye6EOwwV IBBEtjONNNLPEBZ+DUmFI+WRFyJ2mNbcmD5ZecVChLg99y7FMDeZKhTehszdoSGwRB7f njl7ZTm4AsFjM6jQkVYEElAV3oq1X0Jy56CqggEPKVoruqOodK45JoNGrtfuEklHlYRu HyYA== ARC-Authentication-Results: i=1; mx.google.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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x9-20020a63cc09000000b004fac433dbcdsi1963171pgf.134.2023.03.10.05.08.30; Fri, 10 Mar 2023 05:09:24 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230373AbjCJMxU (ORCPT + 99 others); Fri, 10 Mar 2023 07:53:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230337AbjCJMxM (ORCPT ); Fri, 10 Mar 2023 07:53:12 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED7B42130; Fri, 10 Mar 2023 04:52:54 -0800 (PST) Received: from kwepemm600013.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PY5Vd5HDhznWZn; Fri, 10 Mar 2023 20:50:01 +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; Fri, 10 Mar 2023 20:52:52 +0800 From: Zhihao Cheng To: , , CC: , , , Subject: [PATCH 5/5] jbd2: remove j_format_version Date: Fri, 10 Mar 2023 20:52:06 +0800 Message-ID: <20230310125206.2867822-6-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230310125206.2867822-1-chengzhihao1@huawei.com> References: <20230310125206.2867822-1-chengzhihao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600013.china.huawei.com (7.193.23.68) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759986334181920065?= X-GMAIL-MSGID: =?utf-8?q?1759986334181920065?= From: Zhang Yi journal->j_format_version is no longer used, remove it. Signed-off-by: Zhang Yi Signed-off-by: Zhihao Cheng Reviewed-by: Jan Kara --- 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 cd94d068b4e6..fbada835b6b7 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1997,15 +1997,6 @@ static int load_superblock(journal_t *journal) sb = journal->j_superblock; - switch (be32_to_cpu(sb->s_header.h_blocktype)) { - case JBD2_SUPERBLOCK_V1: - journal->j_format_version = 1; - break; - case JBD2_SUPERBLOCK_V2: - journal->j_format_version = 2; - break; - } - journal->j_tail_sequence = be32_to_cpu(sb->s_sequence); journal->j_tail = be32_to_cpu(sb->s_start); journal->j_first = 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; - /** - * @j_format_version: Version of the superblock format. - */ - int j_format_version; - /** * @j_state_lock: Protect the various scalars in the journal. */