Commit 674eb548 authored by Allison Collins's avatar Allison Collins Committed by Darrick J. Wong

xfs: Add helper function xfs_attr_node_removename_setup

This patch adds a new helper function xfs_attr_node_removename_setup.
This will help modularize xfs_attr_node_removename when we add delay
ready attributes later.
Signed-off-by: default avatarAllison Collins <allison.henderson@oracle.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarChandan Rajendra <chandanrlinux@gmail.com>
[darrick: fix unused variable complaints by 0day robot]
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>
Reported-by: default avatarkernel test robot <lkp@intel.com>
parent 410c1988
...@@ -1167,6 +1167,37 @@ xfs_attr_leaf_mark_incomplete( ...@@ -1167,6 +1167,37 @@ xfs_attr_leaf_mark_incomplete(
return xfs_attr3_leaf_setflag(args); return xfs_attr3_leaf_setflag(args);
} }
/*
* Initial setup for xfs_attr_node_removename. Make sure the attr is there and
* the blocks are valid. Attr keys with remote blocks will be marked
* incomplete.
*/
STATIC
int xfs_attr_node_removename_setup(
struct xfs_da_args *args,
struct xfs_da_state **state)
{
int error;
error = xfs_attr_node_hasname(args, state);
if (error != -EEXIST)
return error;
ASSERT((*state)->path.blk[(*state)->path.active - 1].bp != NULL);
ASSERT((*state)->path.blk[(*state)->path.active - 1].magic ==
XFS_ATTR_LEAF_MAGIC);
if (args->rmtblkno > 0) {
error = xfs_attr_leaf_mark_incomplete(args, *state);
if (error)
return error;
return xfs_attr_rmtval_invalidate(args);
}
return 0;
}
/* /*
* Remove a name from a B-tree attribute list. * Remove a name from a B-tree attribute list.
* *
...@@ -1185,8 +1216,8 @@ xfs_attr_node_removename( ...@@ -1185,8 +1216,8 @@ xfs_attr_node_removename(
trace_xfs_attr_node_removename(args); trace_xfs_attr_node_removename(args);
error = xfs_attr_node_hasname(args, &state); error = xfs_attr_node_removename_setup(args, &state);
if (error != -EEXIST) if (error)
goto out; goto out;
/* /*
...@@ -1194,18 +1225,7 @@ xfs_attr_node_removename( ...@@ -1194,18 +1225,7 @@ xfs_attr_node_removename(
* This is done before we remove the attribute so that we don't * This is done before we remove the attribute so that we don't
* overflow the maximum size of a transaction and/or hit a deadlock. * overflow the maximum size of a transaction and/or hit a deadlock.
*/ */
blk = &state->path.blk[ state->path.active-1 ];
ASSERT(blk->bp != NULL);
ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC);
if (args->rmtblkno > 0) { if (args->rmtblkno > 0) {
error = xfs_attr_leaf_mark_incomplete(args, state);
if (error)
goto out;
error = xfs_attr_rmtval_invalidate(args);
if (error)
return error;
error = xfs_attr_rmtval_remove(args); error = xfs_attr_rmtval_remove(args);
if (error) if (error)
goto out; goto out;
......
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