Commit 0f89edcd authored by Allison Collins's avatar Allison Collins Committed by Darrick J. Wong

xfs: Lift -ENOSPC handler from xfs_attr_leaf_addname

Lift -ENOSPC handler from xfs_attr_leaf_addname.  This will help to
reorganize transitions between the attr forms later.
Signed-off-by: default avatarAllison Collins <allison.henderson@oracle.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Acked-by: default avatarDave Chinner <dchinner@redhat.com>
parent bf4a5cff
...@@ -298,6 +298,13 @@ xfs_attr_set_args( ...@@ -298,6 +298,13 @@ xfs_attr_set_args(
if (error != -ENOSPC) if (error != -ENOSPC)
return error; return error;
/*
* Promote the attribute list to the Btree format.
*/
error = xfs_attr3_leaf_to_node(args);
if (error)
return error;
/* /*
* Finish any deferred work items and roll the transaction once * Finish any deferred work items and roll the transaction once
* more. The goal here is to call node_addname with the inode * more. The goal here is to call node_addname with the inode
...@@ -603,7 +610,7 @@ xfs_attr_leaf_try_add( ...@@ -603,7 +610,7 @@ xfs_attr_leaf_try_add(
struct xfs_da_args *args, struct xfs_da_args *args,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
int retval, error; int retval;
/* /*
* Look up the given attribute in the leaf block. Figure out if * Look up the given attribute in the leaf block. Figure out if
...@@ -635,20 +642,10 @@ xfs_attr_leaf_try_add( ...@@ -635,20 +642,10 @@ xfs_attr_leaf_try_add(
} }
/* /*
* Add the attribute to the leaf block, transitioning to a Btree * Add the attribute to the leaf block
* if required.
*/ */
retval = xfs_attr3_leaf_add(bp, args); return xfs_attr3_leaf_add(bp, args);
if (retval == -ENOSPC) {
/*
* Promote the attribute list to the Btree format. Unless an
* error occurs, retain the -ENOSPC retval
*/
error = xfs_attr3_leaf_to_node(args);
if (error)
return error;
}
return retval;
out_brelse: out_brelse:
xfs_trans_brelse(args->trans, bp); xfs_trans_brelse(args->trans, bp);
return retval; return retval;
......
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