@@ -785,6 +785,30 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
* External routines when attribute list is one block
*========================================================================*/
+/* Store info about a remote block */
+STATIC void
+xfs_attr_store_rmt_blk(
+ struct xfs_da_args *args)
+{
+ args->blkno2 = args->blkno;
+ args->index2 = args->index;
+ args->rmtblkno2 = args->rmtblkno;
+ args->rmtblkcnt2 = args->rmtblkcnt;
+ args->rmtvaluelen2 = args->rmtvaluelen;
+}
+
+/* Set stored info about a remote block */
+STATIC void
+xfs_attr_restore_rmt_blk(
+ struct xfs_da_args *args)
+{
+ args->blkno = args->blkno2;
+ args->index = args->index2;
+ args->rmtblkno = args->rmtblkno2;
+ args->rmtblkcnt = args->rmtblkcnt2;
+ args->rmtvaluelen = args->rmtvaluelen2;
+}
+
/*
* Tries to add an attribute to an inode in leaf form
*
@@ -823,11 +847,7 @@ xfs_attr_leaf_try_add(
/* save the attribute state for later removal*/
args->op_flags |= XFS_DA_OP_RENAME; /* an atomic rename */
- args->blkno2 = args->blkno; /* set 2nd entry info*/
- args->index2 = args->index;
- args->rmtblkno2 = args->rmtblkno;
- args->rmtblkcnt2 = args->rmtblkcnt;
- args->rmtvaluelen2 = args->rmtvaluelen;
+ xfs_attr_store_rmt_blk(args);
/*
* clear the remote attr state now that it is saved so that the
@@ -938,11 +958,7 @@ alloc_leaf:
* Dismantle the "old" attribute/value pair by removing
* a "remote" value (if it exists).
*/
- args->index = args->index2;
- args->blkno = args->blkno2;
- args->rmtblkno = args->rmtblkno2;
- args->rmtblkcnt = args->rmtblkcnt2;
- args->rmtvaluelen = args->rmtvaluelen2;
+ xfs_attr_restore_rmt_blk(args);
args->dac.dela_state = XFS_DAS_FLIP_LFLAG;
return -EAGAIN;
@@ -1187,11 +1203,7 @@ xfs_attr_node_addname(
/* save the attribute state for later removal*/
args->op_flags |= XFS_DA_OP_RENAME; /* atomic rename op */
- args->blkno2 = args->blkno; /* set 2nd entry info*/
- args->index2 = args->index;
- args->rmtblkno2 = args->rmtblkno;
- args->rmtblkcnt2 = args->rmtblkcnt;
- args->rmtvaluelen2 = args->rmtvaluelen;
+ xfs_attr_store_rmt_blk(args);
/*
* clear the remote attr state now that it is saved so that the
@@ -1304,11 +1316,7 @@ alloc_node:
* Dismantle the "old" attribute/value pair by removing
* a "remote" value (if it exists).
*/
- args->index = args->index2;
- args->blkno = args->blkno2;
- args->rmtblkno = args->rmtblkno2;
- args->rmtblkcnt = args->rmtblkcnt2;
- args->rmtvaluelen = args->rmtvaluelen2;
+ xfs_attr_restore_rmt_blk(args);
/*
* Commit the flag value change and start the next trans in
This patch adds two new helper functions xfs_attr_store_rmt_blk and xfs_attr_restore_rmt_blk. These two helpers assist to remove redunant code associated with storing and retrieving remote blocks during the attr set operations. Signed-off-by: Allison Collins <allison.henderson@oracle.com> --- libxfs/xfs_attr.c | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-)