Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 720f1e20 authored by Wang Shilong's avatar Wang Shilong Committed by Chris Mason
Browse files

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: default avatarWang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 492104c8
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -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