Commit 681cb87b authored by Chandan Babu R's avatar Chandan Babu R
Browse files

Merge tag 'btree-geometry-in-ops-6.9_2024-02-23' of...

Merge tag 'btree-geometry-in-ops-6.9_2024-02-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux

 into xfs-6.9-mergeC

xfs: move btree geometry to ops struct

This patchset prepares the generic btree code to allow for the creation
of new btree types outside of libxfs.  The end goal here is for online
fsck to be able to create its own in-memory btrees that will be used to
improve the performance (and reduce the memory requirements of) the
refcount btree.

To enable this, I decided that the btree ops structure is the ideal
place to encode all of the geometry information about a btree. The btree
ops struture already contains the buffer ops (and hence the btree block
magic numbers) as well as the key and record sizes, so it doesn't seem
all that farfetched to encode the XFS_BTREE_ flags that determine the
geometry (ROOT_IN_INODE, LONG_PTRS, etc).

The rest of the patchset cleans up the btree functions that initialize
btree blocks and btree buffers.  The bulk of this work is to replace
btree geometry related function call arguments with a single pointer to
the ops structure, and then clean up everything else around that.  As a
side effect, we rename the functions.

Later, Christoph Hellwig and I merged together a bunch more cleanups
that he wanted to do for a while.  All the btree geometry information is
now in the btree ops structure, we've created an explicit btree type
(ag, inode, mem) and moved the per-btree type information to a separate
union.

Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>

* tag 'btree-geometry-in-ops-6.9_2024-02-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux:
  xfs: create predicate to determine if cursor is at inode root level
  xfs: split the per-btree union in struct xfs_btree_cur
  xfs: split out a btree type from the btree ops geometry flags
  xfs: store the btree pointer length in struct xfs_btree_ops
  xfs: factor out a btree block owner check
  xfs: factor out a xfs_btree_owner helper
  xfs: move the btree stats offset into struct btree_ops
  xfs: move lru refs to the btree ops structure
  xfs: set btree block buffer ops in _init_buf
  xfs: remove the unnecessary daddr paramter to _init_block
  xfs: btree convert xfs_btree_init_block to xfs_btree_init_buf calls
  xfs: rename btree block/buffer init functions
  xfs: initialize btree blocks using btree_ops structure
  xfs: extern some btree ops structures
  xfs: turn the allocbt cursor active field into a btree flag
  xfs: consolidate the xfs_alloc_lookup_* helpers
  xfs: remove bc_ino.flags
  xfs: encode the btree geometry flags in the btree ops structure
  xfs: fix imprecise logic in xchk_btree_check_block_owner
  xfs: drop XFS_BTREE_CRC_BLOCKS
  xfs: set the btree cursor bc_ops in xfs_btree_alloc_cursor
  xfs: consolidate btree block allocation tracepoints
  xfs: consolidate btree block freeing tracepoints
parents 5d1bd19d f73def90
Loading
Loading
Loading
Loading
+13 −20
Original line number Diff line number Diff line
@@ -492,7 +492,7 @@ xfs_btroot_init(
	struct xfs_buf		*bp,
	struct aghdr_init_data	*id)
{
	xfs_btree_init_block(mp, bp, id->type, 0, 0, id->agno);
	xfs_btree_init_buf(mp, bp, id->bc_ops, 0, 0, id->agno);
}

/* Finish initializing a free space btree. */
@@ -550,7 +550,7 @@ xfs_freesp_init_recs(
}

/*
 * Alloc btree root block init functions
 * bnobt/cntbt btree root block init functions
 */
static void
xfs_bnoroot_init(
@@ -558,17 +558,7 @@ xfs_bnoroot_init(
	struct xfs_buf		*bp,
	struct aghdr_init_data	*id)
{
	xfs_btree_init_block(mp, bp, XFS_BTNUM_BNO, 0, 0, id->agno);
	xfs_freesp_init_recs(mp, bp, id);
}

static void
xfs_cntroot_init(
	struct xfs_mount	*mp,
	struct xfs_buf		*bp,
	struct aghdr_init_data	*id)
{
	xfs_btree_init_block(mp, bp, XFS_BTNUM_CNT, 0, 0, id->agno);
	xfs_btree_init_buf(mp, bp, id->bc_ops, 0, 0, id->agno);
	xfs_freesp_init_recs(mp, bp, id);
}

@@ -584,7 +574,7 @@ xfs_rmaproot_init(
	struct xfs_btree_block	*block = XFS_BUF_TO_BLOCK(bp);
	struct xfs_rmap_rec	*rrec;

	xfs_btree_init_block(mp, bp, XFS_BTNUM_RMAP, 0, 4, id->agno);
	xfs_btree_init_buf(mp, bp, id->bc_ops, 0, 4, id->agno);

	/*
	 * mark the AG header regions as static metadata The BNO
@@ -797,7 +787,7 @@ struct xfs_aghdr_grow_data {
	size_t			numblks;
	const struct xfs_buf_ops *ops;
	aghdr_init_work_f	work;
	xfs_btnum_t		type;
	const struct xfs_btree_ops *bc_ops;
	bool			need_init;
};

@@ -851,13 +841,15 @@ xfs_ag_init_headers(
		.numblks = BTOBB(mp->m_sb.sb_blocksize),
		.ops = &xfs_bnobt_buf_ops,
		.work = &xfs_bnoroot_init,
		.bc_ops = &xfs_bnobt_ops,
		.need_init = true
	},
	{ /* CNT root block */
		.daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_CNT_BLOCK(mp)),
		.numblks = BTOBB(mp->m_sb.sb_blocksize),
		.ops = &xfs_cntbt_buf_ops,
		.work = &xfs_cntroot_init,
		.work = &xfs_bnoroot_init,
		.bc_ops = &xfs_cntbt_ops,
		.need_init = true
	},
	{ /* INO root block */
@@ -865,7 +857,7 @@ xfs_ag_init_headers(
		.numblks = BTOBB(mp->m_sb.sb_blocksize),
		.ops = &xfs_inobt_buf_ops,
		.work = &xfs_btroot_init,
		.type = XFS_BTNUM_INO,
		.bc_ops = &xfs_inobt_ops,
		.need_init = true
	},
	{ /* FINO root block */
@@ -873,7 +865,7 @@ xfs_ag_init_headers(
		.numblks = BTOBB(mp->m_sb.sb_blocksize),
		.ops = &xfs_finobt_buf_ops,
		.work = &xfs_btroot_init,
		.type = XFS_BTNUM_FINO,
		.bc_ops = &xfs_finobt_ops,
		.need_init =  xfs_has_finobt(mp)
	},
	{ /* RMAP root block */
@@ -881,6 +873,7 @@ xfs_ag_init_headers(
		.numblks = BTOBB(mp->m_sb.sb_blocksize),
		.ops = &xfs_rmapbt_buf_ops,
		.work = &xfs_rmaproot_init,
		.bc_ops = &xfs_rmapbt_ops,
		.need_init = xfs_has_rmapbt(mp)
	},
	{ /* REFC root block */
@@ -888,7 +881,7 @@ xfs_ag_init_headers(
		.numblks = BTOBB(mp->m_sb.sb_blocksize),
		.ops = &xfs_refcountbt_buf_ops,
		.work = &xfs_btroot_init,
		.type = XFS_BTNUM_REFC,
		.bc_ops = &xfs_refcountbt_ops,
		.need_init = xfs_has_reflink(mp)
	},
	{ /* NULL terminating block */
@@ -906,7 +899,7 @@ xfs_ag_init_headers(

		id->daddr = dp->daddr;
		id->numblks = dp->numblks;
		id->type = dp->type;
		id->bc_ops = dp->bc_ops;
		error = xfs_ag_init_hdr(mp, id, dp->work, dp->ops);
		if (error)
			break;
+1 −1
Original line number Diff line number Diff line
@@ -331,7 +331,7 @@ struct aghdr_init_data {
	/* per header data */
	xfs_daddr_t		daddr;		/* header location */
	size_t			numblks;	/* size of header */
	xfs_btnum_t		type;		/* type of btree root block */
	const struct xfs_btree_ops *bc_ops;	/* btree ops */
};

int xfs_ag_init_headers(struct xfs_mount *mp, struct aghdr_init_data *id);
+29 −25
Original line number Diff line number Diff line
@@ -151,23 +151,38 @@ xfs_alloc_ag_max_usable(
	return mp->m_sb.sb_agblocks - blocks;
}


static int
xfs_alloc_lookup(
	struct xfs_btree_cur	*cur,
	xfs_lookup_t		dir,
	xfs_agblock_t		bno,
	xfs_extlen_t		len,
	int			*stat)
{
	int			error;

	cur->bc_rec.a.ar_startblock = bno;
	cur->bc_rec.a.ar_blockcount = len;
	error = xfs_btree_lookup(cur, dir, stat);
	if (*stat == 1)
		cur->bc_flags |= XFS_BTREE_ALLOCBT_ACTIVE;
	else
		cur->bc_flags &= ~XFS_BTREE_ALLOCBT_ACTIVE;
	return error;
}

/*
 * Lookup the record equal to [bno, len] in the btree given by cur.
 */
STATIC int				/* error */
static inline int				/* error */
xfs_alloc_lookup_eq(
	struct xfs_btree_cur	*cur,	/* btree cursor */
	xfs_agblock_t		bno,	/* starting block of extent */
	xfs_extlen_t		len,	/* length of extent */
	int			*stat)	/* success/failure */
{
	int			error;

	cur->bc_rec.a.ar_startblock = bno;
	cur->bc_rec.a.ar_blockcount = len;
	error = xfs_btree_lookup(cur, XFS_LOOKUP_EQ, stat);
	cur->bc_ag.abt.active = (*stat == 1);
	return error;
	return xfs_alloc_lookup(cur, XFS_LOOKUP_EQ, bno, len, stat);
}

/*
@@ -181,13 +196,7 @@ xfs_alloc_lookup_ge(
	xfs_extlen_t		len,	/* length of extent */
	int			*stat)	/* success/failure */
{
	int			error;

	cur->bc_rec.a.ar_startblock = bno;
	cur->bc_rec.a.ar_blockcount = len;
	error = xfs_btree_lookup(cur, XFS_LOOKUP_GE, stat);
	cur->bc_ag.abt.active = (*stat == 1);
	return error;
	return xfs_alloc_lookup(cur, XFS_LOOKUP_GE, bno, len, stat);
}

/*
@@ -201,19 +210,14 @@ xfs_alloc_lookup_le(
	xfs_extlen_t		len,	/* length of extent */
	int			*stat)	/* success/failure */
{
	int			error;
	cur->bc_rec.a.ar_startblock = bno;
	cur->bc_rec.a.ar_blockcount = len;
	error = xfs_btree_lookup(cur, XFS_LOOKUP_LE, stat);
	cur->bc_ag.abt.active = (*stat == 1);
	return error;
	return xfs_alloc_lookup(cur, XFS_LOOKUP_LE, bno, len, stat);
}

static inline bool
xfs_alloc_cur_active(
	struct xfs_btree_cur	*cur)
{
	return cur && cur->bc_ag.abt.active;
	return cur && (cur->bc_flags & XFS_BTREE_ALLOCBT_ACTIVE);
}

/*
@@ -991,7 +995,7 @@ xfs_alloc_cur_check(
		deactivate = true;
out:
	if (deactivate)
		cur->bc_ag.abt.active = false;
		cur->bc_flags &= ~XFS_BTREE_ALLOCBT_ACTIVE;
	trace_xfs_alloc_cur_check(args->mp, cur->bc_btnum, bno, len, diff,
				  *new);
	return 0;
@@ -1366,7 +1370,7 @@ xfs_alloc_walk_iter(
		if (error)
			return error;
		if (i == 0)
			cur->bc_ag.abt.active = false;
			cur->bc_flags &= ~XFS_BTREE_ALLOCBT_ACTIVE;

		if (count > 0)
			count--;
@@ -1480,7 +1484,7 @@ xfs_alloc_ag_vextent_locality(
		if (error)
			return error;
		if (i) {
			acur->cnt->bc_ag.abt.active = true;
			acur->cnt->bc_flags |= XFS_BTREE_ALLOCBT_ACTIVE;
			fbcur = acur->cnt;
			fbinc = false;
		}
+20 −19
Original line number Diff line number Diff line
@@ -454,9 +454,15 @@ xfs_allocbt_keys_contiguous(
				 be32_to_cpu(key2->alloc.ar_startblock));
}

static const struct xfs_btree_ops xfs_bnobt_ops = {
const struct xfs_btree_ops xfs_bnobt_ops = {
	.type			= XFS_BTREE_TYPE_AG,

	.rec_len		= sizeof(xfs_alloc_rec_t),
	.key_len		= sizeof(xfs_alloc_key_t),
	.ptr_len		= XFS_BTREE_SHORT_PTR_LEN,

	.lru_refs		= XFS_ALLOC_BTREE_REF,
	.statoff		= XFS_STATS_CALC_INDEX(xs_abtb_2),

	.dup_cursor		= xfs_allocbt_dup_cursor,
	.set_root		= xfs_allocbt_set_root,
@@ -477,9 +483,16 @@ static const struct xfs_btree_ops xfs_bnobt_ops = {
	.keys_contiguous	= xfs_allocbt_keys_contiguous,
};

static const struct xfs_btree_ops xfs_cntbt_ops = {
const struct xfs_btree_ops xfs_cntbt_ops = {
	.type			= XFS_BTREE_TYPE_AG,
	.geom_flags		= XFS_BTGEO_LASTREC_UPDATE,

	.rec_len		= sizeof(xfs_alloc_rec_t),
	.key_len		= sizeof(xfs_alloc_key_t),
	.ptr_len		= XFS_BTREE_SHORT_PTR_LEN,

	.lru_refs		= XFS_ALLOC_BTREE_REF,
	.statoff		= XFS_STATS_CALC_INDEX(xs_abtc_2),

	.dup_cursor		= xfs_allocbt_dup_cursor,
	.set_root		= xfs_allocbt_set_root,
@@ -508,28 +521,17 @@ xfs_allocbt_init_common(
	struct xfs_perag	*pag,
	xfs_btnum_t		btnum)
{
	const struct xfs_btree_ops *ops = &xfs_bnobt_ops;
	struct xfs_btree_cur	*cur;

	ASSERT(btnum == XFS_BTNUM_BNO || btnum == XFS_BTNUM_CNT);

	cur = xfs_btree_alloc_cursor(mp, tp, btnum, mp->m_alloc_maxlevels,
			xfs_allocbt_cur_cache);
	cur->bc_ag.abt.active = false;

	if (btnum == XFS_BTNUM_CNT) {
		cur->bc_ops = &xfs_cntbt_ops;
		cur->bc_statoff = XFS_STATS_CALC_INDEX(xs_abtc_2);
		cur->bc_flags = XFS_BTREE_LASTREC_UPDATE;
	} else {
		cur->bc_ops = &xfs_bnobt_ops;
		cur->bc_statoff = XFS_STATS_CALC_INDEX(xs_abtb_2);
	}
	if (btnum == XFS_BTNUM_CNT)
		ops = &xfs_cntbt_ops;

	cur = xfs_btree_alloc_cursor(mp, tp, btnum, ops, mp->m_alloc_maxlevels,
			xfs_allocbt_cur_cache);
	cur->bc_ag.pag = xfs_perag_hold(pag);

	if (xfs_has_crc(mp))
		cur->bc_flags |= XFS_BTREE_CRC_BLOCKS;

	return cur;
}

@@ -595,7 +597,6 @@ xfs_allocbt_commit_staged_btree(
	if (cur->bc_btnum == XFS_BTNUM_BNO) {
		xfs_btree_commit_afakeroot(cur, tp, agbp, &xfs_bnobt_ops);
	} else {
		cur->bc_flags |= XFS_BTREE_LASTREC_UPDATE;
		xfs_btree_commit_afakeroot(cur, tp, agbp, &xfs_cntbt_ops);
	}
}
+22 −36
Original line number Diff line number Diff line
@@ -644,14 +644,13 @@ xfs_bmap_extents_to_btree(
	 * Fill in the root.
	 */
	block = ifp->if_broot;
	xfs_btree_init_block_int(mp, block, XFS_BUF_DADDR_NULL,
				 XFS_BTNUM_BMAP, 1, 1, ip->i_ino,
				 XFS_BTREE_LONG_PTRS);
	xfs_bmbt_init_block(ip, block, NULL, 1, 1);
	/*
	 * Need a cursor.  Can't allocate until bb_level is filled in.
	 */
	cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
	cur->bc_ino.flags = wasdel ? XFS_BTCUR_BMBT_WASDEL : 0;
	if (wasdel)
		cur->bc_flags |= XFS_BTREE_BMBT_WASDEL;
	/*
	 * Convert to a btree with two levels, one record in root.
	 */
@@ -677,7 +676,7 @@ xfs_bmap_extents_to_btree(
		goto out_root_realloc;
	}

	cur->bc_ino.allocated++;
	cur->bc_bmap.allocated++;
	ip->i_nblocks++;
	xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, 1L);
	error = xfs_trans_get_buf(tp, mp->m_ddev_targp,
@@ -689,11 +688,8 @@ xfs_bmap_extents_to_btree(
	/*
	 * Fill in the child block.
	 */
	abp->b_ops = &xfs_bmbt_buf_ops;
	ablock = XFS_BUF_TO_BLOCK(abp);
	xfs_btree_init_block_int(mp, ablock, xfs_buf_daddr(abp),
				XFS_BTNUM_BMAP, 0, 0, ip->i_ino,
				XFS_BTREE_LONG_PTRS);
	xfs_bmbt_init_block(ip, ablock, abp, 0, 0);

	for_each_xfs_iext(ifp, &icur, &rec) {
		if (isnullstartblock(rec.br_startblock))
@@ -898,7 +894,7 @@ xfs_bmap_add_attrfork_btree(
			xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
			return -ENOSPC;
		}
		cur->bc_ino.allocated = 0;
		cur->bc_bmap.allocated = 0;
		xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
	}
	return 0;
@@ -926,7 +922,7 @@ xfs_bmap_add_attrfork_extents(
	error = xfs_bmap_extents_to_btree(tp, ip, &cur, 0, flags,
					  XFS_DATA_FORK);
	if (cur) {
		cur->bc_ino.allocated = 0;
		cur->bc_bmap.allocated = 0;
		xfs_btree_del_cursor(cur, error);
	}
	return error;
@@ -1449,8 +1445,7 @@ xfs_bmap_add_extent_delay_real(

	ASSERT(whichfork != XFS_ATTR_FORK);
	ASSERT(!isnullstartblock(new->br_startblock));
	ASSERT(!bma->cur ||
	       (bma->cur->bc_ino.flags & XFS_BTCUR_BMBT_WASDEL));
	ASSERT(!bma->cur || (bma->cur->bc_flags & XFS_BTREE_BMBT_WASDEL));

	XFS_STATS_INC(mp, xs_add_exlist);

@@ -1751,7 +1746,7 @@ xfs_bmap_add_extent_delay_real(
		temp = PREV.br_blockcount - new->br_blockcount;
		da_new = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(bma->ip, temp),
			startblockval(PREV.br_startblock) -
			(bma->cur ? bma->cur->bc_ino.allocated : 0));
			(bma->cur ? bma->cur->bc_bmap.allocated : 0));

		PREV.br_startoff = new_endoff;
		PREV.br_blockcount = temp;
@@ -1841,7 +1836,7 @@ xfs_bmap_add_extent_delay_real(
		temp = PREV.br_blockcount - new->br_blockcount;
		da_new = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(bma->ip, temp),
			startblockval(PREV.br_startblock) -
			(bma->cur ? bma->cur->bc_ino.allocated : 0));
			(bma->cur ? bma->cur->bc_bmap.allocated : 0));

		PREV.br_startblock = nullstartblock(da_new);
		PREV.br_blockcount = temp;
@@ -1964,8 +1959,8 @@ xfs_bmap_add_extent_delay_real(
		xfs_mod_delalloc(mp, (int64_t)da_new - da_old);

	if (bma->cur) {
		da_new += bma->cur->bc_ino.allocated;
		bma->cur->bc_ino.allocated = 0;
		da_new += bma->cur->bc_bmap.allocated;
		bma->cur->bc_bmap.allocated = 0;
	}

	/* adjust for changes in reserved delayed indirect blocks */
@@ -2530,7 +2525,7 @@ xfs_bmap_add_extent_unwritten_real(

	/* clear out the allocated field, done with it now in any case. */
	if (cur) {
		cur->bc_ino.allocated = 0;
		cur->bc_bmap.allocated = 0;
		*curp = cur;
	}

@@ -2709,7 +2704,7 @@ xfs_bmap_add_extent_hole_real(
	struct xfs_bmbt_irec	old;

	ASSERT(!isnullstartblock(new->br_startblock));
	ASSERT(!cur || !(cur->bc_ino.flags & XFS_BTCUR_BMBT_WASDEL));
	ASSERT(!cur || !(cur->bc_flags & XFS_BTREE_BMBT_WASDEL));

	XFS_STATS_INC(mp, xs_add_exlist);

@@ -2918,7 +2913,7 @@ xfs_bmap_add_extent_hole_real(

	/* clear out the allocated field, done with it now in any case. */
	if (cur)
		cur->bc_ino.allocated = 0;
		cur->bc_bmap.allocated = 0;

	xfs_bmap_check_leaf_extents(cur, ip, whichfork);
done:
@@ -4229,9 +4224,8 @@ xfs_bmapi_allocate(
	 */
	bma->nallocs++;

	if (bma->cur)
		bma->cur->bc_ino.flags =
			bma->wasdel ? XFS_BTCUR_BMBT_WASDEL : 0;
	if (bma->cur && bma->wasdel)
		bma->cur->bc_flags |= XFS_BTREE_BMBT_WASDEL;

	bma->got.br_startoff = bma->offset;
	bma->got.br_startblock = bma->blkno;
@@ -4766,10 +4760,8 @@ xfs_bmapi_remap(
	ip->i_nblocks += len;
	xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);

	if (ifp->if_format == XFS_DINODE_FMT_BTREE) {
	if (ifp->if_format == XFS_DINODE_FMT_BTREE)
		cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
		cur->bc_ino.flags = 0;
	}

	got.br_startoff = bno;
	got.br_startblock = startblock;
@@ -5400,7 +5392,6 @@ __xfs_bunmapi(
	if (ifp->if_format == XFS_DINODE_FMT_BTREE) {
		ASSERT(ifp->if_format == XFS_DINODE_FMT_BTREE);
		cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
		cur->bc_ino.flags = 0;
	} else
		cur = NULL;

@@ -5638,7 +5629,7 @@ __xfs_bunmapi(
		xfs_trans_log_inode(tp, ip, logflags);
	if (cur) {
		if (!error)
			cur->bc_ino.allocated = 0;
			cur->bc_bmap.allocated = 0;
		xfs_btree_del_cursor(cur, error);
	}
	return error;
@@ -5861,10 +5852,8 @@ xfs_bmap_collapse_extents(
	if (error)
		return error;

	if (ifp->if_format == XFS_DINODE_FMT_BTREE) {
	if (ifp->if_format == XFS_DINODE_FMT_BTREE)
		cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
		cur->bc_ino.flags = 0;
	}

	if (!xfs_iext_lookup_extent(ip, ifp, *next_fsb, &icur, &got)) {
		*done = true;
@@ -5978,10 +5967,8 @@ xfs_bmap_insert_extents(
	if (error)
		return error;

	if (ifp->if_format == XFS_DINODE_FMT_BTREE) {
	if (ifp->if_format == XFS_DINODE_FMT_BTREE)
		cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
		cur->bc_ino.flags = 0;
	}

	if (*next_fsb == NULLFSBLOCK) {
		xfs_iext_last(ifp, &icur);
@@ -6098,7 +6085,6 @@ xfs_bmap_split_extent(

	if (ifp->if_format == XFS_DINODE_FMT_BTREE) {
		cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
		cur->bc_ino.flags = 0;
		error = xfs_bmbt_lookup_eq(cur, &got, &i);
		if (error)
			goto del_cursor;
@@ -6159,7 +6145,7 @@ xfs_bmap_split_extent(

del_cursor:
	if (cur) {
		cur->bc_ino.allocated = 0;
		cur->bc_bmap.allocated = 0;
		xfs_btree_del_cursor(cur, error);
	}

Loading