提交 0feaef17 编写于 作者: A Allison Collins 提交者: Darrick J. Wong

xfs: Remove unneeded xfs_trans_roll_inode calls

Some calls to xfs_trans_roll_inode and xfs_defer_finish routines are not
needed. If they are the last operations executed in these functions, and
no further changes are made, then higher level routines will roll or
commit the transactions.
Signed-off-by: NAllison Collins <allison.henderson@oracle.com>
Reviewed-by: NBrian Foster <bfoster@redhat.com>
Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
Acked-by: NDave Chinner <dchinner@redhat.com>
上级 3f6e011e
...@@ -693,34 +693,15 @@ xfs_attr_leaf_addname( ...@@ -693,34 +693,15 @@ xfs_attr_leaf_addname(
/* /*
* If the result is small enough, shrink it all into the inode. * If the result is small enough, shrink it all into the inode.
*/ */
if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { forkoff = xfs_attr_shortform_allfit(bp, dp);
if (forkoff)
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
/* bp is gone due to xfs_da_shrink_inode */ /* bp is gone due to xfs_da_shrink_inode */
if (error)
return error;
error = xfs_defer_finish(&args->trans);
if (error)
return error;
}
/*
* Commit the remove and start the next trans in series.
*/
error = xfs_trans_roll_inode(&args->trans, dp);
} else if (args->rmtblkno > 0) { } else if (args->rmtblkno > 0) {
/* /*
* Added a "remote" value, just clear the incomplete flag. * Added a "remote" value, just clear the incomplete flag.
*/ */
error = xfs_attr3_leaf_clearflag(args); error = xfs_attr3_leaf_clearflag(args);
if (error)
return error;
/*
* Commit the flag value change and start the next trans in
* series.
*/
error = xfs_trans_roll_inode(&args->trans, args->dp);
} }
return error; return error;
} }
...@@ -780,15 +761,11 @@ xfs_attr_leaf_removename( ...@@ -780,15 +761,11 @@ xfs_attr_leaf_removename(
/* /*
* If the result is small enough, shrink it all into the inode. * If the result is small enough, shrink it all into the inode.
*/ */
if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { forkoff = xfs_attr_shortform_allfit(bp, dp);
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); if (forkoff)
return xfs_attr3_leaf_to_shortform(bp, args, forkoff);
/* bp is gone due to xfs_da_shrink_inode */ /* bp is gone due to xfs_da_shrink_inode */
if (error)
return error;
error = xfs_defer_finish(&args->trans);
if (error)
return error;
}
return 0; return 0;
} }
...@@ -1064,18 +1041,8 @@ xfs_attr_node_addname( ...@@ -1064,18 +1041,8 @@ xfs_attr_node_addname(
error = xfs_da3_join(state); error = xfs_da3_join(state);
if (error) if (error)
goto out; goto out;
error = xfs_defer_finish(&args->trans);
if (error)
goto out;
} }
/*
* Commit and start the next trans in the chain.
*/
error = xfs_trans_roll_inode(&args->trans, dp);
if (error)
goto out;
} else if (args->rmtblkno > 0) { } else if (args->rmtblkno > 0) {
/* /*
* Added a "remote" value, just clear the incomplete flag. * Added a "remote" value, just clear the incomplete flag.
...@@ -1083,14 +1050,6 @@ xfs_attr_node_addname( ...@@ -1083,14 +1050,6 @@ xfs_attr_node_addname(
error = xfs_attr3_leaf_clearflag(args); error = xfs_attr3_leaf_clearflag(args);
if (error) if (error)
goto out; goto out;
/*
* Commit the flag value change and start the next trans in
* series.
*/
error = xfs_trans_roll_inode(&args->trans, args->dp);
if (error)
goto out;
} }
retval = error = 0; retval = error = 0;
...@@ -1129,16 +1088,10 @@ xfs_attr_node_shrink( ...@@ -1129,16 +1088,10 @@ xfs_attr_node_shrink(
if (forkoff) { if (forkoff) {
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
/* bp is gone due to xfs_da_shrink_inode */ /* bp is gone due to xfs_da_shrink_inode */
if (error)
return error;
error = xfs_defer_finish(&args->trans);
if (error)
return error;
} else } else
xfs_trans_brelse(args->trans, bp); xfs_trans_brelse(args->trans, bp);
return 0; return error;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册