From nobody Tue Feb 10 00:22:21 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 E9016C7619A for ; Mon, 27 Mar 2023 02:27:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231920AbjC0C1a (ORCPT ); Sun, 26 Mar 2023 22:27:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231352AbjC0C1W (ORCPT ); Sun, 26 Mar 2023 22:27:22 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E23B346B0; Sun, 26 Mar 2023 19:27:21 -0700 (PDT) Received: from dggpeml500021.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PlGpZ466Dznjwb; Mon, 27 Mar 2023 10:24:06 +0800 (CST) Received: from huawei.com (10.175.127.227) by dggpeml500021.china.huawei.com (7.185.36.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Mon, 27 Mar 2023 10:27:19 +0800 From: Baokun Li To: CC: , , , , , , , , Subject: [PATCH v2 2/2] ext4: refactoring to use the unified helper ext4_quotas_off() Date: Mon, 27 Mar 2023 10:27:03 +0800 Message-ID: <20230327022703.576857-3-libaokun1@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230327022703.576857-1-libaokun1@huawei.com> References: <20230327022703.576857-1-libaokun1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500021.china.huawei.com (7.185.36.21) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Rename ext4_quota_off_umount() to ext4_quotas_off(), and add type parameter to replace open code in ext4_enable_quotas(). Signed-off-by: Baokun Li Reviewed-by: Jan Kara --- V1->V2: Adapting to the changes in PATCH 1/2. fs/ext4/super.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index bd1ca1c3022e..59c5dd4dbe5a 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1157,12 +1157,12 @@ static void dump_orphan_list(struct super_block *sb= , struct ext4_sb_info *sbi) #ifdef CONFIG_QUOTA static int ext4_quota_off(struct super_block *sb, int type); =20 -static inline void ext4_quota_off_umount(struct super_block *sb) +static inline void ext4_quotas_off(struct super_block *sb, int type) { - int type; + BUG_ON(type > EXT4_MAXQUOTAS); =20 /* Use our quota_off function to clear inode flags etc. */ - for (type =3D 0; type < EXT4_MAXQUOTAS; type++) + for (type--; type >=3D 0; type--) ext4_quota_off(sb, type); } =20 @@ -1178,7 +1178,7 @@ static inline char *get_qf_name(struct super_block *s= b, lockdep_is_held(&sb->s_umount)); } #else -static inline void ext4_quota_off_umount(struct super_block *sb) +static inline void ext4_quotas_off(struct super_block *sb, int type) { } #endif @@ -1209,7 +1209,7 @@ static void ext4_put_super(struct super_block *sb) &sb->s_uuid); =20 ext4_unregister_li_request(sb); - ext4_quota_off_umount(sb); + ext4_quotas_off(sb, EXT4_MAXQUOTAS); =20 flush_work(&sbi->s_error_work); destroy_workqueue(sbi->rsv_conversion_wq); @@ -5541,7 +5541,7 @@ static int __ext4_fill_super(struct fs_context *fc, s= truct super_block *sb) =20 failed_mount10: #ifdef CONFIG_QUOTA - ext4_quota_off_umount(sb); + ext4_quotas_off(sb, EXT4_MAXQUOTAS); failed_mount9: #endif /* CONFIG_QUOTA */ ext4_release_orphan_info(sb); @@ -7014,20 +7014,8 @@ int ext4_enable_quotas(struct super_block *sb) "(type=3D%d, err=3D%d, ino=3D%lu). " "Please run e2fsck to fix.", type, err, qf_inums[type]); - for (type--; type >=3D 0; type--) { - struct inode *inode; - - inode =3D sb_dqopt(sb)->files[type]; - if (inode) - inode =3D igrab(inode); - dquot_quota_off(sb, type); - if (inode) { - lockdep_set_quota_inode(inode, - I_DATA_SEM_NORMAL); - iput(inode); - } - } =20 + ext4_quotas_off(sb, type); return err; } } --=20 2.31.1