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

Commit 32a9b7c6 authored by Brian Foster's avatar Brian Foster Committed by Darrick J. Wong
Browse files

xfs: replace xfs_da_args->dfops accesses with ->t_dfops and remove



Now that xfs_da_args->dfops is always assigned from a ->t_dfops
pointer (or one that is immediately attached), replace all
downstream accesses of the former with the latter and remove the
field from struct xfs_da_args.

Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent d76e6ce8
Loading
Loading
Loading
Loading
+53 −50
Original line number Diff line number Diff line
@@ -220,7 +220,6 @@ xfs_attr_set(
	args.value = value;
	args.valuelen = valuelen;
	args.firstblock = &firstblock;
	args.dfops = &dfops;
	args.op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT;
	args.total = xfs_attr_calc_size(&args, &local);

@@ -407,7 +406,6 @@ xfs_attr_remove(
		return error;

	args.firstblock = &firstblock;
	args.dfops = &dfops;

	/*
	 * we have no control over the attribute names that userspace passes us
@@ -539,9 +537,10 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
 * if bmap_one_block() says there is only one block (ie: no remote blks).
 */
STATIC int
xfs_attr_leaf_addname(xfs_da_args_t *args)
xfs_attr_leaf_addname(
	struct xfs_da_args	*args)
{
	xfs_inode_t *dp;
	struct xfs_inode	*dp;
	struct xfs_buf		*bp;
	int			retval, error, forkoff;

@@ -601,12 +600,12 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
		 * Commit that transaction so that the node_addname() call
		 * can manage its own transactions.
		 */
		xfs_defer_init(args->dfops, args->firstblock);
		xfs_defer_init(args->trans->t_dfops, args->firstblock);
		error = xfs_attr3_leaf_to_node(args);
		if (error)
			goto out_defer_cancel;
		xfs_defer_ijoin(args->dfops, dp);
		error = xfs_defer_finish(&args->trans, args->dfops);
		xfs_defer_ijoin(args->trans->t_dfops, dp);
		error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
		if (error)
			goto out_defer_cancel;

@@ -690,13 +689,13 @@ 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_defer_init(args->dfops, args->firstblock);
			xfs_defer_init(args->trans->t_dfops, args->firstblock);
			error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
			/* bp is gone due to xfs_da_shrink_inode */
			if (error)
				goto out_defer_cancel;
			xfs_defer_ijoin(args->dfops, dp);
			error = xfs_defer_finish(&args->trans, args->dfops);
			xfs_defer_ijoin(args->trans->t_dfops, dp);
			error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
			if (error)
				goto out_defer_cancel;
		}
@@ -714,7 +713,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
	}
	return error;
out_defer_cancel:
	xfs_defer_cancel(args->dfops);
	xfs_defer_cancel(args->trans->t_dfops);
	return error;
}

@@ -725,9 +724,10 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
 * if bmap_one_block() says there is only one block (ie: no remote blks).
 */
STATIC int
xfs_attr_leaf_removename(xfs_da_args_t *args)
xfs_attr_leaf_removename(
	struct xfs_da_args	*args)
{
	xfs_inode_t *dp;
	struct xfs_inode	*dp;
	struct xfs_buf		*bp;
	int			error, forkoff;

@@ -754,19 +754,19 @@ 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_defer_init(args->dfops, args->firstblock);
		xfs_defer_init(args->trans->t_dfops, args->firstblock);
		error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
		/* bp is gone due to xfs_da_shrink_inode */
		if (error)
			goto out_defer_cancel;
		xfs_defer_ijoin(args->dfops, dp);
		error = xfs_defer_finish(&args->trans, args->dfops);
		xfs_defer_ijoin(args->trans->t_dfops, dp);
		error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
		if (error)
			goto out_defer_cancel;
	}
	return 0;
out_defer_cancel:
	xfs_defer_cancel(args->dfops);
	xfs_defer_cancel(args->trans->t_dfops);
	return error;
}

@@ -817,12 +817,13 @@ xfs_attr_leaf_get(xfs_da_args_t *args)
 * add a whole extra layer of confusion on top of that.
 */
STATIC int
xfs_attr_node_addname(xfs_da_args_t *args)
xfs_attr_node_addname(
	struct xfs_da_args	*args)
{
	xfs_da_state_t *state;
	xfs_da_state_blk_t *blk;
	xfs_inode_t *dp;
	xfs_mount_t *mp;
	struct xfs_da_state	*state;
	struct xfs_da_state_blk	*blk;
	struct xfs_inode	*dp;
	struct xfs_mount	*mp;
	int			retval, error;

