]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: Add helper function xfs_attr_leaf_mark_incomplete
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: f44df68c82dc060b9b9942e204096447e1efc677

This patch helps to simplify xfs_attr_node_removename by modularizing
the code around the transactions into helper functions.  This will make
the function easier to follow when we introduce delayed attributes.

Signed-off-by: Allison Collins <allison.henderson@oracle.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Chandan Rajendra <chandanrlinux@gmail.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.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 b1d0a49e8b9b410340739bc9ea646aa2d70b5891..211c37a553db1d4ff94363dda90e375a18cfc01e 100644 (file)
@@ -1131,6 +1131,32 @@ xfs_attr_node_shrink(
        return error;
 }
 
+/*
+ * Mark an attribute entry INCOMPLETE and save pointers to the relevant buffers
+ * for later deletion of the entry.
+ */
+STATIC int
+xfs_attr_leaf_mark_incomplete(
+       struct xfs_da_args      *args,
+       struct xfs_da_state     *state)
+{
+       int                     error;
+
+       /*
+        * Fill in disk block numbers in the state structure
+        * so that we can get the buffers back after we commit
+        * several transactions in the following calls.
+        */
+       error = xfs_attr_fillstate(state);
+       if (error)
+               return error;
+
+       /*
+        * Mark the attribute as INCOMPLETE
+        */
+       return xfs_attr3_leaf_setflag(args);
+}
+
 /*
  * Remove a name from a B-tree attribute list.
  *
@@ -1162,20 +1188,7 @@ xfs_attr_node_removename(
        ASSERT(blk->bp != NULL);
        ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC);
        if (args->rmtblkno > 0) {
-               /*
-                * Fill in disk block numbers in the state structure
-                * so that we can get the buffers back after we commit
-                * several transactions in the following calls.
-                */
-               error = xfs_attr_fillstate(state);
-               if (error)
-                       goto out;
-
-               /*
-                * Mark the attribute as INCOMPLETE, then bunmapi() the
-                * remote value.
-                */
-               error = xfs_attr3_leaf_setflag(args);
+               error = xfs_attr_leaf_mark_incomplete(args, state);
                if (error)
                        goto out;