diff options
author | Dongsheng Yang <yangds.fnst@cn.fujitsu.com> | 2015-02-06 11:06:25 -0500 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-04-13 10:52:43 -0400 |
commit | 03477d945f13a284d35a757b2c2323d165d5cd81 (patch) | |
tree | 7befa6fb9c024b74a475078af36632728a34a509 /fs | |
parent | d3001ed3a82ec2696bb13c78092d0a3460003fd7 (diff) |
btrfs: qgroup: fix limit args override whole limit struct
btrfs_limit_group use arg limit to override the old qgroup_limit of
corresponding qgroup. However, we should override part of old qgroup_limit
according to the bit which has been set in arg limit.
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/qgroup.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 5d1d75611745..5c2aaccbe3da 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -1185,11 +1185,16 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, | |||
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | spin_lock(&fs_info->qgroup_lock); | 1187 | spin_lock(&fs_info->qgroup_lock); |
1188 | qgroup->lim_flags = limit->flags; | 1188 | if (limit->flags & BTRFS_QGROUP_LIMIT_MAX_RFER) |
1189 | qgroup->max_rfer = limit->max_rfer; | 1189 | qgroup->max_rfer = limit->max_rfer; |
1190 | qgroup->max_excl = limit->max_excl; | 1190 | if (limit->flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) |
1191 | qgroup->rsv_rfer = limit->rsv_rfer; | 1191 | qgroup->max_excl = limit->max_excl; |
1192 | qgroup->rsv_excl = limit->rsv_excl; | 1192 | if (limit->flags & BTRFS_QGROUP_LIMIT_RSV_RFER) |
1193 | qgroup->rsv_rfer = limit->rsv_rfer; | ||
1194 | if (limit->flags & BTRFS_QGROUP_LIMIT_RSV_EXCL) | ||
1195 | qgroup->rsv_excl = limit->rsv_excl; | ||
1196 | qgroup->lim_flags |= limit->flags; | ||
1197 | |||
1193 | spin_unlock(&fs_info->qgroup_lock); | 1198 | spin_unlock(&fs_info->qgroup_lock); |
1194 | 1199 | ||
1195 | ret = update_qgroup_limit_item(trans, quota_root, qgroup); | 1200 | ret = update_qgroup_limit_item(trans, quota_root, qgroup); |