	trace_xfs_attr_node_addname(args);
@@ -882,12 +883,13 @@ xfs_attr_node_addname(xfs_da_args_t *args)
			 */
			xfs_da_state_free(state);
			state = NULL;
			xfs_defer_init(args->dfops, args->firstblock);
			xfs_defer_init(args->trans->t_dfops, args->firstblock);
			error = xfs_attr3_leaf_to_node(args);
			if (error)
				goto out_defer_cancel;
			xfs_defer_ijoin(args->dfops, dp);
			error = xfs_defer_finish(&args->trans, args->dfops);
			xfs_defer_ijoin(args->trans->t_dfops, dp);
			error = xfs_defer_finish(&args->trans,
						 args->trans->t_dfops);
			if (error)
				goto out_defer_cancel;

@@ -908,12 +910,12 @@ 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_defer_init(args->dfops, args->firstblock);
		xfs_defer_init(args->trans->t_dfops, args->firstblock);
		error = xfs_da3_split(state);
		if (error)
			goto out_defer_cancel;
		xfs_defer_ijoin(args->dfops, dp);
		error = xfs_defer_finish(&args->trans, args->dfops);
		xfs_defer_ijoin(args->trans->t_dfops, dp);
		error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
		if (error)
			goto out_defer_cancel;
	} else {
@@ -1006,12 +1008,12 @@ 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_defer_init(args->dfops, args->firstblock);
			xfs_defer_init(args->trans->t_dfops, args->firstblock);
			error = xfs_da3_join(state);
			if (error)
				goto out_defer_cancel;
			xfs_defer_ijoin(args->dfops, dp);
			error = xfs_defer_finish(&args->trans, args->dfops);
			xfs_defer_ijoin(args->trans->t_dfops, dp);
			error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
			if (error)
				goto out_defer_cancel;
		}
@@ -1040,7 +1042,7 @@ xfs_attr_node_addname(xfs_da_args_t *args)
		return error;
	return retval;
out_defer_cancel:
	xfs_defer_cancel(args->dfops);
	xfs_defer_cancel(args->trans->t_dfops);
	goto out;
}

@@ -1052,11 +1054,12 @@ xfs_attr_node_addname(xfs_da_args_t *args)
 * the root node (a special case of an intermediate node).
 */
STATIC int
xfs_attr_node_removename(xfs_da_args_t *args)
xfs_attr_node_removename(
	struct xfs_da_args	*args)
{
	xfs_da_state_t *state;
	xfs_da_state_blk_t *blk;
	xfs_inode_t *dp;
	struct xfs_da_state	*state;
	struct xfs_da_state_blk	*blk;
	struct xfs_inode	*dp;
	struct xfs_buf		*bp;
	int			retval, error, forkoff;

@@ -1130,12 +1133,12 @@ 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_defer_init(args->dfops, args->firstblock);
		xfs_defer_init(args->trans->t_dfops, args->firstblock);
		error = xfs_da3_join(state);
		if (error)
			goto out_defer_cancel;
		xfs_defer_ijoin(args->dfops, dp);
		error = xfs_defer_finish(&args->trans, args->dfops);
		xfs_defer_ijoin(args->trans->t_dfops, dp);
		error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
		if (error)
			goto out_defer_cancel;
		/*
@@ -1162,13 +1165,13 @@ xfs_attr_node_removename(xfs_da_args_t *args)
			goto out;

		if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
			xfs_defer_init(args->dfops, args->firstblock);
			xfs_defer_init(args->trans->t_dfops, args->firstblock);
			error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
			/* bp is gone due to xfs_da_shrink_inode */
			if (error)
				goto out_defer_cancel;
			xfs_defer_ijoin(args->dfops, dp);
			error = xfs_defer_finish(&args->trans, args->dfops);
			xfs_defer_ijoin(args->trans->t_dfops, dp);
			error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
			if (error)
				goto out_defer_cancel;
		} else
@@ -1180,7 +1183,7 @@ xfs_attr_node_removename(xfs_da_args_t *args)
	xfs_da_state_free(state);
	return error;
out_defer_cancel:
	xfs_defer_cancel(args->dfops);
	xfs_defer_cancel(args->trans->t_dfops);
	goto out;
}

+11 −13
Original line number Diff line number Diff line
@@ -750,15 +750,15 @@ xfs_attr_shortform_to_leaf(
	struct xfs_da_args		*args,
	struct xfs_buf			**leaf_bp)
{
	xfs_inode_t *dp;
	xfs_attr_shortform_t *sf;
	xfs_attr_sf_entry_t *sfe;
	xfs_da_args_t nargs;
	struct xfs_inode		*dp;
	struct xfs_attr_shortform	*sf;
	struct xfs_attr_sf_entry	*sfe;
	struct xfs_da_args		nargs;
	char				*tmpbuffer;
	int				error, i, size;
	xfs_dablk_t			blkno;
	struct xfs_buf			*bp;
	xfs_ifork_t *ifp;
	struct xfs_ifork		*ifp;

