Commit ddb47afa authored by Wang Shilong's avatar Wang Shilong Committed by Josef Bacik

Btrfs: fix a warning when updating qgroup limit

Step to reproduce:
	mkfs.btrfs <disk>
	mount <disk> <mnt>
	btrfs quota enable <mnt>
	btrfs qgroup limit 0/1 <mnt>
	dmesg

If the relative qgroup dosen't exist, flag 'BTRFS_QGROUP_STATUS_
FLAG_INCONSISTENT' will be set, and print the noise message.
This is wrong, we can just move find_qgroup_rb() before
update_qgroup_limit_item().this dosen't change the logic of the
function. But it can avoid unnecessary noise message and wrong set of flag.
Signed-off-by: default avatarWang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent 3f5e2d3b
...@@ -1092,6 +1092,11 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, ...@@ -1092,6 +1092,11 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans,
goto out; goto out;
} }
qgroup = find_qgroup_rb(fs_info, qgroupid);
if (!qgroup) {
ret = -ENOENT;
goto out;
}
ret = update_qgroup_limit_item(trans, quota_root, qgroupid, ret = update_qgroup_limit_item(trans, quota_root, qgroupid,
limit->flags, limit->max_rfer, limit->flags, limit->max_rfer,
limit->max_excl, limit->rsv_rfer, limit->max_excl, limit->rsv_rfer,
...@@ -1102,11 +1107,6 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, ...@@ -1102,11 +1107,6 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans,
(unsigned long long)qgroupid); (unsigned long long)qgroupid);
} }
qgroup = find_qgroup_rb(fs_info, qgroupid);
if (!qgroup) {
ret = -ENOENT;
goto out;
}
spin_lock(&fs_info->qgroup_lock); spin_lock(&fs_info->qgroup_lock);
qgroup->lim_flags = limit->flags; qgroup->lim_flags = limit->flags;
qgroup->max_rfer = limit->max_rfer; qgroup->max_rfer = limit->max_rfer;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment