[PATCH v4 07/17] xfs: Factor up trans handling in xfs_attr3_leaf_flipflags

Allison Collins
2019-11-07T01:32:09Z

Since delayed operations cannot roll transactions, factor
up the transaction handling into the calling function

Signed-off-by: Allison Collins <allison.henderson@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
---
fs/xfs/libxfs/xfs_attr.c | 14 ++++++++++++++
fs/xfs/libxfs/xfs_attr_leaf.c | 5 -----
2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index c8a3273..212995f 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -721,6 +721,13 @@ xfs_attr_leaf_addname(
error = xfs_attr3_leaf_flipflags(args);
if (error)
return error;
+ /*
+ * Commit the flag value change and start the next trans in
+ * series.
+ */
+ error = xfs_trans_roll_inode(&args->trans, args->dp);
+ if (error)
+ return error;

/*
* Dismantle the "old" attribute/value pair by removing
@@ -1057,6 +1064,13 @@ xfs_attr_node_addname(
error = xfs_attr3_leaf_flipflags(args);
if (error)
goto out;
+ /*
+ * Commit the flag value change and start the next trans in
+ * series
+ */
+ error = xfs_trans_roll_inode(&args->trans, args->dp);
+ if (error)
+ goto out;

/*
* Dismantle the "old" attribute/value pair by removing
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
index d06cfd6..134eb00 100644
--- a/fs/xfs/libxfs/xfs_attr_leaf.c
+++ b/fs/xfs/libxfs/xfs_attr_leaf.c
@@ -2973,10 +2973,5 @@ xfs_attr3_leaf_flipflags(
XFS_DA_LOGRANGE(leaf2, name_rmt, sizeof(*name_rmt)));
}

- /*
- * Commit the flag value change and start the next trans in series.
- */
- error = xfs_trans_roll_inode(&args->trans, args->dp);
-
return error;
}
--
2.7.4