From: Qu Wenruo <wqu@suse.com>
To: fdmanana@kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v3 2/2] btrfs: qgroup: remove no longer used fs_info->qgroup_ulist
Date: Tue, 1 Jul 2025 06:54:09 +0930 [thread overview]
Message-ID: <5ac95d1f-ae5e-4251-b1b1-7c42aeb77f24@suse.com> (raw)
In-Reply-To: <6051db0c1a943d7f896fbb5b9cd548908e161ed0.1751288689.git.fdmanana@suse.com>
在 2025/6/30 22:37, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
>
> It's not used anymore after commit 091344508249 ("btrfs: qgroup: use
> qgroup_iterator in qgroup_convert_meta()"), so remove it.
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Thanks a lot for catching this.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> fs/btrfs/disk-io.c | 1 -
> fs/btrfs/fs.h | 6 ------
> fs/btrfs/qgroup.c | 31 +------------------------------
> 3 files changed, 1 insertion(+), 37 deletions(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index f6fa951c6be9..ee4911452cfd 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -1947,7 +1947,6 @@ static void btrfs_init_qgroup(struct btrfs_fs_info *fs_info)
> fs_info->qgroup_tree = RB_ROOT;
> INIT_LIST_HEAD(&fs_info->dirty_qgroups);
> fs_info->qgroup_seq = 1;
> - fs_info->qgroup_ulist = NULL;
> fs_info->qgroup_rescan_running = false;
> fs_info->qgroup_drop_subtree_thres = BTRFS_QGROUP_DROP_SUBTREE_THRES_DEFAULT;
> mutex_init(&fs_info->qgroup_rescan_lock);
> diff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h
> index b239e4b8421c..a731c883687d 100644
> --- a/fs/btrfs/fs.h
> +++ b/fs/btrfs/fs.h
> @@ -740,12 +740,6 @@ struct btrfs_fs_info {
> struct rb_root qgroup_tree;
> spinlock_t qgroup_lock;
>
> - /*
> - * Used to avoid frequently calling ulist_alloc()/ulist_free()
> - * when doing qgroup accounting, it must be protected by qgroup_lock.
> - */
> - struct ulist *qgroup_ulist;
> -
> /*
> * Protect user change for quota operations. If a transaction is needed,
> * it must be started before locking this lock.
> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
> index 8fa874ef80b3..98a53e6edb2c 100644
> --- a/fs/btrfs/qgroup.c
> +++ b/fs/btrfs/qgroup.c
> @@ -397,12 +397,6 @@ int btrfs_read_qgroup_config(struct btrfs_fs_info *fs_info)
> if (!fs_info->quota_root)
> return 0;
>
> - fs_info->qgroup_ulist = ulist_alloc(GFP_KERNEL);
> - if (!fs_info->qgroup_ulist) {
> - ret = -ENOMEM;
> - goto out;
> - }
> -
> path = btrfs_alloc_path();
> if (!path) {
> ret = -ENOMEM;
> @@ -587,8 +581,6 @@ int btrfs_read_qgroup_config(struct btrfs_fs_info *fs_info)
> if (fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN)
> ret = qgroup_rescan_init(fs_info, rescan_progress, 0);
> } else {
> - ulist_free(fs_info->qgroup_ulist);
> - fs_info->qgroup_ulist = NULL;
> fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_RESCAN;
> btrfs_sysfs_del_qgroups(fs_info);
> }
> @@ -660,13 +652,6 @@ void btrfs_free_qgroup_config(struct btrfs_fs_info *fs_info)
> }
> spin_unlock(&fs_info->qgroup_lock);
>
> - /*
> - * We call btrfs_free_qgroup_config() when unmounting
> - * filesystem and disabling quota, so we set qgroup_ulist
> - * to be null here to avoid double free.
> - */
> - ulist_free(fs_info->qgroup_ulist);
> - fs_info->qgroup_ulist = NULL;
> btrfs_sysfs_del_qgroups(fs_info);
> }
>
> @@ -1012,7 +997,6 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info,
> struct btrfs_qgroup *qgroup = NULL;
> struct btrfs_qgroup *prealloc = NULL;
> struct btrfs_trans_handle *trans = NULL;
> - struct ulist *ulist = NULL;
> const bool simple = (quota_ctl_args->cmd == BTRFS_QUOTA_CTL_ENABLE_SIMPLE_QUOTA);
> int ret = 0;
> int slot;
> @@ -1035,12 +1019,6 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info,
> if (fs_info->quota_root)
> goto out;
>
> - ulist = ulist_alloc(GFP_KERNEL);
> - if (!ulist) {
> - ret = -ENOMEM;
> - goto out;
> - }
> -
> ret = btrfs_sysfs_add_qgroups(fs_info);
> if (ret < 0)
> goto out;
> @@ -1080,9 +1058,6 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info,
> if (fs_info->quota_root)
> goto out;
>
> - fs_info->qgroup_ulist = ulist;
> - ulist = NULL;
> -
> /*
> * initially create the quota tree
> */
> @@ -1281,17 +1256,13 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info,
> if (ret)
> btrfs_put_root(quota_root);
> out:
> - if (ret) {
> - ulist_free(fs_info->qgroup_ulist);
> - fs_info->qgroup_ulist = NULL;
> + if (ret)
> btrfs_sysfs_del_qgroups(fs_info);
> - }
> mutex_unlock(&fs_info->qgroup_ioctl_lock);
> if (ret && trans)
> btrfs_end_transaction(trans);
> else if (trans)
> ret = btrfs_end_transaction(trans);
> - ulist_free(ulist);
> kfree(prealloc);
> return ret;
> }
prev parent reply other threads:[~2025-06-30 21:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-30 12:39 [PATCH 0/2] btrfs: qgroup race fix and cleanup fdmanana
2025-06-30 12:39 ` [PATCH 1/2] btrfs: qgroup: fix race between quota disable and quota rescan ioctl fdmanana
2025-06-30 12:39 ` [PATCH 2/2] btrfs: qgroup: remove no longer used fs_info->qgroup_ulist fdmanana
2025-06-30 13:01 ` [PATCH v2 0/2] btrfs: qgroup race fix and cleanup fdmanana
2025-06-30 13:01 ` [PATCH v2 1/2] btrfs: qgroup: fix race between quota disable and quota rescan ioctl fdmanana
2025-06-30 13:01 ` [PATCH v2 2/2] btrfs: qgroup: remove no longer used fs_info->qgroup_ulist fdmanana
2025-06-30 13:07 ` [PATCH v3 0/2] btrfs: qgroup race fix and cleanup fdmanana
2025-06-30 13:07 ` [PATCH v3 1/2] btrfs: qgroup: fix race between quota disable and quota rescan ioctl fdmanana
2025-06-30 16:32 ` Boris Burkov
2025-06-30 16:53 ` Filipe Manana
2025-06-30 21:22 ` Qu Wenruo
2025-06-30 13:07 ` [PATCH v3 2/2] btrfs: qgroup: remove no longer used fs_info->qgroup_ulist fdmanana
2025-06-30 16:34 ` Boris Burkov
2025-06-30 21:24 ` Qu Wenruo [this message]
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=5ac95d1f-ae5e-4251-b1b1-7c42aeb77f24@suse.com \
--to=wqu@suse.com \
--cc=fdmanana@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
/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