Message ID | 20230315013128.3911115-3-chengzhihao1@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2091965wrd; Tue, 14 Mar 2023 19:08:23 -0700 (PDT) X-Google-Smtp-Source: AK7set9WXiLswhPUbiQgg/0UJojztUKlShRpIOMYCpaOwQZ76JjreJi1kwbxVV2Iruxh9rJWL9xT X-Received: by 2002:a17:903:22cf:b0:1a0:5b98:f965 with SMTP id y15-20020a17090322cf00b001a05b98f965mr1196441plg.62.1678846103071; Tue, 14 Mar 2023 19:08:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678846103; cv=none; d=google.com; s=arc-20160816; b=nD7vZ6tUaXjcPIuNy9/wtp5AnTNfOVRUDRg0u2aINkzLtxA8/ISBbdlzNfnDPFHysy FCDhUR7g2ZYkOvtutnst/n/f+GdQ5VTlQ8qcSRt1+A732li2raThW/5A+4kwRzXPPurF seCecFEN1pXK+VxjP1vimtB10z4jUT1FPm1VSM6O7EDxd0rWBG1ymkf//sgSAGhtf1Xb zI/ozjtw8HLj3PmiCZU196q5AQO+FDhbVLvjDznPKnLyz2GTE1iBRjWat6fo5Qyz34jY gFBRjazOJxAAe9CYfHkoTOo2BY/goWOYhRxxapcL+kQ0lsVby1mP2i3sOB2X82VQagXM LAoQ== 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=UFq21MYuT/DA/HIrWCb94fQwILW/40p5KGZKDUyJXeM=; b=xWaZCMR8u4XCm3u6fJpCl/XN51ugs3rUXCTv3CPvcPnVUbYw3+H4/tqukurga9PX0z 9pqeZKS1UYKawG9hrxvT784Zg3B/IAUeJQ4rWI1/QsPTHyO3+sRwSjIZhBGyciBe15CP JOcaP//jqrxGHQDWHv/wQOMYlEHavgxCBAR6TKND8WwZHKL4nZThjR05CXLCQvzPLENk 3YGUk1XrxkbtwLTnxBMEc8A5YKmLRBBDAJZ00kIdFz1qV60c0A0/gdYpaF5/SKTT6Lvk dj/u914EzQWlyemiZWGE+xdlL9mL7/18Vb6V+PVv9LsP5+ZB+kNx3w2Rf74QNLr5FwGa tYPg== 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 io16-20020a17090312d000b0019ce74dd5c8si3739405plb.529.2023.03.14.19.08.04; Tue, 14 Mar 2023 19:08:23 -0700 (PDT) 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 S230122AbjCOBdC (ORCPT <rfc822;realc9580@gmail.com> + 99 others); Tue, 14 Mar 2023 21:33:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230133AbjCOBcw (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 14 Mar 2023 21:32:52 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CD293865D; Tue, 14 Mar 2023 18:32:19 -0700 (PDT) Received: from kwepemm600013.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4PbtD2607KzKmrn; Wed, 15 Mar 2023 09:32:02 +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; Wed, 15 Mar 2023 09:32:16 +0800 From: Zhihao Cheng <chengzhihao1@huawei.com> To: <tytso@mit.edu>, <adilger.kernel@dilger.ca>, <jack@suse.com>, <tudor.ambarus@linaro.org> CC: <linux-ext4@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <chengzhihao1@huawei.com>, <yi.zhang@huawei.com> Subject: [PATCH v3 2/6] ext4: ext4_put_super: Remove redundant checking for 'sbi->s_journal_bdev' Date: Wed, 15 Mar 2023 09:31:24 +0800 Message-ID: <20230315013128.3911115-3-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230315013128.3911115-1-chengzhihao1@huawei.com> References: <20230315013128.3911115-1-chengzhihao1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760397731861938926?= X-GMAIL-MSGID: =?utf-8?q?1760397731861938926?= |
Series |
ext4: Fix stale buffer loading from last failed
|
|
Commit Message
Zhihao Cheng
March 15, 2023, 1:31 a.m. UTC
As discussed in [1], 'sbi->s_journal_bdev != sb->s_bdev' will always
become true if sbi->s_journal_bdev exists. Filesystem block device and
journal block device are both opened with 'FMODE_EXCL' mode, so these
two devices can't be same one. Then we can remove the redundant checking
'sbi->s_journal_bdev != sb->s_bdev' if 'sbi->s_journal_bdev' exists.
[1] https://lore.kernel.org/lkml/f86584f6-3877-ff18-47a1-2efaa12d18b2@huawei.com/
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
---
fs/ext4/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Wed 15-03-23 09:31:24, Zhihao Cheng wrote: > As discussed in [1], 'sbi->s_journal_bdev != sb->s_bdev' will always > become true if sbi->s_journal_bdev exists. Filesystem block device and > journal block device are both opened with 'FMODE_EXCL' mode, so these > two devices can't be same one. Then we can remove the redundant checking > 'sbi->s_journal_bdev != sb->s_bdev' if 'sbi->s_journal_bdev' exists. > > [1] https://lore.kernel.org/lkml/f86584f6-3877-ff18-47a1-2efaa12d18b2@huawei.com/ > > Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Looks good. Feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > --- > fs/ext4/super.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ext4/super.c b/fs/ext4/super.c > index 61511b7ba017..a22417d113ca 100644 > --- a/fs/ext4/super.c > +++ b/fs/ext4/super.c > @@ -1277,7 +1277,7 @@ 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) { > + if (sbi->s_journal_bdev) { > sync_blockdev(sbi->s_journal_bdev); > ext4_blkdev_remove(sbi); > } > -- > 2.31.1 >
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 61511b7ba017..a22417d113ca 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1277,7 +1277,7 @@ 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) { + if (sbi->s_journal_bdev) { sync_blockdev(sbi->s_journal_bdev); ext4_blkdev_remove(sbi); }