	trace_xfs_attr_sf_to_leaf(args);

@@ -803,7 +803,6 @@ xfs_attr_shortform_to_leaf(
	nargs.dp = dp;
	nargs.geo = args->geo;
	nargs.firstblock = args->firstblock;
	nargs.dfops = args->dfops;
	nargs.total = args->total;
	nargs.whichfork = XFS_ATTR_FORK;
	nargs.trans = args->trans;
@@ -1007,7 +1006,6 @@ xfs_attr3_leaf_to_shortform(
	nargs.geo = args->geo;
	nargs.dp = dp;
	nargs.firstblock = args->firstblock;
	nargs.dfops = args->dfops;
	nargs.total = args->total;
	nargs.whichfork = XFS_ATTR_FORK;
	nargs.trans = args->trans;
+12 −11
Original line number Diff line number Diff line
@@ -480,15 +480,16 @@ xfs_attr_rmtval_set(
		 * extent and then crash then the block may not contain the
		 * correct metadata after log recovery occurs.
		 */
		xfs_defer_init(args->dfops, args->firstblock);
		xfs_defer_init(args->trans->t_dfops, 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->dfops);
				  args->total, &map, &nmap,
				  args->trans->t_dfops);
		if (error)
			goto out_defer_cancel;
		xfs_defer_ijoin(args->dfops, dp);
		error = xfs_defer_finish(&args->trans, args->dfops);
		xfs_defer_ijoin(args->trans->t_dfops, dp);
		error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
		if (error)
			goto out_defer_cancel;

@@ -522,7 +523,7 @@ xfs_attr_rmtval_set(

		ASSERT(blkcnt > 0);

		xfs_defer_init(args->dfops, args->firstblock);
		xfs_defer_init(args->trans->t_dfops, args->firstblock);
		nmap = 1;
		error = xfs_bmapi_read(dp, (xfs_fileoff_t)lblkno,
				       blkcnt, &map, &nmap,
@@ -557,7 +558,7 @@ xfs_attr_rmtval_set(
	ASSERT(valuelen == 0);
	return 0;
out_defer_cancel:
	xfs_defer_cancel(args->dfops);
	xfs_defer_cancel(args->trans->t_dfops);
	args->trans = NULL;
	return error;
}
@@ -626,14 +627,14 @@ xfs_attr_rmtval_remove(
	blkcnt = args->rmtblkcnt;
	done = 0;
	while (!done) {
		xfs_defer_init(args->dfops, args->firstblock);
		xfs_defer_init(args->trans->t_dfops, args->firstblock);
		error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt,
				    XFS_BMAPI_ATTRFORK, 1, args->firstblock,
				    args->dfops, &done);
				    args->trans->t_dfops, &done);
		if (error)
			goto out_defer_cancel;
		xfs_defer_ijoin(args->dfops, args->dp);
		error = xfs_defer_finish(&args->trans, args->dfops);
		xfs_defer_ijoin(args->trans->t_dfops, args->dp);
		error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
		if (error)
			goto out_defer_cancel;

@@ -646,7 +647,7 @@ xfs_attr_rmtval_remove(
	}
	return 0;
out_defer_cancel:
	xfs_defer_cancel(args->dfops);
	xfs_defer_cancel(args->trans->t_dfops);
	args->trans = NULL;
	return error;
}
+0 −1
Original line number Diff line number Diff line
@@ -1007,7 +1007,6 @@ xfs_bmap_add_attrfork_local(
		dargs.geo = ip->i_mount->m_dir_geo;
		dargs.dp = ip;
		dargs.firstblock = firstblock;
		dargs.dfops = tp->t_dfops;
		dargs.total = dargs.geo->fsbcount;
		dargs.whichfork = XFS_DATA_FORK;
		dargs.trans = tp;
+10 −9
Original line number Diff line number Diff line
@@ -2063,7 +2063,7 @@ xfs_da_grow_inode_int(
	error = xfs_bmapi_write(tp, dp, *bno, count,
			xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA|XFS_BMAPI_CONTIG,
			args->firstblock, args->total, &map, &nmap,
			args->dfops);
			args->trans->t_dfops);
	if (error)
		return error;

@@ -2086,7 +2086,8 @@ xfs_da_grow_inode_int(
			error = xfs_bmapi_write(tp, dp, b, c,
					xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA,
					args->firstblock, args->total,
					&mapp[mapi], &nmap, args->dfops);
					&mapp[mapi], &nmap,
					args->trans->t_dfops);
			if (error)
				goto out_free_map;
			if (nmap < 1)
@@ -2375,13 +2376,13 @@ xfs_da3_swap_lastblock(
 */
int
xfs_da_shrink_inode(
	xfs_da_args_t	*args,
	struct xfs_da_args	*args,
	xfs_dablk_t		dead_blkno,
	struct xfs_buf		*dead_buf)
{
	xfs_inode_t *dp;
	struct xfs_inode	*dp;
	int			done, error, w, count;
	xfs_trans_t *tp;
	struct xfs_trans	*tp;

	trace_xfs_da_shrink_inode(args);

@@ -2396,7 +2397,7 @@ xfs_da_shrink_inode(
		 */
		error = xfs_bunmapi(tp, dp, dead_blkno, count,
				    xfs_bmapi_aflag(w), 0, args->firstblock,
				    args->dfops, &done);
				    args->trans->t_dfops, &done);
		if (error == -ENOSPC) {
			if (w != XFS_DATA_FORK)
				break;
Loading