public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] set minleft in xfs_bmbt_split()
@ 2008-06-24  2:09 Lachlan McIlroy
  2008-06-24  4:58 ` Dave Chinner
  0 siblings, 1 reply; 8+ messages in thread
From: Lachlan McIlroy @ 2008-06-24  2:09 UTC (permalink / raw)
  To: xfs-dev, xfs-oss

The bmap btree split code relies on a previous data extent allocation
(from xfs_bmap_btalloc()) to find an AG that has sufficient space
to perform a full btree split, when inserting the extent.  When
converting unwritten extents we don't allocate a data extent so a
btree split will be the first allocation.  In this case we need to
set minleft so the allocator will pick an AG that has space to
complete the split(s).

Lachlan

--- 2.6.x-agno2.orig/fs/xfs/xfs_bmap_btree.c
+++ 2.6.x-agno2/fs/xfs/xfs_bmap_btree.c
@@ -1493,12 +1493,20 @@ xfs_bmbt_split(
 	left = XFS_BUF_TO_BMBT_BLOCK(lbp);
 	args.fsbno = cur->bc_private.b.firstblock;
 	args.firstblock = args.fsbno;
+	args.minleft = 0;
 	if (args.fsbno == NULLFSBLOCK) {
 		args.fsbno = lbno;
 		args.type = XFS_ALLOCTYPE_START_BNO;
+		/*
+		 * Make sure there is sufficient room left in the AG to
+		 * complete a full tree split for an extent insert.  If
+		 * we are converting the middle part of an extent then
+		 * we may need space for two tree splits.
+		 */
+		args.minleft = xfs_trans_get_block_res(args.tp);
 	} else
 		args.type = XFS_ALLOCTYPE_NEAR_BNO;
-	args.mod = args.minleft = args.alignment = args.total = args.isfl =
+	args.mod = args.alignment = args.total = args.isfl =
 		args.userdata = args.minalignslop = 0;
 	args.minlen = args.maxlen = args.prod = 1;
 	args.wasdel = cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL;

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-06-24 22:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-24  2:09 [PATCH 1/2] set minleft in xfs_bmbt_split() Lachlan McIlroy
2008-06-24  4:58 ` Dave Chinner
2008-06-24  5:22   ` Lachlan McIlroy
2008-06-24  5:25     ` Dave Chinner
2008-06-24  6:16       ` Lachlan McIlroy
2008-06-24  6:25         ` Dave Chinner
2008-06-24  7:10           ` Lachlan McIlroy
2008-06-24 22:45             ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox