Commit 410c1988 authored by Allison Collins's avatar Allison Collins Committed by Darrick J. Wong

xfs: Add remote block helper functions

This patch adds two new helper functions xfs_attr_store_rmt_blk and
xfs_attr_restore_rmt_blk. These two helpers assist to remove redundant
code associated with storing and retrieving remote blocks during the
attr set operations.
Signed-off-by: default avatarAllison Collins <allison.henderson@oracle.com>
Reviewed-by: default avatarChandan Rajendra <chandanrlinux@gmail.com>
Reviewed-by: default avatarAmir Goldstein <amir73il@gmail.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Acked-by: default avatarDave Chinner <dchinner@redhat.com>
parent f44df68c
...@@ -564,6 +564,30 @@ xfs_attr_shortform_addname(xfs_da_args_t *args) ...@@ -564,6 +564,30 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
* External routines when attribute list is one block * External routines when attribute list is one block
*========================================================================*/ *========================================================================*/
/* Store info about a remote block */
STATIC void
xfs_attr_save_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 * Tries to add an attribute to an inode in leaf form
* *
...@@ -598,11 +622,7 @@ xfs_attr_leaf_try_add( ...@@ -598,11 +622,7 @@ xfs_attr_leaf_try_add(
/* save the attribute state for later removal*/ /* save the attribute state for later removal*/
args->op_flags |= XFS_DA_OP_RENAME; /* an atomic rename */ args->op_flags |= XFS_DA_OP_RENAME; /* an atomic rename */
args->blkno2 = args->blkno; /* set 2nd entry info*/ xfs_attr_save_rmt_blk(args);
args->index2 = args->index;
args->rmtblkno2 = args->rmtblkno;
args->rmtblkcnt2 = args->rmtblkcnt;
args->rmtvaluelen2 = args->rmtvaluelen;
/* /*
* clear the remote attr state now that it is saved so that the * clear the remote attr state now that it is saved so that the
...@@ -701,11 +721,8 @@ xfs_attr_leaf_addname( ...@@ -701,11 +721,8 @@ xfs_attr_leaf_addname(
* Dismantle the "old" attribute/value pair by removing * Dismantle the "old" attribute/value pair by removing
* a "remote" value (if it exists). * a "remote" value (if it exists).
*/ */
args->index = args->index2; xfs_attr_restore_rmt_blk(args);
args->blkno = args->blkno2;
args->rmtblkno = args->rmtblkno2;
args->rmtblkcnt = args->rmtblkcnt2;
args->rmtvaluelen = args->rmtvaluelen2;
if (args->rmtblkno) { if (args->rmtblkno) {
error = xfs_attr_rmtval_invalidate(args); error = xfs_attr_rmtval_invalidate(args);
if (error) if (error)
...@@ -919,11 +936,7 @@ xfs_attr_node_addname( ...@@ -919,11 +936,7 @@ xfs_attr_node_addname(
/* save the attribute state for later removal*/ /* save the attribute state for later removal*/
args->op_flags |= XFS_DA_OP_RENAME; /* atomic rename op */ args->op_flags |= XFS_DA_OP_RENAME; /* atomic rename op */
args->blkno2 = args->blkno; /* set 2nd entry info*/ xfs_attr_save_rmt_blk(args);
args->index2 = args->index;
args->rmtblkno2 = args->rmtblkno;
args->rmtblkcnt2 = args->rmtblkcnt;
args->rmtvaluelen2 = args->rmtvaluelen;
/* /*
* clear the remote attr state now that it is saved so that the * clear the remote attr state now that it is saved so that the
...@@ -1035,11 +1048,8 @@ xfs_attr_node_addname( ...@@ -1035,11 +1048,8 @@ xfs_attr_node_addname(
* Dismantle the "old" attribute/value pair by removing * Dismantle the "old" attribute/value pair by removing
* a "remote" value (if it exists). * a "remote" value (if it exists).
*/ */
args->index = args->index2; xfs_attr_restore_rmt_blk(args);
args->blkno = args->blkno2;
args->rmtblkno = args->rmtblkno2;
args->rmtblkcnt = args->rmtblkcnt2;
args->rmtvaluelen = args->rmtvaluelen2;
if (args->rmtblkno) { if (args->rmtblkno) {
error = xfs_attr_rmtval_invalidate(args); error = xfs_attr_rmtval_invalidate(args);
if (error) if (error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment