lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 16 Nov 2022 01:17:08 +0800
From:   ChenXiaoSong <chenxiaosong2@...wei.com>
To:     <clm@...com>, <josef@...icpanda.com>, <dsterba@...e.com>
CC:     <linux-btrfs@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <chenxiaosong2@...wei.com>, <zhangxiaoxu5@...wei.com>,
        <yanaijie@...wei.com>, <quwenruo.btrfs@....com>, <wqu@...e.com>
Subject: [PATCH v4 2/3] btrfs: qgroup: introduce btrfs_update_quoto_limit() helper

No functional changed. Just simplify the code.

Signed-off-by: ChenXiaoSong <chenxiaosong2@...wei.com>
---
 fs/btrfs/qgroup.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index d0480b9c6c86..ca609a70d067 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1677,6 +1677,19 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid)
 	return ret;
 }
 
+static int btrfs_update_quoto_limit(struct btrfs_trans_handle *trans,
+				    struct btrfs_qgroup *qgroup,
+				    struct btrfs_fs_info *fs_info)
+{
+	int ret = update_qgroup_limit_item(trans, qgroup);
+	if (ret) {
+		qgroup_mark_inconsistent(fs_info);
+		btrfs_info(fs_info, "unable to update quota limit for %llu",
+			   qgroup->qgroupid);
+	}
+	return ret;
+}
+
 int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid,
 		       struct btrfs_qgroup_limit *limit)
 {
@@ -1742,13 +1755,7 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid,
 
 	spin_unlock(&fs_info->qgroup_lock);
 
-	ret = update_qgroup_limit_item(trans, qgroup);
-	if (ret) {
-		qgroup_mark_inconsistent(fs_info);
-		btrfs_info(fs_info, "unable to update quota limit for %llu",
-		       qgroupid);
-	}
-
+	ret = btrfs_update_quoto_limit(trans, qgroup, fs_info);
 out:
 	mutex_unlock(&fs_info->qgroup_ioctl_lock);
 	return ret;
@@ -2824,9 +2831,7 @@ int btrfs_run_qgroups(struct btrfs_trans_handle *trans)
 		ret = update_qgroup_info_item(trans, qgroup);
 		if (ret)
 			qgroup_mark_inconsistent(fs_info);
-		ret = update_qgroup_limit_item(trans, qgroup);
-		if (ret)
-			qgroup_mark_inconsistent(fs_info);
+		ret = btrfs_update_quoto_limit(trans, qgroup, fs_info);
 		spin_lock(&fs_info->qgroup_lock);
 	}
 	if (test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags))
@@ -2953,14 +2958,9 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid,
 		dstgroup->rsv_rfer = inherit->lim.rsv_rfer;
 		dstgroup->rsv_excl = inherit->lim.rsv_excl;
 
-		ret = update_qgroup_limit_item(trans, dstgroup);
-		if (ret) {
-			qgroup_mark_inconsistent(fs_info);
-			btrfs_info(fs_info,
-				   "unable to update quota limit for %llu",
-				   dstgroup->qgroupid);
+		ret = btrfs_update_quoto_limit(trans, dstgroup, fs_info);
+		if (ret)
 			goto unlock;
-		}
 	}
 
 	if (srcid) {
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