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

Commit 9e28a242 authored by Brian Foster's avatar Brian Foster Committed by Darrick J. Wong
Browse files

xfs: drop unnecessary xfs_defer_finish() dfops parameter



Every caller of xfs_defer_finish() now passes the transaction and
its associated ->t_dfops. The xfs_defer_ops parameter is therefore
no longer necessary and can be removed.

Since most xfs_defer_finish() callers also have to consider
xfs_defer_cancel() on error, update the latter to also receive the
transaction for consistency. The log recovery code contains an
outlier case that cancels a dfops directly without an available
transaction. Retain an internal wrapper to support this outlier case
for the time being.

Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarBill O'Donnell <billodo@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 d5cca7eb
Loading
Loading
Loading
Loading
+13 −14
Original line number Original line Diff line number Diff line
@@ -322,7 +322,7 @@ xfs_attr_set(
		xfs_trans_bhold(args.trans, leaf_bp);
		xfs_trans_bhold(args.trans, leaf_bp);
		xfs_defer_bjoin(args.trans->t_dfops, leaf_bp);
		xfs_defer_bjoin(args.trans->t_dfops, leaf_bp);
		xfs_defer_ijoin(args.trans->t_dfops, dp);
		xfs_defer_ijoin(args.trans->t_dfops, dp);
		error = xfs_defer_finish(&args.trans, args.trans->t_dfops);
		error = xfs_defer_finish(&args.trans);
		if (error)
		if (error)
			goto out;
			goto out;


@@ -591,7 +591,7 @@ xfs_attr_leaf_addname(
		if (error)
		if (error)
			goto out_defer_cancel;
			goto out_defer_cancel;
		xfs_defer_ijoin(args->trans->t_dfops, dp);
		xfs_defer_ijoin(args->trans->t_dfops, dp);
		error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
		error = xfs_defer_finish(&args->trans);
		if (error)
		if (error)
			goto out_defer_cancel;
			goto out_defer_cancel;


@@ -680,7 +680,7 @@ xfs_attr_leaf_addname(
			if (error)
			if (error)
				goto out_defer_cancel;
				goto out_defer_cancel;
			xfs_defer_ijoin(args->trans->t_dfops, dp);
			xfs_defer_ijoin(args->trans->t_dfops, dp);
			error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
			error = xfs_defer_finish(&args->trans);
			if (error)
			if (error)
				goto out_defer_cancel;
				goto out_defer_cancel;
		}
		}
@@ -698,7 +698,7 @@ xfs_attr_leaf_addname(
	}
	}
	return error;
	return error;
out_defer_cancel:
out_defer_cancel:
	xfs_defer_cancel(args->trans->t_dfops);
	xfs_defer_cancel(args->trans);
	return error;
	return error;
}
}


@@ -744,13 +744,13 @@ xfs_attr_leaf_removename(
		if (error)
		if (error)
			goto out_defer_cancel;
			goto out_defer_cancel;
		xfs_defer_ijoin(args->trans->t_dfops, dp);
		xfs_defer_ijoin(args->trans->t_dfops, dp);
		error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
		error = xfs_defer_finish(&args->trans);
		if (error)
		if (error)
			goto out_defer_cancel;
			goto out_defer_cancel;
	}
	}
	return 0;
	return 0;
out_defer_cancel:
out_defer_cancel:
	xfs_defer_cancel(args->trans->t_dfops);
	xfs_defer_cancel(args->trans);
	return error;
	return error;
}
}


