Source kernel commit:
9e28a242be65b8274742425ca5d146f366205a90
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: Brian Foster <bfoster@redhat.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
int libxfs_trans_alloc_empty(struct xfs_mount *mp, struct xfs_trans **tpp);
int libxfs_trans_commit(struct xfs_trans *);
void libxfs_trans_cancel(struct xfs_trans *);
+
+/* cancel dfops associated with a transaction */
+void xfs_defer_cancel(struct xfs_trans *);
+
struct xfs_buf *libxfs_trans_getsb(struct xfs_trans *, struct xfs_mount *, int);
int libxfs_trans_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
return xfs_trans_reserve(*tpp, &tres, 0, 0);
}
+void
+xfs_defer_cancel(
+ struct xfs_trans *tp)
+{
+ __xfs_defer_cancel(tp->t_dfops);
+}
+
+
/*
* Free the transaction structure. If there is more clean up
* to do when the structure is freed, add it here.
goto out;
if (tp->t_dfops)
- xfs_defer_cancel(tp->t_dfops);
+ xfs_defer_cancel(tp);
xfs_trans_free_items(tp);
xfs_trans_free(tp);
/* finish deferred items on final commit */
if (!regrant && tp->t_dfops) {
- error = xfs_defer_finish(&tp, tp->t_dfops);
+ error = xfs_defer_finish(&tp);
if (error) {
- xfs_defer_cancel(tp->t_dfops);
+ xfs_defer_cancel(tp);
goto out_unreserve;
}
}
xfs_trans_bhold(args.trans, leaf_bp);
xfs_defer_bjoin(args.trans->t_dfops, leaf_bp);
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)
goto out;
if (error)
goto out_defer_cancel;
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)
goto out_defer_cancel;
if (error)
goto out_defer_cancel;
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)
goto out_defer_cancel;
}
}
return error;
out_defer_cancel:
- xfs_defer_cancel(args->trans->t_dfops);
+ xfs_defer_cancel(args->trans);
return error;
}
if (error)
goto out_defer_cancel;
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)
goto out_defer_cancel;
}
return 0;
out_defer_cancel:
- xfs_defer_cancel(args->trans->t_dfops);
+ xfs_defer_cancel(args->trans);
return error;
}
if (error)
goto out_defer_cancel;
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)
goto out_defer_cancel;
if (error)
goto out_defer_cancel;
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)
goto out_defer_cancel;
} else {
if (error)
goto out_defer_cancel;
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)
goto out_defer_cancel;
}
return error;
return retval;
out_defer_cancel:
- xfs_defer_cancel(args->trans->t_dfops);
+ xfs_defer_cancel(args->trans);
goto out;
}
if (error)
goto out_defer_cancel;
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)
goto out_defer_cancel;
/*
if (error)
goto out_defer_cancel;
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)
goto out_defer_cancel;
} else
xfs_da_state_free(state);
return error;
out_defer_cancel:
- xfs_defer_cancel(args->trans->t_dfops);
+ xfs_defer_cancel(args->trans);
goto out;
}
if (error)
goto out_defer_cancel;
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)
goto out_defer_cancel;
ASSERT(valuelen == 0);
return 0;
out_defer_cancel:
- xfs_defer_cancel(args->trans->t_dfops);
+ xfs_defer_cancel(args->trans);
return error;
}
if (error)
goto out_defer_cancel;
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)
goto out_defer_cancel;
}
return 0;
out_defer_cancel:
- xfs_defer_cancel(args->trans->t_dfops);
+ xfs_defer_cancel(args->trans);
return error;
}
*/
int
xfs_defer_finish(
- struct xfs_trans **tp,
- struct xfs_defer_ops *dop)
+ struct xfs_trans **tp)
{
+ struct xfs_defer_ops *dop = (*tp)->t_dfops;
struct xfs_defer_pending *dfp;
struct list_head *li;
struct list_head *n;
void (*cleanup_fn)(struct xfs_trans *, void *, int);
ASSERT((*tp)->t_flags & XFS_TRANS_PERM_LOG_RES);
- ASSERT((*tp)->t_dfops == dop);
trace_xfs_defer_finish((*tp)->t_mountp, dop, _RET_IP_);
* Free up any items left in the list.
*/
void
-xfs_defer_cancel(
+__xfs_defer_cancel(
struct xfs_defer_ops *dop)
{
struct xfs_defer_pending *dfp;
void xfs_defer_add(struct xfs_defer_ops *dop, enum xfs_defer_ops_type type,
struct list_head *h);
-int xfs_defer_finish(struct xfs_trans **tp, struct xfs_defer_ops *dop);
-void xfs_defer_cancel(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_init(struct xfs_trans *tp, 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);