diff options
author | Wang Shilong <wangsl-fnst@cn.fujitsu.com> | 2013-03-06 06:51:47 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-03-14 14:57:29 -0400 |
commit | 720f1e2060138855b4a1b1e8aa642f9c7feb6750 (patch) | |
tree | 797d17e6d4e620e7842fc7ce26672ab17904c6d4 /fs | |
parent | 492104c866cb1b62a11393adccb477f5cd2c7768 (diff) |
Btrfs: return as soon as possible when edquot happens
If one of qgroup fails to reserve firstly, we should return immediately,
it is unnecessary to continue check.
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/qgroup.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index aee4b1cc3d98..5471e47d6559 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -1525,21 +1525,23 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes) | |||
1525 | 1525 | ||
1526 | if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) && | 1526 | if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) && |
1527 | qg->reserved + qg->rfer + num_bytes > | 1527 | qg->reserved + qg->rfer + num_bytes > |
1528 | qg->max_rfer) | 1528 | qg->max_rfer) { |
1529 | ret = -EDQUOT; | 1529 | ret = -EDQUOT; |
1530 | goto out; | ||
1531 | } | ||
1530 | 1532 | ||
1531 | if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) && | 1533 | if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) && |
1532 | qg->reserved + qg->excl + num_bytes > | 1534 | qg->reserved + qg->excl + num_bytes > |
1533 | qg->max_excl) | 1535 | qg->max_excl) { |
1534 | ret = -EDQUOT; | 1536 | ret = -EDQUOT; |
1537 | goto out; | ||
1538 | } | ||
1535 | 1539 | ||
1536 | list_for_each_entry(glist, &qg->groups, next_group) { | 1540 | list_for_each_entry(glist, &qg->groups, next_group) { |
1537 | ulist_add(ulist, glist->group->qgroupid, | 1541 | ulist_add(ulist, glist->group->qgroupid, |
1538 | (uintptr_t)glist->group, GFP_ATOMIC); | 1542 | (uintptr_t)glist->group, GFP_ATOMIC); |
1539 | } | 1543 | } |
1540 | } | 1544 | } |
1541 | if (ret) | ||
1542 | goto out; | ||
1543 | 1545 | ||
1544 | /* | 1546 | /* |
1545 | * no limits exceeded, now record the reservation into all qgroups | 1547 | * no limits exceeded, now record the reservation into all qgroups |