Commit 5d834e1a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Greg Kroah-Hartman

xfs: tune down agno asserts in the bmap code

commit 410d17f6 upstream.

In various places we currently assert that xfs_bmap_btalloc allocates
from the same as the firstblock value passed in, unless it's either
NULLAGNO or the dop_low flag is set.  But the reflink code does not
fully follow this convention as it passes in firstblock purely as
a hint for the allocator without actually having previous allocations
in the transaction, and without having a minleft check on the current
AG, leading to the assert firing on a very full and heavily used
file system.  As even the reflink code only allocates from equal or
higher AGs for now we can simply the check to always allow for equal
or higher AGs.

Note that we need to eventually split the two meanings of the firstblock
value.  At that point we can also allow the reflink code to allocate
from any AG instead of limiting it in any way.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 854a9bf0
...@@ -804,9 +804,7 @@ xfs_bmap_extents_to_btree( ...@@ -804,9 +804,7 @@ xfs_bmap_extents_to_btree(
*/ */
ASSERT(args.fsbno != NULLFSBLOCK); ASSERT(args.fsbno != NULLFSBLOCK);
ASSERT(*firstblock == NULLFSBLOCK || ASSERT(*firstblock == NULLFSBLOCK ||
args.agno == XFS_FSB_TO_AGNO(mp, *firstblock) || args.agno >= XFS_FSB_TO_AGNO(mp, *firstblock));
(dfops->dop_low &&
args.agno > XFS_FSB_TO_AGNO(mp, *firstblock)));
*firstblock = cur->bc_private.b.firstblock = args.fsbno; *firstblock = cur->bc_private.b.firstblock = args.fsbno;
cur->bc_private.b.allocated++; cur->bc_private.b.allocated++;
ip->i_d.di_nblocks++; ip->i_d.di_nblocks++;
...@@ -3832,17 +3830,13 @@ xfs_bmap_btalloc( ...@@ -3832,17 +3830,13 @@ xfs_bmap_btalloc(
* the first block that was allocated. * the first block that was allocated.
*/ */
ASSERT(*ap->firstblock == NULLFSBLOCK || ASSERT(*ap->firstblock == NULLFSBLOCK ||
XFS_FSB_TO_AGNO(mp, *ap->firstblock) == XFS_FSB_TO_AGNO(mp, *ap->firstblock) <=
XFS_FSB_TO_AGNO(mp, args.fsbno) || XFS_FSB_TO_AGNO(mp, args.fsbno));
(ap->dfops->dop_low &&
XFS_FSB_TO_AGNO(mp, *ap->firstblock) <
XFS_FSB_TO_AGNO(mp, args.fsbno)));
ap->blkno = args.fsbno; ap->blkno = args.fsbno;
if (*ap->firstblock == NULLFSBLOCK) if (*ap->firstblock == NULLFSBLOCK)
*ap->firstblock = args.fsbno; *ap->firstblock = args.fsbno;
ASSERT(nullfb || fb_agno == args.agno || ASSERT(nullfb || fb_agno <= args.agno);
(ap->dfops->dop_low && fb_agno < args.agno));
ap->length = args.len; ap->length = args.len;
if (!(ap->flags & XFS_BMAPI_COWFORK)) if (!(ap->flags & XFS_BMAPI_COWFORK))
ap->ip->i_d.di_nblocks += args.len; ap->ip->i_d.di_nblocks += args.len;
...@@ -4764,13 +4758,9 @@ xfs_bmapi_write( ...@@ -4764,13 +4758,9 @@ xfs_bmapi_write(
if (bma.cur) { if (bma.cur) {
if (!error) { if (!error) {
ASSERT(*firstblock == NULLFSBLOCK || ASSERT(*firstblock == NULLFSBLOCK ||
XFS_FSB_TO_AGNO(mp, *firstblock) == XFS_FSB_TO_AGNO(mp, *firstblock) <=
XFS_FSB_TO_AGNO(mp, XFS_FSB_TO_AGNO(mp,
bma.cur->bc_private.b.firstblock) || bma.cur->bc_private.b.firstblock));
(dfops->dop_low &&
XFS_FSB_TO_AGNO(mp, *firstblock) <
XFS_FSB_TO_AGNO(mp,
bma.cur->bc_private.b.firstblock)));
*firstblock = bma.cur->bc_private.b.firstblock; *firstblock = bma.cur->bc_private.b.firstblock;
} }
xfs_btree_del_cursor(bma.cur, xfs_btree_del_cursor(bma.cur,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment