Skip to content

Commit 410d17f

Browse files
Christoph Hellwigdjwong
authored andcommitted
xfs: tune down agno asserts in the bmap code
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: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
1 parent 8ee9fdb commit 410d17f

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -798,9 +798,7 @@ xfs_bmap_extents_to_btree(
798798
*/
799799
ASSERT(args.fsbno != NULLFSBLOCK);
800800
ASSERT(*firstblock == NULLFSBLOCK ||
801-
args.agno == XFS_FSB_TO_AGNO(mp, *firstblock) ||
802-
(dfops->dop_low &&
803-
args.agno > XFS_FSB_TO_AGNO(mp, *firstblock)));
801+
args.agno >= XFS_FSB_TO_AGNO(mp, *firstblock));
804802
*firstblock = cur->bc_private.b.firstblock = args.fsbno;
805803
cur->bc_private.b.allocated++;
806804
ip->i_d.di_nblocks++;
@@ -3822,17 +3820,13 @@ xfs_bmap_btalloc(
38223820
* the first block that was allocated.
38233821
*/
38243822
ASSERT(*ap->firstblock == NULLFSBLOCK ||
3825-
XFS_FSB_TO_AGNO(mp, *ap->firstblock) ==
3826-
XFS_FSB_TO_AGNO(mp, args.fsbno) ||
3827-
(ap->dfops->dop_low &&
3828-
XFS_FSB_TO_AGNO(mp, *ap->firstblock) <
3829-
XFS_FSB_TO_AGNO(mp, args.fsbno)));
3823+
XFS_FSB_TO_AGNO(mp, *ap->firstblock) <=
3824+
XFS_FSB_TO_AGNO(mp, args.fsbno));
38303825

38313826
ap->blkno = args.fsbno;
38323827
if (*ap->firstblock == NULLFSBLOCK)
38333828
*ap->firstblock = args.fsbno;
3834-
ASSERT(nullfb || fb_agno == args.agno ||
3835-
(ap->dfops->dop_low && fb_agno < args.agno));
3829+
ASSERT(nullfb || fb_agno <= args.agno);
38363830
ap->length = args.len;
38373831
if (!(ap->flags & XFS_BMAPI_COWFORK))
38383832
ap->ip->i_d.di_nblocks += args.len;
@@ -4754,13 +4748,9 @@ xfs_bmapi_write(
47544748
if (bma.cur) {
47554749
if (!error) {
47564750
ASSERT(*firstblock == NULLFSBLOCK ||
4757-
XFS_FSB_TO_AGNO(mp, *firstblock) ==
4751+
XFS_FSB_TO_AGNO(mp, *firstblock) <=
47584752
XFS_FSB_TO_AGNO(mp,
4759-
bma.cur->bc_private.b.firstblock) ||
4760-
(dfops->dop_low &&
4761-
XFS_FSB_TO_AGNO(mp, *firstblock) <
4762-
XFS_FSB_TO_AGNO(mp,
4763-
bma.cur->bc_private.b.firstblock)));
4753+
bma.cur->bc_private.b.firstblock));
47644754
*firstblock = bma.cur->bc_private.b.firstblock;
47654755
}
47664756
xfs_btree_del_cursor(bma.cur,

0 commit comments

Comments
 (0)