[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221115173342.GL5824@suse.cz>
Date: Tue, 15 Nov 2022 18:33:42 +0100
From: David Sterba <dsterba@...e.cz>
To: ChenXiaoSong <chenxiaosong2@...wei.com>
Cc: clm@...com, josef@...icpanda.com, dsterba@...e.com,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
zhangxiaoxu5@...wei.com, yanaijie@...wei.com,
quwenruo.btrfs@....com, wqu@...e.com
Subject: Re: [PATCH v4 2/3] btrfs: qgroup: introduce
btrfs_update_quoto_limit() helper
On Wed, Nov 16, 2022 at 01:17:08AM +0800, ChenXiaoSong wrote:
> No functional changed. Just simplify the code.
Please write some description of the change, like "factor out quota
limit update that also marks qgroup as inconsistent if it fals".
> 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,
Typo 'quoto' and it should rather be qgroup as the limit is related to a
qgroup, quota is usually in connection with the whole subsystem.
> + 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