From: David Sterba <dsterba@suse.cz>
To: ChenXiaoSong <chenxiaosong2@huawei.com>
Cc: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
zhangxiaoxu5@huawei.com, yanaijie@huawei.com,
quwenruo.btrfs@gmx.com, wqu@suse.com
Subject: Re: [PATCH v4 2/3] btrfs: qgroup: introduce btrfs_update_quoto_limit() helper
Date: Tue, 15 Nov 2022 18:33:42 +0100 [thread overview]
Message-ID: <20221115173342.GL5824@suse.cz> (raw)
In-Reply-To: <20221115171709.3774614-3-chenxiaosong2@huawei.com>
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@huawei.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
>
next prev parent reply other threads:[~2022-11-15 17:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 17:17 [PATCH v4 0/3] btrfs: fix sleep from invalid context bug in update_qgroup_limit_item() ChenXiaoSong
2022-11-15 17:17 ` [PATCH v4 1/3] btrfs: add might_sleep() to some places " ChenXiaoSong
2022-11-15 17:41 ` David Sterba
2022-11-15 22:48 ` Qu Wenruo
2022-11-16 8:09 ` ChenXiaoSong
2022-11-16 8:43 ` Qu Wenruo
2022-11-16 12:24 ` David Sterba
2022-11-16 12:26 ` Qu Wenruo
2022-11-15 17:17 ` [PATCH v4 2/3] btrfs: qgroup: introduce btrfs_update_quoto_limit() helper ChenXiaoSong
2022-11-15 17:33 ` David Sterba [this message]
2022-11-15 17:17 ` [PATCH v4 3/3] btrfs: qgroup: fix sleep from invalid context bug in update_qgroup_limit_item() ChenXiaoSong
2022-11-15 16:22 ` ChenXiaoSong
2022-11-15 22:50 ` Qu Wenruo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221115173342.GL5824@suse.cz \
--to=dsterba@suse.cz \
--cc=chenxiaosong2@huawei.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quwenruo.btrfs@gmx.com \
--cc=wqu@suse.com \
--cc=yanaijie@huawei.com \
--cc=zhangxiaoxu5@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox