Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 310a75a3 authored by Darrick J. Wong's avatar Darrick J. Wong Committed by Dave Chinner
Browse files

xfs: change xfs_bmap_{finish,cancel,init,free} -> xfs_defer_*



Drop the compatibility shims that we were using to integrate the new
deferred operation mechanism into the existing code.  No new code.

Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 3ab78df2
Loading
Loading
Loading
Loading
+29 −29
Original line number Diff line number Diff line
@@ -204,7 +204,7 @@ xfs_attr_set(
{
	struct xfs_mount	*mp = dp->i_mount;
	struct xfs_da_args	args;
	struct xfs_bmap_free	flist;
	struct xfs_defer_ops	flist;
	struct xfs_trans_res	tres;
	xfs_fsblock_t		firstblock;
	int			rsvd = (flags & ATTR_ROOT) != 0;
@@ -317,13 +317,13 @@ xfs_attr_set(
		 * It won't fit in the shortform, transform to a leaf block.
		 * GROT: another possible req'mt for a double-split btree op.
		 */
		xfs_bmap_init(args.flist, args.firstblock);
		xfs_defer_init(args.flist, args.firstblock);
		error = xfs_attr_shortform_to_leaf(&args);
		if (!error)
			error = xfs_bmap_finish(&args.trans, args.flist, dp);
			error = xfs_defer_finish(&args.trans, args.flist, dp);
		if (error) {
			args.trans = NULL;
			xfs_bmap_cancel(&flist);
			xfs_defer_cancel(&flist);
			goto out;
		}

@@ -383,7 +383,7 @@ xfs_attr_remove(
{
	struct xfs_mount	*mp = dp->i_mount;
	struct xfs_da_args	args;
	struct xfs_bmap_free	flist;
	struct xfs_defer_ops	flist;
	xfs_fsblock_t		firstblock;
	int			error;

@@ -585,13 +585,13 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
		 * Commit that transaction so that the node_addname() call
		 * can manage its own transactions.
		 */
		xfs_bmap_init(args->flist, args->firstblock);
		xfs_defer_init(args->flist, args->firstblock);
		error = xfs_attr3_leaf_to_node(args);
		if (!error)
			error = xfs_bmap_finish(&args->trans, args->flist, dp);
			error = xfs_defer_finish(&args->trans, args->flist, dp);
		if (error) {
			args->trans = NULL;
			xfs_bmap_cancel(args->flist);
			xfs_defer_cancel(args->flist);
			return error;
		}

@@ -675,15 +675,15 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
		 * If the result is small enough, shrink it all into the inode.
		 */
		if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
			xfs_bmap_init(args->flist, args->firstblock);
			xfs_defer_init(args->flist, args->firstblock);
			error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
			/* bp is gone due to xfs_da_shrink_inode */
			if (!error)
				error = xfs_bmap_finish(&args->trans,
				error = xfs_defer_finish(&args->trans,
							args->flist, dp);
			if (error) {
				args->trans = NULL;
				xfs_bmap_cancel(args->flist);
				xfs_defer_cancel(args->flist);
				return error;
			}
		}
@@ -738,14 +738,14 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
	 * If the result is small enough, shrink it all into the inode.
	 */
	if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
		xfs_bmap_init(args->flist, args->firstblock);
		xfs_defer_init(args->flist, args->firstblock);
		error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
		/* bp is gone due to xfs_da_shrink_inode */
		if (!error)
			error = xfs_bmap_finish(&args->trans, args->flist, dp);
			error = xfs_defer_finish(&args->trans, args->flist, dp);
		if (error) {
			args->trans = NULL;
			xfs_bmap_cancel(args->flist);
			xfs_defer_cancel(args->flist);
			return error;
		}
	}
@@ -864,14 +864,14 @@ xfs_attr_node_addname(xfs_da_args_t *args)
			 */
			xfs_da_state_free(state);
			state = NULL;
			xfs_bmap_init(args->flist, args->firstblock);
			xfs_defer_init(args->flist, args->firstblock);
			error = xfs_attr3_leaf_to_node(args);
			if (!error)
				error = xfs_bmap_finish(&args->trans,
				error = xfs_defer_finish(&args->trans,
							args->flist, dp);
			if (error) {
				args->trans = NULL;
				xfs_bmap_cancel(args->flist);
				xfs_defer_cancel(args->flist);
				goto out;
			}

@@ -892,13 +892,13 @@ xfs_attr_node_addname(xfs_da_args_t *args)
		 * in the index/blkno/rmtblkno/rmtblkcnt fields and
		 * in the index2/blkno2/rmtblkno2/rmtblkcnt2 fields.
		 */
		xfs_bmap_init(args->flist, args->firstblock);
		xfs_defer_init(args->flist, args->firstblock);
		error = xfs_da3_split(state);
		if (!error)
			error = xfs_bmap_finish(&args->trans, args->flist, dp);
			error = xfs_defer_finish(&args->trans, args->flist, dp);
		if (error) {
			args->trans = NULL;
			xfs_bmap_cancel(args->flist);
			xfs_defer_cancel(args->flist);
			goto out;
		}
	} else {
@@ -991,14 +991,14 @@ xfs_attr_node_addname(xfs_da_args_t *args)
		 * Check to see if the tree needs to be collapsed.
		 */
		if (retval && (state->path.active > 1)) {
			xfs_bmap_init(args->flist, args->firstblock);
			xfs_defer_init(args->flist, args->firstblock);
			error = xfs_da3_join(state);
			if (!error)
				error = xfs_bmap_finish(&args->trans,
				error = xfs_defer_finish(&args->trans,
							args->flist, dp);
			if (error) {
				args->trans = NULL;
				xfs_bmap_cancel(args->flist);
				xfs_defer_cancel(args->flist);
				goto out;
			}
		}
@@ -1114,13 +1114,13 @@ xfs_attr_node_removename(xfs_da_args_t *args)
	 * Check to see if the tree needs to be collapsed.
	 */
	if (retval && (state->path.active > 1)) {
		xfs_bmap_init(args->flist, args->firstblock);
		xfs_defer_init(args->flist, args->firstblock);
		error = xfs_da3_join(state);
		if (!error)
			error = xfs_bmap_finish(&args->trans, args->flist, dp);
			error = xfs_defer_finish(&args->trans, args->flist, dp);
		if (error) {
			args->trans = NULL;
			xfs_bmap_cancel(args->flist);
			xfs_defer_cancel(args->flist);
			goto out;
		}
		/*
@@ -1147,15 +1147,15 @@ xfs_attr_node_removename(xfs_da_args_t *args)
			goto out;

		if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
			xfs_bmap_init(args->flist, args->firstblock);
			xfs_defer_init(args->flist, args->firstblock);
			error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
			/* bp is gone due to xfs_da_shrink_inode */
			if (!error)
				error = xfs_bmap_finish(&args->trans,
				error = xfs_defer_finish(&args->trans,
							args->flist, dp);
			if (error) {
				args->trans = NULL;
				xfs_bmap_cancel(args->flist);
				xfs_defer_cancel(args->flist);
				goto out;
			}
		} else
+7 −7
Original line number Diff line number Diff line
@@ -461,16 +461,16 @@ xfs_attr_rmtval_set(
		 * extent and then crash then the block may not contain the
		 * correct metadata after log recovery occurs.
		 */
		xfs_bmap_init(args->flist, args->firstblock);
		xfs_defer_init(args->flist, args->firstblock);
		nmap = 1;
		error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)lblkno,
				  blkcnt, XFS_BMAPI_ATTRFORK, args->firstblock,
				  args->total, &map, &nmap, args->flist);
		if (!error)
			error = xfs_bmap_finish(&args->trans, args->flist, dp);
			error = xfs_defer_finish(&args->trans, args->flist, dp);
		if (error) {
			args->trans = NULL;
			xfs_bmap_cancel(args->flist);
			xfs_defer_cancel(args->flist);
			return error;
		}

@@ -504,7 +504,7 @@ xfs_attr_rmtval_set(

		ASSERT(blkcnt > 0);

		xfs_bmap_init(args->flist, args->firstblock);
		xfs_defer_init(args->flist, args->firstblock);
		nmap = 1;
		error = xfs_bmapi_read(dp, (xfs_fileoff_t)lblkno,
				       blkcnt, &map, &nmap,
@@ -604,16 +604,16 @@ xfs_attr_rmtval_remove(
	blkcnt = args->rmtblkcnt;
	done = 0;
	while (!done) {
		xfs_bmap_init(args->flist, args->firstblock);
		xfs_defer_init(args->flist, args->firstblock);
		error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt,
				    XFS_BMAPI_ATTRFORK, 1, args->firstblock,
				    args->flist, &done);
		if (!error)
			error = xfs_bmap_finish(&args->trans, args->flist,
			error = xfs_defer_finish(&args->trans, args->flist,
						args->dp);
		if (error) {
			args->trans = NULL;
			xfs_bmap_cancel(args->flist);
			xfs_defer_cancel(args->flist);
			return error;
		}

+23 −23
Original line number Diff line number Diff line
@@ -572,11 +572,11 @@ xfs_bmap_validate_ret(
void
xfs_bmap_add_free(
	struct xfs_mount	*mp,		/* mount point structure */
	struct xfs_bmap_free	*flist,		/* list of extents */
	struct xfs_defer_ops	*flist,		/* list of extents */
	xfs_fsblock_t		bno,		/* fs block number of extent */
	xfs_filblks_t		len)		/* length of extent */
{
	struct xfs_bmap_free_item	*new;		/* new element */
	struct xfs_extent_free_item	*new;		/* new element */
#ifdef DEBUG
	xfs_agnumber_t		agno;
	xfs_agblock_t		agbno;
@@ -594,9 +594,9 @@ xfs_bmap_add_free(
#endif
	ASSERT(xfs_bmap_free_item_zone != NULL);
	new = kmem_zone_alloc(xfs_bmap_free_item_zone, KM_SLEEP);
	new->xbfi_startblock = bno;
	new->xbfi_blockcount = (xfs_extlen_t)len;
	xfs_defer_add(flist, XFS_DEFER_OPS_TYPE_FREE, &new->xbfi_list);
	new->xefi_startblock = bno;
	new->xefi_blockcount = (xfs_extlen_t)len;
	xfs_defer_add(flist, XFS_DEFER_OPS_TYPE_FREE, &new->xefi_list);
}

/*
@@ -672,7 +672,7 @@ xfs_bmap_extents_to_btree(
	xfs_trans_t		*tp,		/* transaction pointer */
	xfs_inode_t		*ip,		/* incore inode pointer */
	xfs_fsblock_t		*firstblock,	/* first-block-allocated */
	xfs_bmap_free_t		*flist,		/* blocks freed in xaction */
	struct xfs_defer_ops	*flist,		/* blocks freed in xaction */
	xfs_btree_cur_t		**curp,		/* cursor returned to caller */
	int			wasdel,		/* converting a delayed alloc */
	int			*logflagsp,	/* inode logging flags */
@@ -940,7 +940,7 @@ xfs_bmap_add_attrfork_btree(
	xfs_trans_t		*tp,		/* transaction pointer */
	xfs_inode_t		*ip,		/* incore inode pointer */
	xfs_fsblock_t		*firstblock,	/* first block allocated */
	xfs_bmap_free_t		*flist,		/* blocks to free at commit */
	struct xfs_defer_ops	*flist,		/* blocks to free at commit */
	int			*flags)		/* inode logging flags */
{
	xfs_btree_cur_t		*cur;		/* btree cursor */
@@ -983,7 +983,7 @@ xfs_bmap_add_attrfork_extents(
	xfs_trans_t		*tp,		/* transaction pointer */
	xfs_inode_t		*ip,		/* incore inode pointer */
	xfs_fsblock_t		*firstblock,	/* first block allocated */
	xfs_bmap_free_t		*flist,		/* blocks to free at commit */
	struct xfs_defer_ops	*flist,		/* blocks to free at commit */
	int			*flags)		/* inode logging flags */
{
	xfs_btree_cur_t		*cur;		/* bmap btree cursor */
@@ -1018,7 +1018,7 @@ xfs_bmap_add_attrfork_local(
	xfs_trans_t		*tp,		/* transaction pointer */
	xfs_inode_t		*ip,		/* incore inode pointer */
	xfs_fsblock_t		*firstblock,	/* first block allocated */
	xfs_bmap_free_t		*flist,		/* blocks to free at commit */
	struct xfs_defer_ops	*flist,		/* blocks to free at commit */
	int			*flags)		/* inode logging flags */
{
	xfs_da_args_t		dargs;		/* args for dir/attr code */
@@ -1059,7 +1059,7 @@ xfs_bmap_add_attrfork(
	int			rsvd)		/* xact may use reserved blks */
{
	xfs_fsblock_t		firstblock;	/* 1st block/ag allocated */
	xfs_bmap_free_t		flist;		/* freed extent records */
	struct xfs_defer_ops	flist;		/* freed extent records */
	xfs_mount_t		*mp;		/* mount structure */
	xfs_trans_t		*tp;		/* transaction pointer */
	int			blks;		/* space reservation */
@@ -1125,7 +1125,7 @@ xfs_bmap_add_attrfork(
	ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_SLEEP);
	ip->i_afp->if_flags = XFS_IFEXTENTS;
	logflags = 0;
	xfs_bmap_init(&flist, &firstblock);
	xfs_defer_init(&flist, &firstblock);
	switch (ip->i_d.di_format) {
	case XFS_DINODE_FMT_LOCAL:
		error = xfs_bmap_add_attrfork_local(tp, ip, &firstblock, &flist,
@@ -1165,7 +1165,7 @@ xfs_bmap_add_attrfork(
			xfs_log_sb(tp);
	}

	error = xfs_bmap_finish(&tp, &flist, NULL);
	error = xfs_defer_finish(&tp, &flist, NULL);
	if (error)
		goto bmap_cancel;
	error = xfs_trans_commit(tp);
@@ -1173,7 +1173,7 @@ xfs_bmap_add_attrfork(
	return error;

bmap_cancel:
	xfs_bmap_cancel(&flist);
	xfs_defer_cancel(&flist);
trans_cancel:
	xfs_trans_cancel(tp);
	xfs_iunlock(ip, XFS_ILOCK_EXCL);
@@ -2214,7 +2214,7 @@ xfs_bmap_add_extent_unwritten_real(
	xfs_btree_cur_t		**curp,	/* if *curp is null, not a btree */
	xfs_bmbt_irec_t		*new,	/* new data to add to file extents */
	xfs_fsblock_t		*first,	/* pointer to firstblock variable */
	xfs_bmap_free_t		*flist,	/* list of extents to be freed */
	struct xfs_defer_ops	*flist,	/* list of extents to be freed */
	int			*logflagsp) /* inode logging flags */
{
	xfs_btree_cur_t		*cur;	/* btree cursor */
@@ -4447,7 +4447,7 @@ xfs_bmapi_write(
	xfs_extlen_t		total,		/* total blocks needed */
	struct xfs_bmbt_irec	*mval,		/* output: map values */
	int			*nmap,		/* i/o: mval size/count */
	struct xfs_bmap_free	*flist)		/* i/o: list extents to free */
	struct xfs_defer_ops	*flist)		/* i/o: list extents to free */
{
	struct xfs_mount	*mp = ip->i_mount;
	struct xfs_ifork	*ifp;
@@ -4735,7 +4735,7 @@ xfs_bmap_del_extent(
	xfs_inode_t		*ip,	/* incore inode pointer */
	xfs_trans_t		*tp,	/* current transaction pointer */
	xfs_extnum_t		*idx,	/* extent number to update/delete */
	xfs_bmap_free_t		*flist,	/* list of extents to be freed */
	struct xfs_defer_ops	*flist,	/* list of extents to be freed */
	xfs_btree_cur_t		*cur,	/* if null, not a btree */
	xfs_bmbt_irec_t		*del,	/* data to remove from extents */
	int			*logflagsp, /* inode logging flags */
@@ -5064,7 +5064,7 @@ xfs_bunmapi(
	xfs_extnum_t		nexts,		/* number of extents max */
	xfs_fsblock_t		*firstblock,	/* first allocated block
						   controls a.g. for allocs */
	xfs_bmap_free_t		*flist,		/* i/o: list extents to free */
	struct xfs_defer_ops	*flist,		/* i/o: list extents to free */
	int			*done)		/* set if not done yet */
{
	xfs_btree_cur_t		*cur;		/* bmap btree cursor */
@@ -5680,7 +5680,7 @@ xfs_bmap_shift_extents(
	int			*done,
	xfs_fileoff_t		stop_fsb,
	xfs_fsblock_t		*firstblock,
	struct xfs_bmap_free	*flist,
	struct xfs_defer_ops	*flist,
	enum shift_direction	direction,
	int			num_exts)
{
@@ -5834,7 +5834,7 @@ xfs_bmap_split_extent_at(
	struct xfs_inode	*ip,
	xfs_fileoff_t		split_fsb,
	xfs_fsblock_t		*firstfsb,
	struct xfs_bmap_free	*free_list)
	struct xfs_defer_ops	*free_list)
{
	int				whichfork = XFS_DATA_FORK;
	struct xfs_btree_cur		*cur = NULL;
@@ -5973,7 +5973,7 @@ xfs_bmap_split_extent(
{
	struct xfs_mount        *mp = ip->i_mount;
	struct xfs_trans        *tp;
	struct xfs_bmap_free    free_list;
	struct xfs_defer_ops    free_list;
	xfs_fsblock_t           firstfsb;
	int                     error;

@@ -5985,21 +5985,21 @@ xfs_bmap_split_extent(
	xfs_ilock(ip, XFS_ILOCK_EXCL);
	xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);

	xfs_bmap_init(&free_list, &firstfsb);
	xfs_defer_init(&free_list, &firstfsb);

	error = xfs_bmap_split_extent_at(tp, ip, split_fsb,
			&firstfsb, &free_list);
	if (error)
		goto out;

	error = xfs_bmap_finish(&tp, &free_list, NULL);
	error = xfs_defer_finish(&tp, &free_list, NULL);
	if (error)
		goto out;

	return xfs_trans_commit(tp);

out:
	xfs_bmap_cancel(&free_list);
	xfs_defer_cancel(&free_list);
	xfs_trans_cancel(tp);
	return error;
}
+9 −9
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ extern kmem_zone_t *xfs_bmap_free_item_zone;
 */
struct xfs_bmalloca {
	xfs_fsblock_t		*firstblock; /* i/o first block allocated */
	struct xfs_bmap_free	*flist;	/* bmap freelist */
	struct xfs_defer_ops	*flist;	/* bmap freelist */
	struct xfs_trans	*tp;	/* transaction pointer */
	struct xfs_inode	*ip;	/* incore inode pointer */
	struct xfs_bmbt_irec	prev;	/* extent before the new one */
@@ -62,11 +62,11 @@ struct xfs_bmalloca {
 * List of extents to be free "later".
 * The list is kept sorted on xbf_startblock.
 */
struct xfs_bmap_free_item
struct xfs_extent_free_item
{
	xfs_fsblock_t		xbfi_startblock;/* starting fs block number */
	xfs_extlen_t		xbfi_blockcount;/* number of blocks in extent */
	struct list_head	xbfi_list;
	xfs_fsblock_t		xefi_startblock;/* starting fs block number */
	xfs_extlen_t		xefi_blockcount;/* number of blocks in extent */
	struct list_head	xefi_list;
};

#define	XFS_BMAP_MAX_NMAP	4
@@ -164,7 +164,7 @@ void xfs_bmap_trace_exlist(struct xfs_inode *ip, xfs_extnum_t cnt,

int	xfs_bmap_add_attrfork(struct xfs_inode *ip, int size, int rsvd);
void	xfs_bmap_local_to_extents_empty(struct xfs_inode *ip, int whichfork);
void	xfs_bmap_add_free(struct xfs_mount *mp, struct xfs_bmap_free *flist,
void	xfs_bmap_add_free(struct xfs_mount *mp, struct xfs_defer_ops *flist,
			  xfs_fsblock_t bno, xfs_filblks_t len);
void	xfs_bmap_compute_maxlevels(struct xfs_mount *mp, int whichfork);
int	xfs_bmap_first_unused(struct xfs_trans *tp, struct xfs_inode *ip,
@@ -186,18 +186,18 @@ int xfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip,
		xfs_fileoff_t bno, xfs_filblks_t len, int flags,
		xfs_fsblock_t *firstblock, xfs_extlen_t total,
		struct xfs_bmbt_irec *mval, int *nmap,
		struct xfs_bmap_free *flist);
		struct xfs_defer_ops *flist);
int	xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
		xfs_fileoff_t bno, xfs_filblks_t len, int flags,
		xfs_extnum_t nexts, xfs_fsblock_t *firstblock,
		struct xfs_bmap_free *flist, int *done);
		struct xfs_defer_ops *flist, int *done);
int	xfs_check_nostate_extents(struct xfs_ifork *ifp, xfs_extnum_t idx,
		xfs_extnum_t num);
uint	xfs_default_attroffset(struct xfs_inode *ip);
int	xfs_bmap_shift_extents(struct xfs_trans *tp, struct xfs_inode *ip,
		xfs_fileoff_t *next_fsb, xfs_fileoff_t offset_shift_fsb,
		int *done, xfs_fileoff_t stop_fsb, xfs_fsblock_t *firstblock,
		struct xfs_bmap_free *flist, enum shift_direction direction,
		struct xfs_defer_ops *flist, enum shift_direction direction,
		int num_exts);
int	xfs_bmap_split_extent(struct xfs_inode *ip, xfs_fileoff_t split_offset);

+3 −2
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
#define	__XFS_BTREE_H__

struct xfs_buf;
struct xfs_bmap_free;
struct xfs_defer_ops;
struct xfs_inode;
struct xfs_mount;
struct xfs_trans;
@@ -255,11 +255,12 @@ typedef struct xfs_btree_cur
	union {
		struct {			/* needed for BNO, CNT, INO */
			struct xfs_buf	*agbp;	/* agf/agi buffer pointer */
			struct xfs_defer_ops *flist;	/* deferred updates */
			xfs_agnumber_t	agno;	/* ag number */
		} a;
		struct {			/* needed for BMAP */
			struct xfs_inode *ip;	/* pointer to our inode */
			struct xfs_bmap_free *flist;	/* list to free after */
			struct xfs_defer_ops *flist;	/* deferred updates */
			xfs_fsblock_t	firstblock;	/* 1st blk allocated */
			int		allocated;	/* count of alloced */
			short		forksize;	/* fork's inode space */
Loading