]> www.infradead.org Git - users/jedix/linux-maple.git/commit
Btrfs: test free space only for unclustered allocation
authorAlexandre Oliva <lxoliva@fsfla.org>
Mon, 12 Dec 2011 06:48:19 +0000 (04:48 -0200)
committerGuru Anbalagane <guru.anbalagane@oracle.com>
Fri, 27 Jan 2012 01:20:29 +0000 (17:20 -0800)
commit7c35f555ab649ba4752b4d3d9fa75f3c3a7f83f7
treeb93b27ab3a5e0184510fbe41dcedd3d15e309517
parentd41624e05e4dfa4e07b4be732615fd701ced8179
Btrfs: test free space only for unclustered allocation

Since the clustered allocation may be taking extents from a different
block group, there's no point in spin-locking and testing the current
block group free space before attempting to allocate space from a
cluster, even more so when we might refrain from even trying the
cluster in the current block group because, after the cluster was set
up, not enough free space remained.  Furthermore, cluster creation
attempts fail fast when the block group doesn't have enough free
space, so the test was completely superfluous.

I've move the free space test past the cluster allocation attempt,
where it is more useful, and arranged for a cluster in the current
block group to be released before trying an unclustered allocation,
when we reach the LOOP_NO_EMPTY_SIZE stage, so that the free space in
the cluster stands a chance of being combined with additional free
space in the block group so as to succeed in the allocation attempt.

Signed-off-by: Alexandre Oliva <oliva@lsd.ic.unicamp.br>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
(cherry picked from commit a5f6f719a5cd7caeee8ed8137cf3f94c3bbebc65)
fs/btrfs/extent-tree.c