mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 15:42:46 +00:00
xfs: Hoist node transaction handling
This patch basically hoists the node transaction handling around the leaf code we just hoisted. This will helps setup this area for the state machine since the goto is easily replaced with a state since it ends with a transaction roll. Signed-off-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
This commit is contained in:
parent
83c6e70789
commit
3f562d092b
1 changed files with 30 additions and 27 deletions
|
@ -309,11 +309,37 @@ xfs_attr_set_args(
|
|||
|
||||
if (xfs_attr_is_leaf(dp)) {
|
||||
error = xfs_attr_leaf_try_add(args, bp);
|
||||
if (error == -ENOSPC)
|
||||
goto node;
|
||||
else if (error)
|
||||
if (error == -ENOSPC) {
|
||||
/*
|
||||
* 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
|
||||
* more. The goal here is to call node_addname with the inode
|
||||
* and transaction in the same state (inode locked and joined,
|
||||
* transaction clean) no matter how we got to this step.
|
||||
*/
|
||||
error = xfs_defer_finish(&args->trans);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
/*
|
||||
* Commit the current trans (including the inode) and
|
||||
* start a new one.
|
||||
*/
|
||||
error = xfs_trans_roll_inode(&args->trans, dp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
goto node;
|
||||
} else if (error) {
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Commit the transaction that added the attr name so that
|
||||
* later routines can manage their own transactions.
|
||||
|
@ -401,33 +427,10 @@ xfs_attr_set_args(
|
|||
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
|
||||
/* bp is gone due to xfs_da_shrink_inode */
|
||||
|
||||
return error;
|
||||
node:
|
||||
/*
|
||||
* 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
|
||||
* more. The goal here is to call node_addname with the inode
|
||||
* and transaction in the same state (inode locked and joined,
|
||||
* transaction clean) no matter how we got to this step.
|
||||
*/
|
||||
error = xfs_defer_finish(&args->trans);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
/*
|
||||
* Commit the current trans (including the inode) and
|
||||
* start a new one.
|
||||
*/
|
||||
error = xfs_trans_roll_inode(&args->trans, dp);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
node:
|
||||
|
||||
|
||||
do {
|
||||
error = xfs_attr_node_addname_find_attr(args, &state);
|
||||
|
|
Loading…
Reference in a new issue