]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: Lift -ENOSPC handler from xfs_attr_leaf_addname
authorAllison Collins <allison.henderson@oracle.com>
Tue, 15 Sep 2020 19:59:37 +0000 (15:59 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Tue, 15 Sep 2020 19:59:37 +0000 (15:59 -0400)
Source kernel commit: 0f89edcd8e8484dd1790ec474a650dd774c6b75e

Lift -ENOSPC handler from xfs_attr_leaf_addname.  This will help to
reorganize transitions between the attr forms later.

Signed-off-by: Allison Collins <allison.henderson@oracle.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Acked-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_attr.c

index cf5948956fc85dae66d9749a6a1bb6ab5215dbd4..1c1092fe6d53bd7b7b42cd6e8a4237c252e20aa6 100644 (file)
@@ -298,6 +298,13 @@ xfs_attr_set_args(
                if (error != -ENOSPC)
                        return error;
 
+               /*
+                * Promote the attribute list to the Btree format.
+                */
+               error = xfs_attr3_leaf_to_node(args);
+               if (error)
+                       return error;
+
                /*
                 * Finish any deferred work items and roll the transaction once
                 * more.  The goal here is to call node_addname with the inode
@@ -603,7 +610,7 @@ xfs_attr_leaf_try_add(
        struct xfs_da_args      *args,
        struct xfs_buf          *bp)
 {
-       int                     retval, error;
+       int                     retval;
 
        /*
         * Look up the given attribute in the leaf block.  Figure out if
@@ -635,20 +642,10 @@ xfs_attr_leaf_try_add(
        }
 
        /*
-        * Add the attribute to the leaf block, transitioning to a Btree
-        * if required.
+        * Add the attribute to the leaf block
         */
-       retval = xfs_attr3_leaf_add(bp, args);
-       if (retval == -ENOSPC) {
-               /*
-                * Promote the attribute list to the Btree format. Unless an
-                * error occurs, retain the -ENOSPC retval
-                */
-               error = xfs_attr3_leaf_to_node(args);
-               if (error)
-                       return error;
-       }
-       return retval;
+       return xfs_attr3_leaf_add(bp, args);
+
 out_brelse:
        xfs_trans_brelse(args->trans, bp);
        return retval;