Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 374883
b: refs/heads/master
c: 3c97185
h: refs/heads/master
i:
  374881: 7ffc7be
  374879: d722b36
v: v3
  • Loading branch information
Wang Shilong authored and Josef Bacik committed May 6, 2013
1 parent 6926bc4 commit 6d01fc4
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 70023da276ed7a46201e7b0d3168b005ad82fecb
refs/heads/master: 3c97185c65858d23bc02492fbd27733f1f11ea83
62 changes: 44 additions & 18 deletions trunk/fs/btrfs/qgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,10 @@ int btrfs_qgroup_account_ref(struct btrfs_trans_handle *trans,

ulist_reinit(tmp);
/* XXX id not needed */
ulist_add(tmp, qg->qgroupid, (u64)(uintptr_t)qg, GFP_ATOMIC);
ret = ulist_add(tmp, qg->qgroupid,
(u64)(uintptr_t)qg, GFP_ATOMIC);
if (ret < 0)
goto unlock;
ULIST_ITER_INIT(&tmp_uiter);
while ((tmp_unode = ulist_next(tmp, &tmp_uiter))) {
struct btrfs_qgroup_list *glist;
Expand All @@ -1273,9 +1276,11 @@ int btrfs_qgroup_account_ref(struct btrfs_trans_handle *trans,
++qg->refcnt;

list_for_each_entry(glist, &qg->groups, next_group) {
ulist_add(tmp, glist->group->qgroupid,
(u64)(uintptr_t)glist->group,
GFP_ATOMIC);
ret = ulist_add(tmp, glist->group->qgroupid,
(u64)(uintptr_t)glist->group,
GFP_ATOMIC);
if (ret < 0)
goto unlock;
}
}
}
Expand All @@ -1284,7 +1289,10 @@ int btrfs_qgroup_account_ref(struct btrfs_trans_handle *trans,
* step 2: walk from the new root
*/
ulist_reinit(tmp);
ulist_add(tmp, qgroup->qgroupid, (uintptr_t)qgroup, GFP_ATOMIC);
ret = ulist_add(tmp, qgroup->qgroupid,
(uintptr_t)qgroup, GFP_ATOMIC);
if (ret < 0)
goto unlock;
ULIST_ITER_INIT(&uiter);
while ((unode = ulist_next(tmp, &uiter))) {
struct btrfs_qgroup *qg;
Expand All @@ -1305,8 +1313,10 @@ int btrfs_qgroup_account_ref(struct btrfs_trans_handle *trans,
qg->tag = seq;

list_for_each_entry(glist, &qg->groups, next_group) {
ulist_add(tmp, glist->group->qgroupid,
(uintptr_t)glist->group, GFP_ATOMIC);
ret = ulist_add(tmp, glist->group->qgroupid,
(uintptr_t)glist->group, GFP_ATOMIC);
if (ret < 0)
goto unlock;
}
}

Expand All @@ -1324,7 +1334,10 @@ int btrfs_qgroup_account_ref(struct btrfs_trans_handle *trans,
continue;

ulist_reinit(tmp);
ulist_add(tmp, qg->qgroupid, (uintptr_t)qg, GFP_ATOMIC);
ret = ulist_add(tmp, qg->qgroupid,
(uintptr_t)qg, GFP_ATOMIC);
if (ret < 0)
goto unlock;
ULIST_ITER_INIT(&tmp_uiter);
while ((tmp_unode = ulist_next(tmp, &tmp_uiter))) {
struct btrfs_qgroup_list *glist;
Expand All @@ -1340,9 +1353,11 @@ int btrfs_qgroup_account_ref(struct btrfs_trans_handle *trans,
}

list_for_each_entry(glist, &qg->groups, next_group) {
ulist_add(tmp, glist->group->qgroupid,
(uintptr_t)glist->group,
GFP_ATOMIC);
ret = ulist_add(tmp, glist->group->qgroupid,
(uintptr_t)glist->group,
GFP_ATOMIC);
if (ret < 0)
goto unlock;
}
}
}
Expand Down Expand Up @@ -1607,7 +1622,10 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
ret = -ENOMEM;
goto out;
}
ulist_add(ulist, qgroup->qgroupid, (uintptr_t)qgroup, GFP_ATOMIC);
ret = ulist_add(ulist, qgroup->qgroupid,
(uintptr_t)qgroup, GFP_ATOMIC);
if (ret < 0)
goto out;
ULIST_ITER_INIT(&uiter);
while ((unode = ulist_next(ulist, &uiter))) {
struct btrfs_qgroup *qg;
Expand All @@ -1630,11 +1648,13 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
}

list_for_each_entry(glist, &qg->groups, next_group) {
ulist_add(ulist, glist->group->qgroupid,
(uintptr_t)glist->group, GFP_ATOMIC);
ret = ulist_add(ulist, glist->group->qgroupid,
(uintptr_t)glist->group, GFP_ATOMIC);
if (ret < 0)
goto out;
}
}

ret = 0;
/*
* no limits exceeded, now record the reservation into all qgroups
*/
Expand Down Expand Up @@ -1663,6 +1683,7 @@ void btrfs_qgroup_free(struct btrfs_root *root, u64 num_bytes)
struct ulist_node *unode;
struct ulist_iterator uiter;
u64 ref_root = root->root_key.objectid;
int ret = 0;

if (!is_fstree(ref_root))
return;
Expand All @@ -1685,7 +1706,10 @@ void btrfs_qgroup_free(struct btrfs_root *root, u64 num_bytes)
btrfs_std_error(fs_info, -ENOMEM);
goto out;
}
ulist_add(ulist, qgroup->qgroupid, (uintptr_t)qgroup, GFP_ATOMIC);
ret = ulist_add(ulist, qgroup->qgroupid,
(uintptr_t)qgroup, GFP_ATOMIC);
if (ret < 0)
goto out;
ULIST_ITER_INIT(&uiter);
while ((unode = ulist_next(ulist, &uiter))) {
struct btrfs_qgroup *qg;
Expand All @@ -1696,8 +1720,10 @@ void btrfs_qgroup_free(struct btrfs_root *root, u64 num_bytes)
qg->reserved -= num_bytes;

list_for_each_entry(glist, &qg->groups, next_group) {
ulist_add(ulist, glist->group->qgroupid,
(uintptr_t)glist->group, GFP_ATOMIC);
ret = ulist_add(ulist, glist->group->qgroupid,
(uintptr_t)glist->group, GFP_ATOMIC);
if (ret < 0)
goto out;
}
}

Expand Down

0 comments on commit 6d01fc4

Please sign in to comment.