Skip to content

Commit

Permalink
btrfs: qgroup: fix limit args override whole limit struct
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dongsheng Yang authored and Chris Mason committed Apr 13, 2015
1 parent d3001ed commit 03477d9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions fs/btrfs/qgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1185,11 +1185,16 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans,
}

spin_lock(&fs_info->qgroup_lock);
qgroup->lim_flags = limit->flags;
qgroup->max_rfer = limit->max_rfer;
qgroup->max_excl = limit->max_excl;
qgroup->rsv_rfer = limit->rsv_rfer;
qgroup->rsv_excl = limit->rsv_excl;
if (limit->flags & BTRFS_QGROUP_LIMIT_MAX_RFER)
qgroup->max_rfer = limit->max_rfer;
if (limit->flags & BTRFS_QGROUP_LIMIT_MAX_EXCL)
qgroup->max_excl = limit->max_excl;
if (limit->flags & BTRFS_QGROUP_LIMIT_RSV_RFER)
qgroup->rsv_rfer = limit->rsv_rfer;
if (limit->flags & BTRFS_QGROUP_LIMIT_RSV_EXCL)
qgroup->rsv_excl = limit->rsv_excl;
qgroup->lim_flags |= limit->flags;

spin_unlock(&fs_info->qgroup_lock);

ret = update_qgroup_limit_item(trans, quota_root, qgroup);
Expand Down

0 comments on commit 03477d9

Please sign in to comment.