]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: Skip flip flags for delayed attrs
authorAllison Henderson <allison.henderson@oracle.com>
Wed, 22 Jun 2022 19:28:52 +0000 (14:28 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 22 Jun 2022 19:28:52 +0000 (14:28 -0500)
Source kernel commit: f38dc503d366b589d98d5676a5b279d10b47bcb9

This is a clean up patch that skips the flip flag logic for delayed attr
renames.  Since the log replay keeps the inode locked, we do not need to
worry about race windows with attr lookups.  So we can skip over
flipping the flag and the extra transaction roll for it

Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_attr.c
libxfs/xfs_attr_leaf.c

index b0608f725cde62452c482557441f600ab1977afc..49c7ddb2fa4a882ceb5017cea04179fc675093b2 100644 (file)
@@ -357,6 +357,7 @@ xfs_attr_set_iter(
        struct xfs_inode                *dp = args->dp;
        struct xfs_buf                  *bp = NULL;
        int                             forkoff, error = 0;
+       struct xfs_mount                *mp = args->dp->i_mount;
 
        /* State machine switch */
        switch (dac->dela_state) {
@@ -479,16 +480,21 @@ xfs_attr_set_iter(
                 * In a separate transaction, set the incomplete flag on the
                 * "old" attr and clear the incomplete flag on the "new" attr.
                 */
-               error = xfs_attr3_leaf_flipflags(args);
-               if (error)
-                       return error;
-               /*
-                * Commit the flag value change and start the next trans in
-                * series.
-                */
-               dac->dela_state = XFS_DAS_FLIP_LFLAG;
-               trace_xfs_attr_set_iter_return(dac->dela_state, args->dp);
-               return -EAGAIN;
+               if (!xfs_has_larp(mp)) {
+                       error = xfs_attr3_leaf_flipflags(args);
+                       if (error)
+                               return error;
+                       /*
+                        * Commit the flag value change and start the next trans
+                        * in series.
+                        */
+                       dac->dela_state = XFS_DAS_FLIP_LFLAG;
+                       trace_xfs_attr_set_iter_return(dac->dela_state,
+                                                      args->dp);
+                       return -EAGAIN;
+               }
+
+               fallthrough;
        case XFS_DAS_FLIP_LFLAG:
                /*
                 * Dismantle the "old" attribute/value pair by removing a
@@ -591,17 +597,21 @@ xfs_attr_set_iter(
                 * In a separate transaction, set the incomplete flag on the
                 * "old" attr and clear the incomplete flag on the "new" attr.
                 */
-               error = xfs_attr3_leaf_flipflags(args);
-               if (error)
-                       goto out;
-               /*
-                * Commit the flag value change and start the next trans in
-                * series
-                */
-               dac->dela_state = XFS_DAS_FLIP_NFLAG;
-               trace_xfs_attr_set_iter_return(dac->dela_state, args->dp);
-               return -EAGAIN;
+               if (!xfs_has_larp(mp)) {
+                       error = xfs_attr3_leaf_flipflags(args);
+                       if (error)
+                               goto out;
+                       /*
+                        * Commit the flag value change and start the next trans
+                        * in series
+                        */
+                       dac->dela_state = XFS_DAS_FLIP_NFLAG;
+                       trace_xfs_attr_set_iter_return(dac->dela_state,
+                                                      args->dp);
+                       return -EAGAIN;
+               }
 
+               fallthrough;
        case XFS_DAS_FLIP_NFLAG:
                /*
                 * Dismantle the "old" attribute/value pair by removing a
@@ -1272,6 +1282,7 @@ xfs_attr_node_addname_clear_incomplete(
 {
        struct xfs_da_args              *args = dac->da_args;
        struct xfs_da_state             *state = NULL;
+       struct xfs_mount                *mp = args->dp->i_mount;
        int                             retval = 0;
        int                             error = 0;
 
@@ -1279,7 +1290,8 @@ xfs_attr_node_addname_clear_incomplete(
         * Re-find the "old" attribute entry after any split ops. The INCOMPLETE
         * flag means that we will find the "old" attr, not the "new" one.
         */
-       args->attr_filter |= XFS_ATTR_INCOMPLETE;
+       if (!xfs_has_larp(mp))
+               args->attr_filter |= XFS_ATTR_INCOMPLETE;
        state = xfs_da_state_alloc(args);
        state->inleaf = 0;
        error = xfs_da3_node_lookup_int(state, &retval);
index 31eddb543308357a967b5983e9420a018bcb5fc8..45d1b0634db4801fac85b50011c777ef32e0c943 100644 (file)
@@ -1484,7 +1484,8 @@ xfs_attr3_leaf_add_work(
        if (tmp)
                entry->flags |= XFS_ATTR_LOCAL;
        if (args->op_flags & XFS_DA_OP_RENAME) {
-               entry->flags |= XFS_ATTR_INCOMPLETE;
+               if (!xfs_has_larp(mp))
+                       entry->flags |= XFS_ATTR_INCOMPLETE;
                if ((args->blkno2 == args->blkno) &&
                    (args->index2 <= args->index)) {
                        args->index2++;