From: Christoph Hellwig Date: Thu, 30 Jul 2015 23:10:58 +0000 (+1000) Subject: libxfs: switch the remaining xfs_trans_dup user to xfs_trans_roll X-Git-Tag: v4.2.0-rc1~4^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d262295d562c149d8c621eb9dcb324fbbd316a70;p=thirdparty%2Fxfsprogs-dev.git libxfs: switch the remaining xfs_trans_dup user to xfs_trans_roll Match the kernel API change. Also libxfs_trans_dup can be folded into the only caller now. Signed-off-by: Christoph Hellwig Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- diff --git a/include/xfs_trans.h b/include/xfs_trans.h index 302af350c..46c29554a 100644 --- a/include/xfs_trans.h +++ b/include/xfs_trans.h @@ -87,7 +87,6 @@ void xfs_trans_init(struct xfs_mount *); 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); diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index f843e7dea..e9fd9c82f 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -40,7 +40,6 @@ #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 diff --git a/libxfs/trans.c b/libxfs/trans.c index 885c5f4dc..9a44af4ba 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -109,14 +109,15 @@ libxfs_trans_roll( * 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. @@ -147,7 +148,8 @@ libxfs_trans_roll( if (error) return error; - xfs_trans_ijoin(trans, dp, 0); + if (dp) + xfs_trans_ijoin(trans, dp, 0); return 0; } @@ -172,19 +174,6 @@ libxfs_trans_alloc( 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, diff --git a/libxfs/util.c b/libxfs/util.c index a6b1fd1f5..daebbe207 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -641,7 +641,6 @@ libxfs_inode_alloc( { xfs_buf_t *ialloc_context; xfs_inode_t *ip; - xfs_trans_t *ntp; int error; ialloc_context = (xfs_buf_t *)0; @@ -657,19 +656,12 @@ libxfs_inode_alloc( } 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); }