]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs: switch the remaining xfs_trans_dup user to xfs_trans_roll
authorChristoph Hellwig <hch@lst.de>
Thu, 30 Jul 2015 23:10:58 +0000 (09:10 +1000)
committerDave Chinner <david@fromorbit.com>
Thu, 30 Jul 2015 23:10:58 +0000 (09:10 +1000)
Match the kernel API change.  Also libxfs_trans_dup can be folded into
the only caller now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
include/xfs_trans.h
libxfs/libxfs_api_defs.h
libxfs/trans.c
libxfs/util.c

index 302af350c4f45f0973273dccd71b12d6684ce498..46c29554a94a5e91af593964bdb3d250f6f29266 100644 (file)
@@ -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);
index f843e7dea090625dd14bdec981ee6aa64d107a49..e9fd9c82f5fa26c8fcd939f0d19db7975b638008 100644 (file)
@@ -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
index 885c5f4dcfb074fb0af6d8006bab90b4e5aad23f..9a44af4bad3f0cbe2af8f1bfa886596a49186e83 100644 (file)
@@ -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,
index a6b1fd1f5ab11697877b71380100b1474e616fdf..daebbe207017445d858223359bd5b45b40e16260 100644 (file)
@@ -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);
                }