@@ -871,8 +871,7 @@ xfs_attr_node_addname(
			if (error)
			if (error)
				goto out_defer_cancel;
				goto out_defer_cancel;
			xfs_defer_ijoin(args->trans->t_dfops, dp);
			xfs_defer_ijoin(args->trans->t_dfops, dp);
			error = xfs_defer_finish(&args->trans,
			error = xfs_defer_finish(&args->trans);
						 args->trans->t_dfops);
			if (error)
			if (error)
				goto out_defer_cancel;
				goto out_defer_cancel;


@@ -897,7 +896,7 @@ xfs_attr_node_addname(
		if (error)
		if (error)
			goto out_defer_cancel;
			goto out_defer_cancel;
		xfs_defer_ijoin(args->trans->t_dfops, dp);
		xfs_defer_ijoin(args->trans->t_dfops, dp);
		error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
		error = xfs_defer_finish(&args->trans);
		if (error)
		if (error)
			goto out_defer_cancel;
			goto out_defer_cancel;
	} else {
	} else {
@@ -994,7 +993,7 @@ xfs_attr_node_addname(
			if (error)
			if (error)
				goto out_defer_cancel;
				goto out_defer_cancel;
			xfs_defer_ijoin(args->trans->t_dfops, dp);
			xfs_defer_ijoin(args->trans->t_dfops, dp);
			error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
			error = xfs_defer_finish(&args->trans);
			if (error)
			if (error)
				goto out_defer_cancel;
				goto out_defer_cancel;
		}
		}
@@ -1023,7 +1022,7 @@ xfs_attr_node_addname(
		return error;
		return error;
	return retval;
	return retval;
out_defer_cancel:
out_defer_cancel:
	xfs_defer_cancel(args->trans->t_dfops);
	xfs_defer_cancel(args->trans);
	goto out;
	goto out;
}
}


