]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - fs/xfs/libxfs/xfs_attr.c
xfs: eliminate committed arg from xfs_bmap_finish
[mirror_ubuntu-zesty-kernel.git] / fs / xfs / libxfs / xfs_attr.c
index ff065578969f27cd40065043ebfe292c5743ab4e..fa3b948ef9c2561e8b34aae282ca8c0f02a22abc 100644 (file)
@@ -125,7 +125,7 @@ xfs_attr_get(
        uint                    lock_mode;
        int                     error;
 
-       XFS_STATS_INC(xs_attr_get);
+       XFS_STATS_INC(ip->i_mount, xs_attr_get);
 
        if (XFS_FORCED_SHUTDOWN(ip->i_mount))
                return -EIO;
@@ -207,9 +207,9 @@ xfs_attr_set(
        struct xfs_trans_res    tres;
        xfs_fsblock_t           firstblock;
        int                     rsvd = (flags & ATTR_ROOT) != 0;
-       int                     error, err2, committed, local;
+       int                     error, err2, local;
 
-       XFS_STATS_INC(xs_attr_set);
+       XFS_STATS_INC(mp, xs_attr_set);
 
        if (XFS_FORCED_SHUTDOWN(dp->i_mount))
                return -EIO;
@@ -334,24 +334,14 @@ xfs_attr_set(
                 */
                xfs_bmap_init(args.flist, args.firstblock);
                error = xfs_attr_shortform_to_leaf(&args);
-               if (!error) {
-                       error = xfs_bmap_finish(&args.trans, args.flist,
-                                               &committed);
-               }
+               if (!error)
+                       error = xfs_bmap_finish(&args.trans, args.flist, dp);
                if (error) {
-                       ASSERT(committed);
                        args.trans = NULL;
                        xfs_bmap_cancel(&flist);
                        goto out;
                }
 
-               /*
-                * bmap_finish() may have committed the last trans and started
-                * a new one.  We need the inode to be in all transactions.
-                */
-               if (committed)
-                       xfs_trans_ijoin(args.trans, dp, 0);
-
                /*
                 * Commit the leaf transformation.  We'll need another (linked)
                 * transaction to add the new attribute to the leaf.
@@ -412,7 +402,7 @@ xfs_attr_remove(
        xfs_fsblock_t           firstblock;
        int                     error;
 
-       XFS_STATS_INC(xs_attr_remove);
+       XFS_STATS_INC(mp, xs_attr_remove);
 
        if (XFS_FORCED_SHUTDOWN(dp->i_mount))
                return -EIO;
@@ -568,7 +558,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
 {
        xfs_inode_t *dp;
        struct xfs_buf *bp;
-       int retval, error, committed, forkoff;
+       int retval, error, forkoff;
 
        trace_xfs_attr_leaf_addname(args);
 
@@ -628,24 +618,14 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
                 */
                xfs_bmap_init(args->flist, args->firstblock);
                error = xfs_attr3_leaf_to_node(args);
-               if (!error) {
-                       error = xfs_bmap_finish(&args->trans, args->flist,
-                                               &committed);
-               }
+               if (!error)
+                       error = xfs_bmap_finish(&args->trans, args->flist, dp);
                if (error) {
-                       ASSERT(committed);
                        args->trans = NULL;
                        xfs_bmap_cancel(args->flist);
                        return error;
                }
 
-               /*
-                * bmap_finish() may have committed the last trans and started
-                * a new one.  We need the inode to be in all transactions.
-                */
-               if (committed)
-                       xfs_trans_ijoin(args->trans, dp, 0);
-
                /*
                 * Commit the current trans (including the inode) and start
                 * a new one.
@@ -729,25 +709,14 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
                        xfs_bmap_init(args->flist, args->firstblock);
                        error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
                        /* bp is gone due to xfs_da_shrink_inode */
-                       if (!error) {
+                       if (!error)
                                error = xfs_bmap_finish(&args->trans,
-                                                       args->flist,
-                                                       &committed);
-                       }
+                                                       args->flist, dp);
                        if (error) {
-                               ASSERT(committed);
                                args->trans = NULL;
                                xfs_bmap_cancel(args->flist);
                                return error;
                        }
-
-                       /*
-                        * bmap_finish() may have committed the last trans
-                        * and started a new one.  We need the inode to be
-                        * in all transactions.
-                        */
-                       if (committed)
-                               xfs_trans_ijoin(args->trans, dp, 0);
                }
 
                /*
@@ -775,7 +744,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
 {
        xfs_inode_t *dp;
        struct xfs_buf *bp;
-       int error, committed, forkoff;
+       int error, forkoff;
 
        trace_xfs_attr_leaf_removename(args);
 
@@ -803,23 +772,13 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
                xfs_bmap_init(args->flist, args->firstblock);
                error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
                /* bp is gone due to xfs_da_shrink_inode */
-               if (!error) {
-                       error = xfs_bmap_finish(&args->trans, args->flist,
-                                               &committed);
-               }
+               if (!error)
+                       error = xfs_bmap_finish(&args->trans, args->flist, dp);
                if (error) {
-                       ASSERT(committed);
                        args->trans = NULL;
                        xfs_bmap_cancel(args->flist);
                        return error;
                }
-
-               /*
-                * bmap_finish() may have committed the last trans and started
-                * a new one.  We need the inode to be in all transactions.
-                */
-               if (committed)
-                       xfs_trans_ijoin(args->trans, dp, 0);
        }
        return 0;
 }
