[Top] [All Lists]

Re: [PATCH 1/2] set minleft in xfs_bmbt_split()

To: Lachlan McIlroy <lachlan@xxxxxxx>
Subject: Re: [PATCH 1/2] set minleft in xfs_bmbt_split()
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Wed, 25 Jun 2008 08:45:33 +1000
Cc: xfs-dev <xfs-dev@xxxxxxx>, xfs-oss <xfs@xxxxxxxxxxx>
In-reply-to: <48609DD0.80604@xxxxxxx>
Mail-followup-to: Lachlan McIlroy <lachlan@xxxxxxx>, xfs-dev <xfs-dev@xxxxxxx>, xfs-oss <xfs@xxxxxxxxxxx>
References: <48605744.8070400@xxxxxxx> <20080624045841.GN16257@xxxxxxxxxxxxxxxxxxxxx> <4860847B.7070703@xxxxxxx> <20080624052556.GR16257@xxxxxxxxxxxxxxxxxxxxx> <48609152.7050208@xxxxxxx> <20080624062551.GU16257@xxxxxxxxxxxxxxxxxxxxx> <48609DD0.80604@xxxxxxx>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.17+20080114 (2008-01-14)
On Tue, Jun 24, 2008 at 05:10:08PM +1000, Lachlan McIlroy wrote:


> This is the fallback code.  Do you think I also need to make the same
> minleft change above and this change below to xfs_bmbt_newroot()?
> I'm inclined to change both xfs_bmbt_split() and xfs_bmbt_newroot()
> and keep them as similar as possible.  For the newroot case we know we
> only need one block and we know there will be no more allocations for
> this insert so using 'minleft = xfs_trans_get_block_res()' is silly but
> on the other hand we don't have any other way to detect the double
> insert case.

OTOH, if we do a double insert, is it even possible for that to
trigger a full tree double split? i.e. after the first split that
allocates a new root, the new root will only be partially full, so
we should be able to insert there in all cases without a split on
the second insert. The case of a second split occurring is when the
second insert goes into a different leaf block to the first insert
and that needs splitting as well. If it's a completely different
path up to the root of the tree, then the place where they will join
is the old root block (remember that the new root block contains the
old contents of the inode fork - it's not really a split but a move
operation) and so a second newroot allocation will not be necessary.
Hence I think that the newroot allocation will never be triggered
twice in the unwritten extent double insert case.

*However*, if the newroot function is first allocation, it still may
need to take into account the second insert which may split a leaf
as well. I don't think this can happen - the only time we'll do a
newroot allocation without having first done an allocation in
xfs_bmbt_split() is when adding an attribute fork and we need to
push the data fork root out to make room for the attr fork.  In this
case, we don't have a split occurring at all and so we only need one
block for the new root.

Hence I don't think the newroot case needs to reserve space for
entire splits or multiple splits at all - if that is going to happen
it should already have been taken into account by earlier allocations...

> --- 2.6.x-agno2.orig/fs/xfs/xfs_bmap_btree.c
> +++ 2.6.x-agno2/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 will 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;
> +     }

Yes, that change makes sense for the split case.


Dave Chinner

<Prev in Thread] Current Thread [Next in Thread>