Skip to content

Commit 0feaef1

Browse files
allisonhendersondjwong
authored andcommitted
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: Allison Collins <[email protected]> Reviewed-by: Brian Foster <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]> Acked-by: Dave Chinner <[email protected]>
1 parent 3f6e011 commit 0feaef1

File tree

1 file changed

+7
-54
lines changed

1 file changed

+7
-54
lines changed

fs/xfs/libxfs/xfs_attr.c

Lines changed: 7 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -693,34 +693,15 @@ xfs_attr_leaf_addname(
693693
/*
694694
* If the result is small enough, shrink it all into the inode.
695695
*/
696-
if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
696+
forkoff = xfs_attr_shortform_allfit(bp, dp);
697+
if (forkoff)
697698
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
698699
/* bp is gone due to xfs_da_shrink_inode */
699-
if (error)
700-
return error;
701-
error = xfs_defer_finish(&args->trans);
702-
if (error)
703-
return error;
704-
}
705-
706-
/*
707-
* Commit the remove and start the next trans in series.
708-
*/
709-
error = xfs_trans_roll_inode(&args->trans, dp);
710-
711700
} else if (args->rmtblkno > 0) {
712701
/*
713702
* Added a "remote" value, just clear the incomplete flag.
714703
*/
715704
error = xfs_attr3_leaf_clearflag(args);
716-
if (error)
717-
return error;
718-
719-
/*
720-
* Commit the flag value change and start the next trans in
721-
* series.
722-
*/
723-
error = xfs_trans_roll_inode(&args->trans, args->dp);
724705
}
725706
return error;
726707
}
@@ -780,15 +761,11 @@ xfs_attr_leaf_removename(
780761
/*
781762
* If the result is small enough, shrink it all into the inode.
782763
*/
783-
if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
784-
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
764+
forkoff = xfs_attr_shortform_allfit(bp, dp);
765+
if (forkoff)
766+
return xfs_attr3_leaf_to_shortform(bp, args, forkoff);
785767
/* bp is gone due to xfs_da_shrink_inode */
786-
if (error)
787-
return error;
788-
error = xfs_defer_finish(&args->trans);
789-
if (error)
790-
return error;
791-
}
768+
792769
return 0;
793770
}
794771

@@ -1064,33 +1041,15 @@ xfs_attr_node_addname(
10641041
error = xfs_da3_join(state);
10651042
if (error)
10661043
goto out;
1067-
error = xfs_defer_finish(&args->trans);
1068-
if (error)
1069-
goto out;
10701044
}
10711045

1072-
/*
1073-
* Commit and start the next trans in the chain.
1074-
*/
1075-
error = xfs_trans_roll_inode(&args->trans, dp);
1076-
if (error)
1077-
goto out;
1078-
10791046
} else if (args->rmtblkno > 0) {
10801047
/*
10811048
* Added a "remote" value, just clear the incomplete flag.
10821049
*/
10831050
error = xfs_attr3_leaf_clearflag(args);
10841051
if (error)
10851052
goto out;
1086-
1087-
/*
1088-
* Commit the flag value change and start the next trans in
1089-
* series.
1090-
*/
1091-
error = xfs_trans_roll_inode(&args->trans, args->dp);
1092-
if (error)
1093-
goto out;
10941053
}
10951054
retval = error = 0;
10961055

@@ -1129,16 +1088,10 @@ xfs_attr_node_shrink(
11291088
if (forkoff) {
11301089
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
11311090
/* bp is gone due to xfs_da_shrink_inode */
1132-
if (error)
1133-
return error;
1134-
1135-
error = xfs_defer_finish(&args->trans);
1136-
if (error)
1137-
return error;
11381091
} else
11391092
xfs_trans_brelse(args->trans, bp);
11401093

1141-
return 0;
1094+
return error;
11421095
}
11431096

11441097
/*

0 commit comments

Comments
 (0)