int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
xfs_trans_t *libxfs_trans_alloc(struct xfs_mount *, int);
-xfs_trans_t *libxfs_trans_dup(struct xfs_trans *);
int libxfs_trans_reserve(struct xfs_trans *, struct xfs_trans_res *,
uint, uint);
int libxfs_trans_commit(struct xfs_trans *, uint);
#define xfs_trans_commit libxfs_trans_commit
#define xfs_trans_cancel libxfs_trans_cancel
#define xfs_trans_del_item libxfs_trans_del_item
-#define xfs_trans_dup libxfs_trans_dup
#define xfs_trans_get_buf libxfs_trans_get_buf
#define xfs_trans_getsb libxfs_trans_getsb
#define xfs_trans_iget libxfs_trans_iget
* Ensure that the inode is always logged.
*/
trans = *tpp;
- xfs_trans_log_inode(trans, dp, XFS_ILOG_CORE);
+ if (dp)
+ xfs_trans_log_inode(trans, dp, XFS_ILOG_CORE);
/*
* Copy the critical parameters from one trans to the next.
*/
tres.tr_logres = trans->t_log_res;
tres.tr_logcount = trans->t_log_count;
- *tpp = xfs_trans_dup(trans);
+ *tpp = libxfs_trans_alloc(trans->t_mountp, trans->t_type);
/*
* Commit the current transaction.
if (error)
return error;
- xfs_trans_ijoin(trans, dp, 0);
+ if (dp)
+ xfs_trans_ijoin(trans, dp, 0);
return 0;
}
return ptr;
}
-xfs_trans_t *
-libxfs_trans_dup(
- xfs_trans_t *tp)
-{
- xfs_trans_t *ptr;
-
- ptr = libxfs_trans_alloc(tp->t_mountp, tp->t_type);
-#ifdef XACT_DEBUG
- fprintf(stderr, "duplicated transaction %p (new=%p)\n", tp, ptr);
-#endif
- return ptr;
-}
-
int
libxfs_trans_reserve(
struct xfs_trans *tp,
{
xfs_buf_t *ialloc_context;
xfs_inode_t *ip;
- xfs_trans_t *ntp;
int error;
ialloc_context = (xfs_buf_t *)0;
}
if (ialloc_context) {
- struct xfs_trans_res tres;
xfs_trans_bhold(*tp, ialloc_context);
- tres.tr_logres = (*tp)->t_log_res;
- tres.tr_logcount = (*tp)->t_log_count;
-
- ntp = xfs_trans_dup(*tp);
- xfs_trans_commit(*tp, 0);
- *tp = ntp;
- tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
- error = xfs_trans_reserve(*tp, &tres, 0, 0);
+
+ error = xfs_trans_roll(tp, NULL);
if (error) {
- fprintf(stderr, _("%s: cannot reserve space: %s\n"),
+ fprintf(stderr, _("%s: cannot duplicate transaction: %s\n"),
progname, strerror(error));
exit(1);
}