This is a note to let you know that I've just added the patch titled btrfs: qgroup: remove one-time use variables for quota_root checks to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: btrfs-qgroup-remove-one-time-use-variables-for-quota_root-checks.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From e3b0edd29737d44137fc7583a9c185abda6e23b8 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza <mpdesouza@xxxxxxxx> Date: Mon, 25 Nov 2019 21:58:50 -0300 Subject: btrfs: qgroup: remove one-time use variables for quota_root checks From: Marcos Paulo de Souza <mpdesouza@xxxxxxxx> commit e3b0edd29737d44137fc7583a9c185abda6e23b8 upstream. Remove some variables that are set only to be checked later, and never used. Reviewed-by: Qu Wenruo <wqu@xxxxxxxx> Signed-off-by: Marcos Paulo de Souza <mpdesouza@xxxxxxxx> Reviewed-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: Harshvardhan Jha <harshvardhan.j.jha@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/btrfs/qgroup.c | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1395,7 +1395,6 @@ int btrfs_add_qgroup_relation(struct btr u64 dst) { struct btrfs_fs_info *fs_info = trans->fs_info; - struct btrfs_root *quota_root; struct btrfs_qgroup *parent; struct btrfs_qgroup *member; struct btrfs_qgroup_list *list; @@ -1411,8 +1410,7 @@ int btrfs_add_qgroup_relation(struct btr return -ENOMEM; mutex_lock(&fs_info->qgroup_ioctl_lock); - quota_root = fs_info->quota_root; - if (!quota_root) { + if (!fs_info->quota_root) { ret = -EINVAL; goto out; } @@ -1459,7 +1457,6 @@ static int __del_qgroup_relation(struct u64 dst) { struct btrfs_fs_info *fs_info = trans->fs_info; - struct btrfs_root *quota_root; struct btrfs_qgroup *parent; struct btrfs_qgroup *member; struct btrfs_qgroup_list *list; @@ -1472,8 +1469,7 @@ static int __del_qgroup_relation(struct if (!tmp) return -ENOMEM; - quota_root = fs_info->quota_root; - if (!quota_root) { + if (!fs_info->quota_root) { ret = -EINVAL; goto out; } @@ -1539,11 +1535,11 @@ int btrfs_create_qgroup(struct btrfs_tra int ret = 0; mutex_lock(&fs_info->qgroup_ioctl_lock); - quota_root = fs_info->quota_root; - if (!quota_root) { + if (!fs_info->quota_root) { ret = -EINVAL; goto out; } + quota_root = fs_info->quota_root; qgroup = find_qgroup_rb(fs_info, qgroupid); if (qgroup) { ret = -EEXIST; @@ -1568,14 +1564,12 @@ out: int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid) { struct btrfs_fs_info *fs_info = trans->fs_info; - struct btrfs_root *quota_root; struct btrfs_qgroup *qgroup; struct btrfs_qgroup_list *list; int ret = 0; mutex_lock(&fs_info->qgroup_ioctl_lock); - quota_root = fs_info->quota_root; - if (!quota_root) { + if (!fs_info->quota_root) { ret = -EINVAL; goto out; } @@ -1617,7 +1611,6 @@ int btrfs_limit_qgroup(struct btrfs_tran struct btrfs_qgroup_limit *limit) { struct btrfs_fs_info *fs_info = trans->fs_info; - struct btrfs_root *quota_root; struct btrfs_qgroup *qgroup; int ret = 0; /* Sometimes we would want to clear the limit on this qgroup. @@ -1627,8 +1620,7 @@ int btrfs_limit_qgroup(struct btrfs_tran const u64 CLEAR_VALUE = -1; mutex_lock(&fs_info->qgroup_ioctl_lock); - quota_root = fs_info->quota_root; - if (!quota_root) { + if (!fs_info->quota_root) { ret = -EINVAL; goto out; } @@ -2734,10 +2726,9 @@ cleanup: int btrfs_run_qgroups(struct btrfs_trans_handle *trans) { struct btrfs_fs_info *fs_info = trans->fs_info; - struct btrfs_root *quota_root = fs_info->quota_root; int ret = 0; - if (!quota_root) + if (!fs_info->quota_root) return ret; spin_lock(&fs_info->qgroup_lock); @@ -3000,7 +2991,6 @@ static bool qgroup_check_limits(const st static int qgroup_reserve(struct btrfs_root *root, u64 num_bytes, bool enforce, enum btrfs_qgroup_rsv_type type) { - struct btrfs_root *quota_root; struct btrfs_qgroup *qgroup; struct btrfs_fs_info *fs_info = root->fs_info; u64 ref_root = root->root_key.objectid; @@ -3019,8 +3009,7 @@ static int qgroup_reserve(struct btrfs_r enforce = false; spin_lock(&fs_info->qgroup_lock); - quota_root = fs_info->quota_root; - if (!quota_root) + if (!fs_info->quota_root) goto out; qgroup = find_qgroup_rb(fs_info, ref_root); @@ -3087,7 +3076,6 @@ void btrfs_qgroup_free_refroot(struct bt u64 ref_root, u64 num_bytes, enum btrfs_qgroup_rsv_type type) { - struct btrfs_root *quota_root; struct btrfs_qgroup *qgroup; struct ulist_node *unode; struct ulist_iterator uiter; @@ -3105,8 +3093,7 @@ void btrfs_qgroup_free_refroot(struct bt } spin_lock(&fs_info->qgroup_lock); - quota_root = fs_info->quota_root; - if (!quota_root) + if (!fs_info->quota_root) goto out; qgroup = find_qgroup_rb(fs_info, ref_root); @@ -3997,7 +3984,6 @@ void __btrfs_qgroup_free_meta(struct btr static void qgroup_convert_meta(struct btrfs_fs_info *fs_info, u64 ref_root, int num_bytes) { - struct btrfs_root *quota_root = fs_info->quota_root; struct btrfs_qgroup *qgroup; struct ulist_node *unode; struct ulist_iterator uiter; @@ -4005,7 +3991,7 @@ static void qgroup_convert_meta(struct b if (num_bytes == 0) return; - if (!quota_root) + if (!fs_info->quota_root) return; spin_lock(&fs_info->qgroup_lock); Patches currently in stable-queue which might be from mpdesouza@xxxxxxxx are queue-5.4/btrfs-qgroup-remove-one-time-use-variables-for-quota_root-checks.patch queue-5.4/btrfs-qgroup-return-enotconn-instead-of-einval-when-quotas-are-not-enabled.patch