diff options
| author | Allison Collins <allison.henderson@oracle.com> | 2020-07-20 21:47:30 -0700 | 
|---|---|---|
| committer | Darrick J. Wong <darrick.wong@oracle.com> | 2020-07-28 20:28:12 -0700 | 
| commit | 674eb548cf0ced1487ee229f96af2c7cf0099d2a (patch) | |
| tree | 484763436bc878864262f26e04a5687859d09a2f /fs/xfs/libxfs | |
| parent | 410c19885db5f7c4fca55b437e199e18252142b6 (diff) | |
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: Allison Collins <allison.henderson@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Chandan Rajendra <chandanrlinux@gmail.com>
[darrick: fix unused variable complaints by 0day robot]
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>
Reported-by: kernel test robot <lkp@intel.com>
Diffstat (limited to 'fs/xfs/libxfs')
| -rw-r--r-- | fs/xfs/libxfs/xfs_attr.c | 46 | 
1 files changed, 33 insertions, 13 deletions
| diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 37fda9f90b7f..bf91da55ef47 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -1168,6 +1168,37 @@ xfs_attr_leaf_mark_incomplete(  }  /* + * 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.   *   * This will involve walking down the Btree, and may involve joining @@ -1185,8 +1216,8 @@ xfs_attr_node_removename(  	trace_xfs_attr_node_removename(args); -	error = xfs_attr_node_hasname(args, &state); -	if (error != -EEXIST) +	error = xfs_attr_node_removename_setup(args, &state); +	if (error)  		goto out;  	/* @@ -1194,18 +1225,7 @@ xfs_attr_node_removename(  	 * 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.  	 */ -	blk = &state->path.blk[ state->path.active-1 ]; -	ASSERT(blk->bp != NULL); -	ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC);  	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);  		if (error)  			goto out; | 
