diff options
author | Brian Foster <bfoster@redhat.com> | 2018-09-28 23:41:58 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2018-09-28 23:41:58 -0400 |
commit | d5a2e2893da0d62c3888c91ae2da798adc17a9b9 (patch) | |
tree | db2dcdff07f1ca24be625bb8b1e727b8d8f02547 /fs/xfs/libxfs | |
parent | ae29478766f4c8e16edca6fe1e25d73c47991ebe (diff) |
xfs: remove last of unnecessary xfs_defer_cancel() callers
Now that deferred operations are completely managed via
transactions, it's no longer necessary to cancel the dfops in error
paths that already cancel the associated transaction. There are a
few such calls lingering throughout the codebase.
Remove all remaining unnecessary calls to xfs_defer_cancel(). This
leaves xfs_defer_cancel() calls in two places. The first is the call
in the transaction cancel path itself, which facilitates this patch.
The second is made via the xfs_defer_finish() error path to provide
consistent error semantics with transaction commit. For example,
xfs_trans_commit() expects an xfs_defer_finish() failure to clean up
the dfops structure before it returns.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/libxfs')
-rw-r--r-- | fs/xfs/libxfs/xfs_attr.c | 28 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_attr_remote.c | 10 |
2 files changed, 10 insertions, 28 deletions
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 1e671d4eb6fa..c6299f82a6e4 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c | |||
@@ -587,7 +587,7 @@ xfs_attr_leaf_addname( | |||
587 | */ | 587 | */ |
588 | error = xfs_attr3_leaf_to_node(args); | 588 | error = xfs_attr3_leaf_to_node(args); |
589 | if (error) | 589 | if (error) |
590 | goto out_defer_cancel; | 590 | return error; |
591 | error = xfs_defer_finish(&args->trans); | 591 | error = xfs_defer_finish(&args->trans); |
592 | if (error) | 592 | if (error) |
593 | return error; | 593 | return error; |
@@ -675,7 +675,7 @@ xfs_attr_leaf_addname( | |||
675 | error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); | 675 | error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); |
676 | /* bp is gone due to xfs_da_shrink_inode */ | 676 | /* bp is gone due to xfs_da_shrink_inode */ |
677 | if (error) | 677 | if (error) |
678 | goto out_defer_cancel; | 678 | return error; |
679 | error = xfs_defer_finish(&args->trans); | 679 | error = xfs_defer_finish(&args->trans); |
680 | if (error) | 680 | if (error) |
681 | return error; | 681 | return error; |
@@ -693,9 +693,6 @@ xfs_attr_leaf_addname( | |||
693 | error = xfs_attr3_leaf_clearflag(args); | 693 | error = xfs_attr3_leaf_clearflag(args); |
694 | } | 694 | } |
695 | return error; | 695 | return error; |
696 | out_defer_cancel: | ||
697 | xfs_defer_cancel(args->trans); | ||
698 | return error; | ||
699 | } | 696 | } |
700 | 697 | ||
701 | /* | 698 | /* |
@@ -738,15 +735,12 @@ xfs_attr_leaf_removename( | |||
738 | error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); | 735 | error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); |
739 | /* bp is gone due to xfs_da_shrink_inode */ | 736 | /* bp is gone due to xfs_da_shrink_inode */ |
740 | if (error) | 737 | if (error) |
741 | goto out_defer_cancel; | 738 | return error; |
742 | error = xfs_defer_finish(&args->trans); | 739 | error = xfs_defer_finish(&args->trans); |
743 | if (error) | 740 | if (error) |
744 | return error; | 741 | return error; |
745 | } | 742 | } |
746 | return 0; | 743 | return 0; |
747 | out_defer_cancel: | ||
748 | xfs_defer_cancel(args->trans); | ||
749 | return error; | ||
750 | } | 744 | } |
751 | 745 | ||
752 | /* | 746 | /* |
@@ -864,7 +858,7 @@ restart: | |||
864 | state = NULL; | 858 | state = NULL; |
865 | error = xfs_attr3_leaf_to_node(args); | 859 | error = xfs_attr3_leaf_to_node(args); |
866 | if (error) | 860 | if (error) |
867 | goto out_defer_cancel; | 861 | goto out; |
868 | error = xfs_defer_finish(&args->trans); | 862 | error = xfs_defer_finish(&args->trans); |
869 | if (error) | 863 | if (error) |
870 | goto out; | 864 | goto out; |
@@ -888,7 +882,7 @@ restart: | |||
888 | */ | 882 | */ |
889 | error = xfs_da3_split(state); | 883 | error = xfs_da3_split(state); |
890 | if (error) | 884 | if (error) |
891 | goto out_defer_cancel; | 885 | goto out; |
892 | error = xfs_defer_finish(&args->trans); | 886 | error = xfs_defer_finish(&args->trans); |
893 | if (error) | 887 | if (error) |
894 | goto out; | 888 | goto out; |
@@ -984,7 +978,7 @@ restart: | |||
984 | if (retval && (state->path.active > 1)) { | 978 | if (retval && (state->path.active > 1)) { |
985 | error = xfs_da3_join(state); | 979 | error = xfs_da3_join(state); |
986 | if (error) | 980 | if (error) |
987 | goto out_defer_cancel; | 981 | goto out; |
988 | error = xfs_defer_finish(&args->trans); | 982 | error = xfs_defer_finish(&args->trans); |
989 | if (error) | 983 | if (error) |
990 | goto out; | 984 | goto out; |
@@ -1013,9 +1007,6 @@ out: | |||
1013 | if (error) | 1007 | if (error) |
1014 | return error; | 1008 | return error; |
1015 | return retval; | 1009 | return retval; |
1016 | out_defer_cancel: | ||
1017 | xfs_defer_cancel(args->trans); | ||
1018 | goto out; | ||
1019 | } | 1010 | } |
1020 | 1011 | ||
1021 | /* | 1012 | /* |
@@ -1107,7 +1098,7 @@ xfs_attr_node_removename( | |||
1107 | if (retval && (state->path.active > 1)) { | 1098 | if (retval && (state->path.active > 1)) { |
1108 | error = xfs_da3_join(state); | 1099 | error = xfs_da3_join(state); |
1109 | if (error) | 1100 | if (error) |
1110 | goto out_defer_cancel; | 1101 | goto out; |
1111 | error = xfs_defer_finish(&args->trans); | 1102 | error = xfs_defer_finish(&args->trans); |
1112 | if (error) | 1103 | if (error) |
1113 | goto out; | 1104 | goto out; |
@@ -1138,7 +1129,7 @@ xfs_attr_node_removename( | |||
1138 | error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); | 1129 | error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); |
1139 | /* bp is gone due to xfs_da_shrink_inode */ | 1130 | /* bp is gone due to xfs_da_shrink_inode */ |
1140 | if (error) | 1131 | if (error) |
1141 | goto out_defer_cancel; | 1132 | goto out; |
1142 | error = xfs_defer_finish(&args->trans); | 1133 | error = xfs_defer_finish(&args->trans); |
1143 | if (error) | 1134 | if (error) |
1144 | goto out; | 1135 | goto out; |
@@ -1150,9 +1141,6 @@ xfs_attr_node_removename( | |||
1150 | out: | 1141 | out: |
1151 | xfs_da_state_free(state); | 1142 | xfs_da_state_free(state); |
1152 | return error; | 1143 | return error; |
1153 | out_defer_cancel: | ||
1154 | xfs_defer_cancel(args->trans); | ||
1155 | goto out; | ||
1156 | } | 1144 | } |
1157 | 1145 | ||
1158 | /* | 1146 | /* |
diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c index af094063e402..d89363c6b523 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.c +++ b/fs/xfs/libxfs/xfs_attr_remote.c | |||
@@ -485,7 +485,7 @@ xfs_attr_rmtval_set( | |||
485 | blkcnt, XFS_BMAPI_ATTRFORK, args->total, &map, | 485 | blkcnt, XFS_BMAPI_ATTRFORK, args->total, &map, |
486 | &nmap); | 486 | &nmap); |
487 | if (error) | 487 | if (error) |
488 | goto out_defer_cancel; | 488 | return error; |
489 | error = xfs_defer_finish(&args->trans); | 489 | error = xfs_defer_finish(&args->trans); |
490 | if (error) | 490 | if (error) |
491 | return error; | 491 | return error; |
@@ -553,9 +553,6 @@ xfs_attr_rmtval_set( | |||
553 | } | 553 | } |
554 | ASSERT(valuelen == 0); | 554 | ASSERT(valuelen == 0); |
555 | return 0; | 555 | return 0; |
556 | out_defer_cancel: | ||
557 | xfs_defer_cancel(args->trans); | ||
558 | return error; | ||
559 | } | 556 | } |
560 | 557 | ||
561 | /* | 558 | /* |
@@ -625,7 +622,7 @@ xfs_attr_rmtval_remove( | |||
625 | error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt, | 622 | error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt, |
626 | XFS_BMAPI_ATTRFORK, 1, &done); | 623 | XFS_BMAPI_ATTRFORK, 1, &done); |
627 | if (error) | 624 | if (error) |
628 | goto out_defer_cancel; | 625 | return error; |
629 | error = xfs_defer_finish(&args->trans); | 626 | error = xfs_defer_finish(&args->trans); |
630 | if (error) | 627 | if (error) |
631 | return error; | 628 | return error; |
@@ -638,7 +635,4 @@ xfs_attr_rmtval_remove( | |||
638 | return error; | 635 | return error; |
639 | } | 636 | } |
640 | return 0; | 637 | return 0; |
641 | out_defer_cancel: | ||
642 | xfs_defer_cancel(args->trans); | ||
643 | return error; | ||
644 | } | 638 | } |