Commit 77953b97 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong
Browse files

xfs: add a name field to struct xfs_btree_ops



The btnum in struct xfs_btree_ops is often used for printing a symbolic
name for the btree.  Add a name field to the ops structure and use that
directly.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent e45ea364
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -273,9 +273,8 @@ xfs_alloc_complain_bad_rec(
	struct xfs_mount		*mp = cur->bc_mp;

	xfs_warn(mp,
		"%s Freespace BTree record corruption in AG %d detected at %pS!",
		cur->bc_btnum == XFS_BTNUM_BNO ? "Block" : "Size",
		cur->bc_ag.pag->pag_agno, fa);
		"%sbt record corruption in AG %d detected at %pS!",
		cur->bc_ops->name, cur->bc_ag.pag->pag_agno, fa);
	xfs_warn(mp,
		"start block 0x%x block count 0x%x", irec->ar_startblock,
		irec->ar_blockcount);
@@ -996,8 +995,7 @@ xfs_alloc_cur_check(
out:
	if (deactivate)
		cur->bc_flags &= ~XFS_BTREE_ALLOCBT_ACTIVE;
	trace_xfs_alloc_cur_check(args->mp, cur->bc_btnum, bno, len, diff,
				  *new);
	trace_xfs_alloc_cur_check(cur, bno, len, diff, *new);
	return 0;
}

+2 −0
Original line number Diff line number Diff line
@@ -468,6 +468,7 @@ xfs_allocbt_keys_contiguous(
}

const struct xfs_btree_ops xfs_bnobt_ops = {
	.name			= "bno",
	.type			= XFS_BTREE_TYPE_AG,

	.rec_len		= sizeof(xfs_alloc_rec_t),
@@ -497,6 +498,7 @@ const struct xfs_btree_ops xfs_bnobt_ops = {
};

const struct xfs_btree_ops xfs_cntbt_ops = {
	.name			= "cnt",
	.type			= XFS_BTREE_TYPE_AG,
	.geom_flags		= XFS_BTGEO_LASTREC_UPDATE,

+1 −0
Original line number Diff line number Diff line
@@ -517,6 +517,7 @@ xfs_bmbt_keys_contiguous(
}

const struct xfs_btree_ops xfs_bmbt_ops = {
	.name			= "bmap",
	.type			= XFS_BTREE_TYPE_INODE,

	.rec_len		= sizeof(xfs_bmbt_rec_t),
+4 −4
Original line number Diff line number Diff line
@@ -298,17 +298,17 @@ xfs_btree_check_ptr(
				level))
			return 0;
		xfs_err(cur->bc_mp,
"Inode %llu fork %d: Corrupt btree %d pointer at level %d index %d.",
"Inode %llu fork %d: Corrupt %sbt pointer at level %d index %d.",
				cur->bc_ino.ip->i_ino,
				cur->bc_ino.whichfork, cur->bc_btnum,
				cur->bc_ino.whichfork, cur->bc_ops->name,
				level, index);
	} else {
		if (xfs_btree_check_sptr(cur, be32_to_cpu((&ptr->s)[index]),
				level))
			return 0;
		xfs_err(cur->bc_mp,
"AG %u: Corrupt btree %d pointer at level %d index %d.",
				cur->bc_ag.pag->pag_agno, cur->bc_btnum,
"AG %u: Corrupt %sbt pointer at level %d index %d.",
				cur->bc_ag.pag->pag_agno, cur->bc_ops->name,
				level, index);
	}

+2 −0
Original line number Diff line number Diff line
@@ -123,6 +123,8 @@ enum xfs_btree_type {
};

struct xfs_btree_ops {
	const char		*name;

	/* Type of btree - AG-rooted or inode-rooted */
	enum xfs_btree_type	type;

Loading