Skip to content

Commit

Permalink
Btrfs: return as soon as possible when edquot happens
Browse files Browse the repository at this point in the history
If one of qgroup fails to reserve firstly, we should return immediately,
it is unnecessary to continue check.

Signed-off-by: Wang Shilong <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
Wang Shilong authored and Chris Mason committed Mar 14, 2013
1 parent 492104c commit 720f1e2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions fs/btrfs/qgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1525,21 +1525,23 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)

if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
qg->reserved + qg->rfer + num_bytes >
qg->max_rfer)
qg->max_rfer) {
ret = -EDQUOT;
goto out;
}

if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) &&
qg->reserved + qg->excl + num_bytes >
qg->max_excl)
qg->max_excl) {
ret = -EDQUOT;
goto out;
}

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

/*
* no limits exceeded, now record the reservation into all qgroups
Expand Down

0 comments on commit 720f1e2

Please sign in to comment.