@@ -1118,7 +1117,7 @@ xfs_attr_node_removename(
		if (error)
		if (error)
			goto out_defer_cancel;
			goto out_defer_cancel;
		xfs_defer_ijoin(args->trans->t_dfops, dp);
		xfs_defer_ijoin(args->trans->t_dfops, dp);
		error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
		error = xfs_defer_finish(&args->trans);
		if (error)
		if (error)
			goto out_defer_cancel;
			goto out_defer_cancel;
		/*
		/*
@@ -1150,7 +1149,7 @@ xfs_attr_node_removename(
			if (error)
			if (error)
				goto out_defer_cancel;
				goto out_defer_cancel;
			xfs_defer_ijoin(args->trans->t_dfops, dp);
			xfs_defer_ijoin(args->trans->t_dfops, dp);
			error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
			error = xfs_defer_finish(&args->trans);
			if (error)
			if (error)
				goto out_defer_cancel;
				goto out_defer_cancel;
		} else
		} else
@@ -1162,7 +1161,7 @@ xfs_attr_node_removename(
	xfs_da_state_free(state);
	xfs_da_state_free(state);
	return error;
	return error;
out_defer_cancel:
out_defer_cancel:
	xfs_defer_cancel(args->trans->t_dfops);
	xfs_defer_cancel(args->trans);
	goto out;
	goto out;
}
}


+4 −4
Original line number Original line Diff line number Diff line
@@ -487,7 +487,7 @@ xfs_attr_rmtval_set(
		if (error)
		if (error)
			goto out_defer_cancel;
			goto out_defer_cancel;
		xfs_defer_ijoin(args->trans->t_dfops, dp);
		xfs_defer_ijoin(args->trans->t_dfops, dp);
		error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
		error = xfs_defer_finish(&args->trans);
		if (error)
		if (error)
			goto out_defer_cancel;
			goto out_defer_cancel;


@@ -555,7 +555,7 @@ xfs_attr_rmtval_set(
	ASSERT(valuelen == 0);
	ASSERT(valuelen == 0);
	return 0;
	return 0;
out_defer_cancel:
out_defer_cancel:
	xfs_defer_cancel(args->trans->t_dfops);
	xfs_defer_cancel(args->trans);
	return error;
	return error;
}
}


@@ -628,7 +628,7 @@ xfs_attr_rmtval_remove(
		if (error)
		if (error)
			goto out_defer_cancel;
			goto out_defer_cancel;
		xfs_defer_ijoin(args->trans->t_dfops, args->dp);
		xfs_defer_ijoin(args->trans->t_dfops, args->dp);
		error = xfs_defer_finish(&args->trans, args->trans->t_dfops);
		error = xfs_defer_finish(&args->trans);
		if (error)
		if (error)
			goto out_defer_cancel;
			goto out_defer_cancel;


@@ -641,6 +641,6 @@ xfs_attr_rmtval_remove(
	}
	}
	return 0;
	return 0;
out_defer_cancel:
out_defer_cancel:
	xfs_defer_cancel(args->trans->t_dfops);
	xfs_defer_cancel(args->trans);
	return error;
	return error;
}
}
+3 −4
Original line number Original line Diff line number Diff line
@@ -342,9 +342,9 @@ xfs_defer_reset(
 */
 */
int
int
xfs_defer_finish(
xfs_defer_finish(
	struct xfs_trans		**tp,
	struct xfs_trans		**tp)
	struct xfs_defer_ops		*dop)
{
{
	struct xfs_defer_ops		*dop = (*tp)->t_dfops;
	struct xfs_defer_pending	*dfp;
	struct xfs_defer_pending	*dfp;
	struct list_head		*li;
	struct list_head		*li;
	struct list_head		*n;
	struct list_head		*n;
@@ -353,7 +353,6 @@ xfs_defer_finish(
	void				(*cleanup_fn)(struct xfs_trans *, void *, int);
	void				(*cleanup_fn)(struct xfs_trans *, void *, int);


	ASSERT((*tp)->t_flags & XFS_TRANS_PERM_LOG_RES);
	ASSERT((*tp)->t_flags & XFS_TRANS_PERM_LOG_RES);
	ASSERT((*tp)->t_dfops == dop);


	trace_xfs_defer_finish((*tp)->t_mountp, dop, _RET_IP_);
	trace_xfs_defer_finish((*tp)->t_mountp, dop, _RET_IP_);


@@ -454,7 +453,7 @@ xfs_defer_finish(
 * Free up any items left in the list.
 * Free up any items left in the list.
 */
 */
void
void
xfs_defer_cancel(
__xfs_defer_cancel(
	struct xfs_defer_ops		*dop)
	struct xfs_defer_ops		*dop)
{
{
	struct xfs_defer_pending	*dfp;
	struct xfs_defer_pending	*dfp;
+2 −2
Original line number Original line Diff line number Diff line
@@ -48,8 +48,8 @@ enum xfs_defer_ops_type {


void xfs_defer_add(struct xfs_defer_ops *dop, enum xfs_defer_ops_type type,
void xfs_defer_add(struct xfs_defer_ops *dop, enum xfs_defer_ops_type type,
		struct list_head *h);
		struct list_head *h);
int xfs_defer_finish(struct xfs_trans **tp, struct xfs_defer_ops *dop);
int xfs_defer_finish(struct xfs_trans **tp);
void xfs_defer_cancel(struct xfs_defer_ops *dop);
void __xfs_defer_cancel(struct xfs_defer_ops *dop);
void xfs_defer_init(struct xfs_trans *tp, struct xfs_defer_ops *dop);
void xfs_defer_init(struct xfs_trans *tp, struct xfs_defer_ops *dop);
bool xfs_defer_has_unfinished_work(struct xfs_defer_ops *dop);
bool xfs_defer_has_unfinished_work(struct xfs_defer_ops *dop);
int xfs_defer_ijoin(struct xfs_defer_ops *dop, struct xfs_inode *ip);
int xfs_defer_ijoin(struct xfs_defer_ops *dop, struct xfs_inode *ip);
+2 −2
Original line number Original line Diff line number Diff line
@@ -1624,7 +1624,7 @@ xfs_swap_extent_rmap(
				goto out_defer;
				goto out_defer;


			xfs_defer_ijoin(tp->t_dfops, ip);
			xfs_defer_ijoin(tp->t_dfops, ip);
			error = xfs_defer_finish(tpp, tp->t_dfops);
			error = xfs_defer_finish(tpp);
			tp = *tpp;
			tp = *tpp;
			if (error)
			if (error)
				goto out_defer;
				goto out_defer;
@@ -1645,7 +1645,7 @@ xfs_swap_extent_rmap(
	return 0;
	return 0;


out_defer:
out_defer:
	xfs_defer_cancel(tp->t_dfops);
	xfs_defer_cancel(tp);
out:
out:
	trace_xfs_swap_extent_rmap_error(ip, error, _RET_IP_);
	trace_xfs_swap_extent_rmap_error(ip, error, _RET_IP_);
	tip->i_d.di_flags2 = tip_flags2;
	tip->i_d.di_flags2 = tip_flags2;
Loading