Commit 7280feda authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

xfs: remove xfs_rmap_ag_owner and friends



Owner information for static fs metadata can be defined readonly at
build time because it never changes across filesystems.  This enables us
to reduce stack usage (particularly in scrub) because we can use the
statically defined oinfo structures.

Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
parent 66e3237e
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -414,7 +414,6 @@ xfs_ag_extend_space(
	struct aghdr_init_data	*id,
	xfs_extlen_t		len)
{
	struct xfs_owner_info	oinfo;
	struct xfs_buf		*bp;
	struct xfs_agi		*agi;
	struct xfs_agf		*agf;
@@ -448,17 +447,17 @@ xfs_ag_extend_space(
	/*
	 * Free the new space.
	 *
	 * XFS_RMAP_OWN_NULL is used here to tell the rmap btree that
	 * XFS_RMAP_OINFO_SKIP_UPDATE is used here to tell the rmap btree that
	 * this doesn't actually exist in the rmap btree.
	 */
	xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_NULL);
	error = xfs_rmap_free(tp, bp, id->agno,
				be32_to_cpu(agf->agf_length) - len,
				len, &oinfo);
				len, &XFS_RMAP_OINFO_SKIP_UPDATE);
	if (error)
		return error;

	return  xfs_free_extent(tp, XFS_AGB_TO_FSB(mp, id->agno,
					be32_to_cpu(agf->agf_length) - len),
				len, &oinfo, XFS_AG_RESV_NONE);
				len, &XFS_RMAP_OINFO_SKIP_UPDATE,
				XFS_AG_RESV_NONE);
}
+4 −5
Original line number Diff line number Diff line
@@ -1594,7 +1594,6 @@ xfs_alloc_ag_vextent_small(
	xfs_extlen_t	*flenp,	/* result length */
	int		*stat)	/* status: 0-freelist, 1-normal/none */
{
	struct xfs_owner_info	oinfo;
	int		error;
	xfs_agblock_t	fbno;
	xfs_extlen_t	flen;
@@ -1648,9 +1647,8 @@ xfs_alloc_ag_vextent_small(
			 * doesn't live in the free space, we need to clear
			 * out the OWN_AG rmap.
			 */
			xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_AG);
			error = xfs_rmap_free(args->tp, args->agbp, args->agno,
					fbno, 1, &oinfo);
					fbno, 1, &XFS_RMAP_OINFO_AG);
			if (error)
				goto error0;

@@ -2314,10 +2312,11 @@ xfs_alloc_fix_freelist(
	 * repair/rmap.c in xfsprogs for details.
	 */
	memset(&targs, 0, sizeof(targs));
	/* struct copy below */
	if (flags & XFS_ALLOC_FLAG_NORMAP)
		xfs_rmap_skip_owner_update(&targs.oinfo);
		targs.oinfo = XFS_RMAP_OINFO_SKIP_UPDATE;
	else
		xfs_rmap_ag_owner(&targs.oinfo, XFS_RMAP_OWN_AG);
		targs.oinfo = XFS_RMAP_OINFO_AG;
	while (!(flags & XFS_ALLOC_FLAG_NOSHRINK) && pag->pagf_flcount > need) {
		error = xfs_alloc_get_freelist(tp, agbp, &bno, 0);
		if (error)
+2 −2
Original line number Diff line number Diff line
@@ -564,7 +564,7 @@ __xfs_bmap_add_free(
	if (oinfo)
		new->xefi_oinfo = *oinfo;
	else
		xfs_rmap_skip_owner_update(&new->xefi_oinfo);
		new->xefi_oinfo = XFS_RMAP_OINFO_SKIP_UPDATE;
	new->xefi_skip_discard = skip_discard;
	trace_xfs_bmap_free_defer(tp->t_mountp,
			XFS_FSB_TO_AGNO(tp->t_mountp, bno), 0,
@@ -3453,7 +3453,7 @@ xfs_bmap_btalloc(
	args.tp = ap->tp;
	args.mp = mp;
	args.fsbno = ap->blkno;
	xfs_rmap_skip_owner_update(&args.oinfo);
	args.oinfo = XFS_RMAP_OINFO_SKIP_UPDATE;

	/* Trim the allocation back to the maximum an AG can fit. */
	args.maxlen = min(ap->length, mp->m_ag_max_usable);
+3 −5
Original line number Diff line number Diff line
@@ -641,7 +641,7 @@ xfs_ialloc_ag_alloc(
	args.tp = tp;
	args.mp = tp->t_mountp;
	args.fsbno = NULLFSBLOCK;
	xfs_rmap_ag_owner(&args.oinfo, XFS_RMAP_OWN_INODES);
	args.oinfo = XFS_RMAP_OINFO_INODES;

#ifdef DEBUG
	/* randomly do sparse inode allocations */
@@ -1849,14 +1849,12 @@ xfs_difree_inode_chunk(
	int				nextbit;
	xfs_agblock_t			agbno;
	int				contigblk;
	struct xfs_owner_info		oinfo;
	DECLARE_BITMAP(holemask, XFS_INOBT_HOLEMASK_BITS);
	xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_INODES);

	if (!xfs_inobt_issparse(rec->ir_holemask)) {
		/* not sparse, calculate extent info directly */
		xfs_bmap_add_free(tp, XFS_AGB_TO_FSB(mp, agno, sagbno),
				  mp->m_ialloc_blks, &oinfo);
				  mp->m_ialloc_blks, &XFS_RMAP_OINFO_INODES);
		return;
	}

@@ -1900,7 +1898,7 @@ xfs_difree_inode_chunk(
		ASSERT(agbno % mp->m_sb.sb_spino_align == 0);
		ASSERT(contigblk % mp->m_sb.sb_spino_align == 0);
		xfs_bmap_add_free(tp, XFS_AGB_TO_FSB(mp, agno, agbno),
				  contigblk, &oinfo);
				  contigblk, &XFS_RMAP_OINFO_INODES);

		/* reset range to current bit and carry on... */
		startidx = endidx = nextbit;
+2 −5
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ __xfs_inobt_alloc_block(
	memset(&args, 0, sizeof(args));
	args.tp = cur->bc_tp;
	args.mp = cur->bc_mp;
	xfs_rmap_ag_owner(&args.oinfo, XFS_RMAP_OWN_INOBT);
	args.oinfo = XFS_RMAP_OINFO_INOBT;
	args.fsbno = XFS_AGB_TO_FSB(args.mp, cur->bc_private.a.agno, sbno);
	args.minlen = 1;
	args.maxlen = 1;
@@ -136,12 +136,9 @@ __xfs_inobt_free_block(
	struct xfs_buf		*bp,
	enum xfs_ag_resv_type	resv)
{
	struct xfs_owner_info	oinfo;

	xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_INOBT);
	return xfs_free_extent(cur->bc_tp,
			XFS_DADDR_TO_FSB(cur->bc_mp, XFS_BUF_ADDR(bp)), 1,
			&oinfo, resv);
			&XFS_RMAP_OINFO_INOBT, resv);
}

STATIC int
Loading