diff options
Diffstat (limited to 'fs/jbd2/commit.c')
-rw-r--r-- | fs/jbd2/commit.c | 77 |
1 files changed, 38 insertions, 39 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index cf2fc0594063..5f26139a165a 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -555,7 +555,6 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
555 | blk_start_plug(&plug); | 555 | blk_start_plug(&plug); |
556 | jbd2_journal_write_revoke_records(journal, commit_transaction, | 556 | jbd2_journal_write_revoke_records(journal, commit_transaction, |
557 | &log_bufs, WRITE_SYNC); | 557 | &log_bufs, WRITE_SYNC); |
558 | blk_finish_plug(&plug); | ||
559 | 558 | ||
560 | jbd_debug(3, "JBD2: commit phase 2b\n"); | 559 | jbd_debug(3, "JBD2: commit phase 2b\n"); |
561 | 560 | ||
@@ -582,7 +581,6 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
582 | err = 0; | 581 | err = 0; |
583 | bufs = 0; | 582 | bufs = 0; |
584 | descriptor = NULL; | 583 | descriptor = NULL; |
585 | blk_start_plug(&plug); | ||
586 | while (commit_transaction->t_buffers) { | 584 | while (commit_transaction->t_buffers) { |
587 | 585 | ||
588 | /* Find the next buffer to be journaled... */ | 586 | /* Find the next buffer to be journaled... */ |
@@ -1067,6 +1065,25 @@ restart_loop: | |||
1067 | goto restart_loop; | 1065 | goto restart_loop; |
1068 | } | 1066 | } |
1069 | 1067 | ||
1068 | /* Add the transaction to the checkpoint list | ||
1069 | * __journal_remove_checkpoint() can not destroy transaction | ||
1070 | * under us because it is not marked as T_FINISHED yet */ | ||
1071 | if (journal->j_checkpoint_transactions == NULL) { | ||
1072 | journal->j_checkpoint_transactions = commit_transaction; | ||
1073 | commit_transaction->t_cpnext = commit_transaction; | ||
1074 | commit_transaction->t_cpprev = commit_transaction; | ||
1075 | } else { | ||
1076 | commit_transaction->t_cpnext = | ||
1077 | journal->j_checkpoint_transactions; | ||
1078 | commit_transaction->t_cpprev = | ||
1079 | commit_transaction->t_cpnext->t_cpprev; | ||
1080 | commit_transaction->t_cpnext->t_cpprev = | ||
1081 | commit_transaction; | ||
1082 | commit_transaction->t_cpprev->t_cpnext = | ||
1083 | commit_transaction; | ||
1084 | } | ||
1085 | spin_unlock(&journal->j_list_lock); | ||
1086 | |||
1070 | /* Done with this transaction! */ | 1087 | /* Done with this transaction! */ |
1071 | 1088 | ||
1072 | jbd_debug(3, "JBD2: commit phase 7\n"); | 1089 | jbd_debug(3, "JBD2: commit phase 7\n"); |
@@ -1085,24 +1102,7 @@ restart_loop: | |||
1085 | atomic_read(&commit_transaction->t_handle_count); | 1102 | atomic_read(&commit_transaction->t_handle_count); |
1086 | trace_jbd2_run_stats(journal->j_fs_dev->bd_dev, | 1103 | trace_jbd2_run_stats(journal->j_fs_dev->bd_dev, |
1087 | commit_transaction->t_tid, &stats.run); | 1104 | commit_transaction->t_tid, &stats.run); |
1088 | 1105 | stats.ts_requested = (commit_transaction->t_requested) ? 1 : 0; | |
1089 | /* | ||
1090 | * Calculate overall stats | ||
1091 | */ | ||
1092 | spin_lock(&journal->j_history_lock); | ||
1093 | journal->j_stats.ts_tid++; | ||
1094 | if (commit_transaction->t_requested) | ||
1095 | journal->j_stats.ts_requested++; | ||
1096 | journal->j_stats.run.rs_wait += stats.run.rs_wait; | ||
1097 | journal->j_stats.run.rs_request_delay += stats.run.rs_request_delay; | ||
1098 | journal->j_stats.run.rs_running += stats.run.rs_running; | ||
1099 | journal->j_stats.run.rs_locked += stats.run.rs_locked; | ||
1100 | journal->j_stats.run.rs_flushing += stats.run.rs_flushing; | ||
1101 | journal->j_stats.run.rs_logging += stats.run.rs_logging; | ||
1102 | journal->j_stats.run.rs_handle_count += stats.run.rs_handle_count; | ||
1103 | journal->j_stats.run.rs_blocks += stats.run.rs_blocks; | ||
1104 | journal->j_stats.run.rs_blocks_logged += stats.run.rs_blocks_logged; | ||
1105 | spin_unlock(&journal->j_history_lock); | ||
1106 | 1106 | ||
1107 | commit_transaction->t_state = T_COMMIT_CALLBACK; | 1107 | commit_transaction->t_state = T_COMMIT_CALLBACK; |
1108 | J_ASSERT(commit_transaction == journal->j_committing_transaction); | 1108 | J_ASSERT(commit_transaction == journal->j_committing_transaction); |
@@ -1122,24 +1122,6 @@ restart_loop: | |||
1122 | 1122 | ||
1123 | write_unlock(&journal->j_state_lock); | 1123 | write_unlock(&journal->j_state_lock); |
1124 | 1124 | ||
1125 | if (journal->j_checkpoint_transactions == NULL) { | ||
1126 | journal->j_checkpoint_transactions = commit_transaction; | ||
1127 | commit_transaction->t_cpnext = commit_transaction; | ||
1128 | commit_transaction->t_cpprev = commit_transaction; | ||
1129 | } else { | ||
1130 | commit_transaction->t_cpnext = | ||
1131 | journal->j_checkpoint_transactions; | ||
1132 | commit_transaction->t_cpprev = | ||
1133 | commit_transaction->t_cpnext->t_cpprev; | ||
1134 | commit_transaction->t_cpnext->t_cpprev = | ||
1135 | commit_transaction; | ||
1136 | commit_transaction->t_cpprev->t_cpnext = | ||
1137 | commit_transaction; | ||
1138 | } | ||
1139 | spin_unlock(&journal->j_list_lock); | ||
1140 | /* Drop all spin_locks because commit_callback may be block. | ||
1141 | * __journal_remove_checkpoint() can not destroy transaction | ||
1142 | * under us because it is not marked as T_FINISHED yet */ | ||
1143 | if (journal->j_commit_callback) | 1125 | if (journal->j_commit_callback) |
1144 | journal->j_commit_callback(journal, commit_transaction); | 1126 | journal->j_commit_callback(journal, commit_transaction); |
1145 | 1127 | ||
@@ -1150,7 +1132,7 @@ restart_loop: | |||
1150 | write_lock(&journal->j_state_lock); | 1132 | write_lock(&journal->j_state_lock); |
1151 | spin_lock(&journal->j_list_lock); | 1133 | spin_lock(&journal->j_list_lock); |
1152 | commit_transaction->t_state = T_FINISHED; | 1134 | commit_transaction->t_state = T_FINISHED; |
1153 | /* Recheck checkpoint lists after j_list_lock was dropped */ | 1135 | /* Check if the transaction can be dropped now that we are finished */ |
1154 | if (commit_transaction->t_checkpoint_list == NULL && | 1136 | if (commit_transaction->t_checkpoint_list == NULL && |
1155 | commit_transaction->t_checkpoint_io_list == NULL) { | 1137 | commit_transaction->t_checkpoint_io_list == NULL) { |
1156 | __jbd2_journal_drop_transaction(journal, commit_transaction); | 1138 | __jbd2_journal_drop_transaction(journal, commit_transaction); |
@@ -1159,4 +1141,21 @@ restart_loop: | |||
1159 | spin_unlock(&journal->j_list_lock); | 1141 | spin_unlock(&journal->j_list_lock); |
1160 | write_unlock(&journal->j_state_lock); | 1142 | write_unlock(&journal->j_state_lock); |
1161 | wake_up(&journal->j_wait_done_commit); | 1143 | wake_up(&journal->j_wait_done_commit); |
1144 | |||
1145 | /* | ||
1146 | * Calculate overall stats | ||
1147 | */ | ||
1148 | spin_lock(&journal->j_history_lock); | ||
1149 | journal->j_stats.ts_tid++; | ||
1150 | journal->j_stats.ts_requested += stats.ts_requested; | ||
1151 | journal->j_stats.run.rs_wait += stats.run.rs_wait; | ||
1152 | journal->j_stats.run.rs_request_delay += stats.run.rs_request_delay; | ||
1153 | journal->j_stats.run.rs_running += stats.run.rs_running; | ||
1154 | journal->j_stats.run.rs_locked += stats.run.rs_locked; | ||
1155 | journal->j_stats.run.rs_flushing += stats.run.rs_flushing; | ||
1156 | journal->j_stats.run.rs_logging += stats.run.rs_logging; | ||
1157 | journal->j_stats.run.rs_handle_count += stats.run.rs_handle_count; | ||
1158 | journal->j_stats.run.rs_blocks += stats.run.rs_blocks; | ||
1159 | journal->j_stats.run.rs_blocks_logged += stats.run.rs_blocks_logged; | ||
1160 | spin_unlock(&journal->j_history_lock); | ||
1162 | } | 1161 | } |