diff options
author | Dongsheng Yang <yangds.fnst@cn.fujitsu.com> | 2014-11-20 21:01:41 -0500 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-04-13 10:52:41 -0400 |
commit | 1510e71c620c27ffc7540176a0689f70d6915e28 (patch) | |
tree | 3a4dd32633036121f99e6fb93d71eeef7f329b54 /fs/btrfs | |
parent | e8c8541ac379709db8d2339e1cb720469fc2cd8f (diff) |
btrfs: qgroup: consolidate the parameter of fucntion update_qgroup_limit_item().
Cleanup: Change the parameter of update_qgroup_limit_item() to the family of
update_qgroup_xxx_item().
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/qgroup.c | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index bf926f766273..bf0702a865f8 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -644,9 +644,8 @@ out: | |||
644 | } | 644 | } |
645 | 645 | ||
646 | static int update_qgroup_limit_item(struct btrfs_trans_handle *trans, | 646 | static int update_qgroup_limit_item(struct btrfs_trans_handle *trans, |
647 | struct btrfs_root *root, u64 qgroupid, | 647 | struct btrfs_root *root, |
648 | u64 flags, u64 max_rfer, u64 max_excl, | 648 | struct btrfs_qgroup *qgroup) |
649 | u64 rsv_rfer, u64 rsv_excl) | ||
650 | { | 649 | { |
651 | struct btrfs_path *path; | 650 | struct btrfs_path *path; |
652 | struct btrfs_key key; | 651 | struct btrfs_key key; |
@@ -657,7 +656,7 @@ static int update_qgroup_limit_item(struct btrfs_trans_handle *trans, | |||
657 | 656 | ||
658 | key.objectid = 0; | 657 | key.objectid = 0; |
659 | key.type = BTRFS_QGROUP_LIMIT_KEY; | 658 | key.type = BTRFS_QGROUP_LIMIT_KEY; |
660 | key.offset = qgroupid; | 659 | key.offset = qgroup->qgroupid; |
661 | 660 | ||
662 | path = btrfs_alloc_path(); | 661 | path = btrfs_alloc_path(); |
663 | if (!path) | 662 | if (!path) |
@@ -673,11 +672,11 @@ static int update_qgroup_limit_item(struct btrfs_trans_handle *trans, | |||
673 | l = path->nodes[0]; | 672 | l = path->nodes[0]; |
674 | slot = path->slots[0]; | 673 | slot = path->slots[0]; |
675 | qgroup_limit = btrfs_item_ptr(l, slot, struct btrfs_qgroup_limit_item); | 674 | qgroup_limit = btrfs_item_ptr(l, slot, struct btrfs_qgroup_limit_item); |
676 | btrfs_set_qgroup_limit_flags(l, qgroup_limit, flags); | 675 | btrfs_set_qgroup_limit_flags(l, qgroup_limit, qgroup->lim_flags); |
677 | btrfs_set_qgroup_limit_max_rfer(l, qgroup_limit, max_rfer); | 676 | btrfs_set_qgroup_limit_max_rfer(l, qgroup_limit, qgroup->max_rfer); |
678 | btrfs_set_qgroup_limit_max_excl(l, qgroup_limit, max_excl); | 677 | btrfs_set_qgroup_limit_max_excl(l, qgroup_limit, qgroup->max_excl); |
679 | btrfs_set_qgroup_limit_rsv_rfer(l, qgroup_limit, rsv_rfer); | 678 | btrfs_set_qgroup_limit_rsv_rfer(l, qgroup_limit, qgroup->rsv_rfer); |
680 | btrfs_set_qgroup_limit_rsv_excl(l, qgroup_limit, rsv_excl); | 679 | btrfs_set_qgroup_limit_rsv_excl(l, qgroup_limit, qgroup->rsv_excl); |
681 | 680 | ||
682 | btrfs_mark_buffer_dirty(l); | 681 | btrfs_mark_buffer_dirty(l); |
683 | 682 | ||
@@ -1184,15 +1183,6 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, | |||
1184 | ret = -ENOENT; | 1183 | ret = -ENOENT; |
1185 | goto out; | 1184 | goto out; |
1186 | } | 1185 | } |
1187 | ret = update_qgroup_limit_item(trans, quota_root, qgroupid, | ||
1188 | limit->flags, limit->max_rfer, | ||
1189 | limit->max_excl, limit->rsv_rfer, | ||
1190 | limit->rsv_excl); | ||
1191 | if (ret) { | ||
1192 | fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT; | ||
1193 | btrfs_info(fs_info, "unable to update quota limit for %llu", | ||
1194 | qgroupid); | ||
1195 | } | ||
1196 | 1186 | ||
1197 | spin_lock(&fs_info->qgroup_lock); | 1187 | spin_lock(&fs_info->qgroup_lock); |
1198 | qgroup->lim_flags = limit->flags; | 1188 | qgroup->lim_flags = limit->flags; |
@@ -1201,6 +1191,14 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, | |||
1201 | qgroup->rsv_rfer = limit->rsv_rfer; | 1191 | qgroup->rsv_rfer = limit->rsv_rfer; |
1202 | qgroup->rsv_excl = limit->rsv_excl; | 1192 | qgroup->rsv_excl = limit->rsv_excl; |
1203 | spin_unlock(&fs_info->qgroup_lock); | 1193 | spin_unlock(&fs_info->qgroup_lock); |
1194 | |||
1195 | ret = update_qgroup_limit_item(trans, quota_root, qgroup); | ||
1196 | if (ret) { | ||
1197 | fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT; | ||
1198 | btrfs_info(fs_info, "unable to update quota limit for %llu", | ||
1199 | qgroupid); | ||
1200 | } | ||
1201 | |||
1204 | out: | 1202 | out: |
1205 | mutex_unlock(&fs_info->qgroup_ioctl_lock); | 1203 | mutex_unlock(&fs_info->qgroup_ioctl_lock); |
1206 | return ret; | 1204 | return ret; |
@@ -2276,20 +2274,19 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, | |||
2276 | } | 2274 | } |
2277 | 2275 | ||
2278 | if (inherit && inherit->flags & BTRFS_QGROUP_INHERIT_SET_LIMITS) { | 2276 | if (inherit && inherit->flags & BTRFS_QGROUP_INHERIT_SET_LIMITS) { |
2279 | ret = update_qgroup_limit_item(trans, quota_root, objectid, | ||
2280 | inherit->lim.flags, | ||
2281 | inherit->lim.max_rfer, | ||
2282 | inherit->lim.max_excl, | ||
2283 | inherit->lim.rsv_rfer, | ||
2284 | inherit->lim.rsv_excl); | ||
2285 | if (ret) | ||
2286 | goto unlock; | ||
2287 | |||
2288 | dstgroup->lim_flags = inherit->lim.flags; | 2277 | dstgroup->lim_flags = inherit->lim.flags; |
2289 | dstgroup->max_rfer = inherit->lim.max_rfer; | 2278 | dstgroup->max_rfer = inherit->lim.max_rfer; |
2290 | dstgroup->max_excl = inherit->lim.max_excl; | 2279 | dstgroup->max_excl = inherit->lim.max_excl; |
2291 | dstgroup->rsv_rfer = inherit->lim.rsv_rfer; | 2280 | dstgroup->rsv_rfer = inherit->lim.rsv_rfer; |
2292 | dstgroup->rsv_excl = inherit->lim.rsv_excl; | 2281 | dstgroup->rsv_excl = inherit->lim.rsv_excl; |
2282 | |||
2283 | ret = update_qgroup_limit_item(trans, quota_root, dstgroup); | ||
2284 | if (ret) { | ||
2285 | fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT; | ||
2286 | btrfs_info(fs_info, "unable to update quota limit for %llu", | ||
2287 | dstgroup->qgroupid); | ||
2288 | goto unlock; | ||
2289 | } | ||
2293 | } | 2290 | } |
2294 | 2291 | ||
2295 | if (srcid) { | 2292 | if (srcid) { |