summary refs log tree commit diff
path: root/fs/xfs/xfs_bmap_btree.c
diff options
context:
space:
mode:
authorLachlan McIlroy <lachlan@sgi.com>2008-06-27 13:33:11 +1000
committerNiv Sardi <xaiki@debian.org>2008-07-28 16:59:13 +1000
commit313b5c767a044c7a0db5e773cb7aea70383b2627 (patch)
tree5752234a32bbfacd7b0dd01365986af76396c18b /fs/xfs/xfs_bmap_btree.c
parentb877e3d37dda0154868a3c78f02f38a1ec14ce79 (diff)
downloadlinux-313b5c767a044c7a0db5e773cb7aea70383b2627.tar.gz
[XFS] Allow xfs_bmbt_split() to fallback to the lowspace allocator
algorithm

If xfs_bmbt_split() cannot find an AG with sufficient free space to
satisfy a full extent btree split then fall back to the lowspace allocator
algorithm.

SGI-PV: 983338

SGI-Modid: xfs-linux-melb:xfs-kern:31359a

Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: David Chinner <dgc@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_bmap_btree.c')
-rw-r--r--fs/xfs/xfs_bmap_btree.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index 1140cef4ba99..23efad29a5cd 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -1525,6 +1525,21 @@ xfs_bmbt_split(
 		XFS_BMBT_TRACE_CURSOR(cur, ERROR);
 		return error;
 	}
+	if (args.fsbno == NULLFSBLOCK && args.minleft) {
+		/*
+		 * Could not find an AG with enough free space to satisfy
+		 * a full btree split.  Try again without minleft and if
+		 * successful activate the lowspace algorithm.
+		 */
+		args.fsbno = 0;
+		args.type = XFS_ALLOCTYPE_FIRST_AG;
+		args.minleft = 0;
+		if ((error = xfs_alloc_vextent(&args))) {
+			XFS_BMBT_TRACE_CURSOR(cur, ERROR);
+			return error;
+		}
+		cur->bc_private.b.flist->xbf_low = 1;
+	}
 	if (args.fsbno == NULLFSBLOCK) {
 		XFS_BMBT_TRACE_CURSOR(cur, EXIT);
 		*stat = 0;