mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
btrfs: qgroup: remove one-time use variables for quota_root checks
Remove some variables that are set only to be checked later, and never used. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
bc036bb335
commit
e3b0edd297
@ -1243,7 +1243,6 @@ int btrfs_add_qgroup_relation(struct btrfs_trans_handle *trans, u64 src,
|
||||
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;
|
||||
@ -1259,8 +1258,7 @@ int btrfs_add_qgroup_relation(struct btrfs_trans_handle *trans, u64 src,
|
||||
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;
|
||||
}
|
||||
@ -1307,7 +1305,6 @@ static int __del_qgroup_relation(struct btrfs_trans_handle *trans, u64 src,
|
||||
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;
|
||||
@ -1320,8 +1317,7 @@ static int __del_qgroup_relation(struct btrfs_trans_handle *trans, u64 src,
|
||||
if (!tmp)
|
||||
return -ENOMEM;
|
||||
|
||||
quota_root = fs_info->quota_root;
|
||||
if (!quota_root) {
|
||||
if (!fs_info->quota_root) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
@ -1387,11 +1383,11 @@ int btrfs_create_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid)
|
||||
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;
|
||||
@ -1416,14 +1412,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;
|
||||
}
|
||||
@ -1465,7 +1459,6 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid,
|
||||
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.
|
||||
@ -1475,8 +1468,7 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid,
|
||||
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;
|
||||
}
|
||||
@ -2582,10 +2574,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);
|
||||
@ -2879,7 +2870,6 @@ static bool qgroup_check_limits(struct btrfs_fs_info *fs_info,
|
||||
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;
|
||||
@ -2898,8 +2888,7 @@ static int qgroup_reserve(struct btrfs_root *root, u64 num_bytes, bool enforce,
|
||||
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);
|
||||
@ -2966,7 +2955,6 @@ void btrfs_qgroup_free_refroot(struct btrfs_fs_info *fs_info,
|
||||
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;
|
||||
@ -2984,8 +2972,7 @@ void btrfs_qgroup_free_refroot(struct btrfs_fs_info *fs_info,
|
||||
}
|
||||
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);
|
||||
@ -3685,7 +3672,6 @@ void __btrfs_qgroup_free_meta(struct btrfs_root *root, int num_bytes,
|
||||
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;
|
||||
@ -3693,7 +3679,7 @@ static void qgroup_convert_meta(struct btrfs_fs_info *fs_info, u64 ref_root,
|
||||
|
||||
if (num_bytes == 0)
|
||||
return;
|
||||
if (!quota_root)
|
||||
if (!fs_info->quota_root)
|
||||
return;
|
||||
|
||||
spin_lock(&fs_info->qgroup_lock);
|
||||
|
Loading…
Reference in New Issue
Block a user