@@ -877,7 +836,7 @@ xfs_attr_node_addname(xfs_da_args_t *args)
        xfs_da_state_blk_t *blk;
        xfs_inode_t *dp;
        xfs_mount_t *mp;
-       int committed, retval, error;
+       int retval, error;
 
        trace_xfs_attr_node_addname(args);
 
@@ -938,26 +897,15 @@ restart:
                        state = NULL;
                        xfs_bmap_init(args->flist, args->firstblock);
                        error = xfs_attr3_leaf_to_node(args);
-                       if (!error) {
+                       if (!error)
                                error = xfs_bmap_finish(&args->trans,
-                                                       args->flist,
-                                                       &committed);
-                       }
+                                                       args->flist, dp);
                        if (error) {
-                               ASSERT(committed);
                                args->trans = NULL;
                                xfs_bmap_cancel(args->flist);
                                goto out;
                        }
 
-                       /*
-                        * bmap_finish() may have committed the last trans
-                        * and started a new one.  We need the inode to be
-                        * in all transactions.
-                        */
-                       if (committed)
-                               xfs_trans_ijoin(args->trans, dp, 0);
-
                        /*
                         * Commit the node conversion and start the next
                         * trans in the chain.
@@ -977,23 +925,13 @@ restart:
                 */
                xfs_bmap_init(args->flist, args->firstblock);
                error = xfs_da3_split(state);
-               if (!error) {
-                       error = xfs_bmap_finish(&args->trans, args->flist,
-                                               &committed);
-               }
+               if (!error)
+                       error = xfs_bmap_finish(&args->trans, args->flist, dp);
                if (error) {
-                       ASSERT(committed);
                        args->trans = NULL;
                        xfs_bmap_cancel(args->flist);
                        goto out;
                }
-
-               /*
-                * bmap_finish() may have committed the last trans and started
-                * a new one.  We need the inode to be in all transactions.
-                */
-               if (committed)
-                       xfs_trans_ijoin(args->trans, dp, 0);
        } else {
                /*
                 * Addition succeeded, update Btree hashvals.
@@ -1086,25 +1024,14 @@ restart:
                if (retval && (state->path.active > 1)) {
                        xfs_bmap_init(args->flist, args->firstblock);
                        error = xfs_da3_join(state);
-                       if (!error) {
+                       if (!error)
                                error = xfs_bmap_finish(&args->trans,
-                                                       args->flist,
-                                                       &committed);
-                       }
+                                                       args->flist, dp);
                        if (error) {
-                               ASSERT(committed);
                                args->trans = NULL;
                                xfs_bmap_cancel(args->flist);
                                goto out;
                        }
-
-                       /*
-                        * bmap_finish() may have committed the last trans
-                        * and started a new one.  We need the inode to be
-                        * in all transactions.
-                        */
-                       if (committed)
-                               xfs_trans_ijoin(args->trans, dp, 0);
                }
 
                /*
@@ -1146,7 +1073,7 @@ xfs_attr_node_removename(xfs_da_args_t *args)
        xfs_da_state_blk_t *blk;
        xfs_inode_t *dp;
        struct xfs_buf *bp;
-       int retval, error, committed, forkoff;
+       int retval, error, forkoff;
 
        trace_xfs_attr_node_removename(args);
 
@@ -1220,24 +1147,13 @@ xfs_attr_node_removename(xfs_da_args_t *args)
        if (retval && (state->path.active > 1)) {
                xfs_bmap_init(args->flist, args->firstblock);
                error = xfs_da3_join(state);
-               if (!error) {
-                       error = xfs_bmap_finish(&args->trans, args->flist,
-                                               &committed);
-               }
+               if (!error)
+                       error = xfs_bmap_finish(&args->trans, args->flist, dp);
                if (error) {
-                       ASSERT(committed);
                        args->trans = NULL;
                        xfs_bmap_cancel(args->flist);
                        goto out;
                }
-
-               /*
-                * bmap_finish() may have committed the last trans and started
-                * a new one.  We need the inode to be in all transactions.
-                */
-               if (committed)
-                       xfs_trans_ijoin(args->trans, dp, 0);
-
                /*
                 * Commit the Btree join operation and start a new trans.
                 */
@@ -1265,25 +1181,14 @@ xfs_attr_node_removename(xfs_da_args_t *args)
                        xfs_bmap_init(args->flist, args->firstblock);
                        error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
                        /* bp is gone due to xfs_da_shrink_inode */
-                       if (!error) {
+                       if (!error)
                                error = xfs_bmap_finish(&args->trans,
-                                                       args->flist,
-                                                       &committed);
-                       }
+                                                       args->flist, dp);
                        if (error) {
-                               ASSERT(committed);
                                args->trans = NULL;
                                xfs_bmap_cancel(args->flist);
                                goto out;
                        }
-
-                       /*
-                        * bmap_finish() may have committed the last trans
-                        * and started a new one.  We need the inode to be
-                        * in all transactions.
-                        */
-                       if (committed)
-                               xfs_trans_ijoin(args->trans, dp, 0);
                } else
                        xfs_trans_brelse(args->trans, bp);
        }