xfs: Pull up xfs_attr_rmtval_invalidate
authorAllison Collins <allison.henderson@oracle.com>
Tue, 21 Jul 2020 04:47:26 +0000 (21:47 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 29 Jul 2020 03:28:11 +0000 (20:28 -0700)
This patch pulls xfs_attr_rmtval_invalidate out of
xfs_attr_rmtval_remove and into the calling functions.  Eventually
__xfs_attr_rmtval_remove will replace xfs_attr_rmtval_remove when we
introduce delayed attributes.  These functions are exepcted to return
-EAGAIN when they need a new transaction.  Because the invalidate does
not need a new transaction, we need to separate it from the rest of the
function that does.  This will enable __xfs_attr_rmtval_remove to
smoothly replace xfs_attr_rmtval_remove later.

Signed-off-by: Allison Collins <allison.henderson@oracle.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>
fs/xfs/libxfs/xfs_attr.c
fs/xfs/libxfs/xfs_attr_remote.c

index 2d84ab40b70b4b91a06b6f8298a96daf6b39dbbb..2379d5b1a1b91d2e91f597103feea2e4b459daea 100644 (file)
@@ -670,6 +670,10 @@ xfs_attr_leaf_addname(
                args->rmtblkcnt = args->rmtblkcnt2;
                args->rmtvaluelen = args->rmtvaluelen2;
                if (args->rmtblkno) {
+                       error = xfs_attr_rmtval_invalidate(args);
+                       if (error)
+                               return error;
+
                        error = xfs_attr_rmtval_remove(args);
                        if (error)
                                return error;
@@ -1023,6 +1027,10 @@ restart:
                args->rmtblkcnt = args->rmtblkcnt2;
                args->rmtvaluelen = args->rmtvaluelen2;
                if (args->rmtblkno) {
+                       error = xfs_attr_rmtval_invalidate(args);
+                       if (error)
+                               return error;
+
                        error = xfs_attr_rmtval_remove(args);
                        if (error)
                                return error;
@@ -1147,6 +1155,10 @@ xfs_attr_node_removename(
                if (error)
                        goto out;
 
+               error = xfs_attr_rmtval_invalidate(args);
+               if (error)
+                       return error;
+
                error = xfs_attr_rmtval_remove(args);
                if (error)
                        goto out;
index 3e7f6e07586043692d0d6d2eb6f68932ce4e4e0c..3f80cede74063e50152b3673539d151701c68fce 100644 (file)
@@ -683,9 +683,6 @@ xfs_attr_rmtval_remove(
 
        trace_xfs_attr_rmtval_remove(args);
 
-       error = xfs_attr_rmtval_invalidate(args);
-       if (error)
-               return error;
        /*
         * Keep de-allocating extents until the remote-value region is gone.
         */