Lines Matching refs:journal

118 static int journal_submit_commit_record(journal_t *journal,  in journal_submit_commit_record()  argument
130 if (is_journal_aborted(journal)) in journal_submit_commit_record()
143 if (jbd2_has_feature_checksum(journal)) { in journal_submit_commit_record()
148 jbd2_commit_block_csum_set(journal, bh); in journal_submit_commit_record()
156 if (journal->j_flags & JBD2_BARRIER && in journal_submit_commit_record()
157 !jbd2_has_feature_async_commit(journal)) in journal_submit_commit_record()
169 static int journal_wait_on_commit_record(journal_t *journal, in journal_wait_on_commit_record() argument
222 int jbd2_wait_inode_data(journal_t *journal, struct jbd2_inode *jinode) in jbd2_wait_inode_data() argument
241 static int journal_submit_data_buffers(journal_t *journal, in journal_submit_data_buffers() argument
247 spin_lock(&journal->j_list_lock); in journal_submit_data_buffers()
252 spin_unlock(&journal->j_list_lock); in journal_submit_data_buffers()
255 if (journal->j_submit_inode_data_buffers) { in journal_submit_data_buffers()
256 err = journal->j_submit_inode_data_buffers(jinode); in journal_submit_data_buffers()
260 spin_lock(&journal->j_list_lock); in journal_submit_data_buffers()
266 spin_unlock(&journal->j_list_lock); in journal_submit_data_buffers()
284 static int journal_finish_inode_data_buffers(journal_t *journal, in journal_finish_inode_data_buffers() argument
291 spin_lock(&journal->j_list_lock); in journal_finish_inode_data_buffers()
296 spin_unlock(&journal->j_list_lock); in journal_finish_inode_data_buffers()
298 if (journal->j_finish_inode_data_buffers) { in journal_finish_inode_data_buffers()
299 err = journal->j_finish_inode_data_buffers(jinode); in journal_finish_inode_data_buffers()
303 spin_lock(&journal->j_list_lock); in journal_finish_inode_data_buffers()
324 spin_unlock(&journal->j_list_lock); in journal_finish_inode_data_buffers()
381 void jbd2_journal_commit_transaction(journal_t *journal) in jbd2_journal_commit_transaction() argument
387 struct buffer_head **wbuf = journal->j_wbuf; in jbd2_journal_commit_transaction()
400 int tag_bytes = journal_tag_bytes(journal); in jbd2_journal_commit_transaction()
412 if (jbd2_journal_has_csum_v2or3(journal)) in jbd2_journal_commit_transaction()
421 if (journal->j_flags & JBD2_FLUSHED) { in jbd2_journal_commit_transaction()
423 mutex_lock_io(&journal->j_checkpoint_mutex); in jbd2_journal_commit_transaction()
430 jbd2_journal_update_sb_log_tail(journal, in jbd2_journal_commit_transaction()
431 journal->j_tail_sequence, in jbd2_journal_commit_transaction()
432 journal->j_tail, in jbd2_journal_commit_transaction()
434 mutex_unlock(&journal->j_checkpoint_mutex); in jbd2_journal_commit_transaction()
439 J_ASSERT(journal->j_running_transaction != NULL); in jbd2_journal_commit_transaction()
440 J_ASSERT(journal->j_committing_transaction == NULL); in jbd2_journal_commit_transaction()
442 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
443 journal->j_flags |= JBD2_FULL_COMMIT_ONGOING; in jbd2_journal_commit_transaction()
444 while (journal->j_flags & JBD2_FAST_COMMIT_ONGOING) { in jbd2_journal_commit_transaction()
447 prepare_to_wait(&journal->j_fc_wait, &wait, in jbd2_journal_commit_transaction()
449 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
451 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
452 finish_wait(&journal->j_fc_wait, &wait); in jbd2_journal_commit_transaction()
463 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
465 commit_transaction = journal->j_running_transaction; in jbd2_journal_commit_transaction()
467 trace_jbd2_start_commit(journal, commit_transaction); in jbd2_journal_commit_transaction()
471 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
472 journal->j_fc_off = 0; in jbd2_journal_commit_transaction()
476 trace_jbd2_commit_locking(journal, commit_transaction); in jbd2_journal_commit_transaction()
488 jbd2_journal_wait_updates(journal); in jbd2_journal_commit_transaction()
493 journal->j_max_transaction_buffers); in jbd2_journal_commit_transaction()
528 jbd2_journal_refile_buffer(journal, jh); in jbd2_journal_commit_transaction()
531 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
537 spin_lock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
538 __jbd2_journal_clean_checkpoint_list(journal, false); in jbd2_journal_commit_transaction()
539 spin_unlock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
547 jbd2_clear_buffer_revoked_flags(journal); in jbd2_journal_commit_transaction()
552 jbd2_journal_switch_revoke_table(journal); in jbd2_journal_commit_transaction()
554 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
558 atomic_sub(atomic_read(&journal->j_reserved_credits), in jbd2_journal_commit_transaction()
561 trace_jbd2_commit_flushing(journal, commit_transaction); in jbd2_journal_commit_transaction()
567 journal->j_committing_transaction = commit_transaction; in jbd2_journal_commit_transaction()
568 journal->j_running_transaction = NULL; in jbd2_journal_commit_transaction()
570 commit_transaction->t_log_start = journal->j_head; in jbd2_journal_commit_transaction()
571 wake_up_all(&journal->j_wait_transaction_locked); in jbd2_journal_commit_transaction()
572 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
580 err = journal_submit_data_buffers(journal, commit_transaction); in jbd2_journal_commit_transaction()
582 jbd2_journal_abort(journal, err); in jbd2_journal_commit_transaction()
594 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
596 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
598 trace_jbd2_commit_logging(journal, commit_transaction); in jbd2_journal_commit_transaction()
620 if (is_journal_aborted(journal)) { in jbd2_journal_commit_transaction()
627 jbd2_journal_refile_buffer(journal, jh); in jbd2_journal_commit_transaction()
649 jbd2_journal_abort(journal, -EIO); in jbd2_journal_commit_transaction()
672 err = jbd2_journal_next_log_block(journal, &blocknr); in jbd2_journal_commit_transaction()
677 jbd2_journal_abort(journal, err); in jbd2_journal_commit_transaction()
701 jbd2_journal_abort(journal, flags); in jbd2_journal_commit_transaction()
716 write_tag_block(journal, tag, jh2bh(jh)->b_blocknr); in jbd2_journal_commit_transaction()
718 jbd2_block_tag_csum_set(journal, tag, wbuf[bufs], in jbd2_journal_commit_transaction()
725 memcpy (tagp, journal->j_uuid, 16); in jbd2_journal_commit_transaction()
734 if (bufs == journal->j_wbufsize || in jbd2_journal_commit_transaction()
747 jbd2_descriptor_block_csum_set(journal, in jbd2_journal_commit_transaction()
755 if (jbd2_has_feature_checksum(journal)) { in jbd2_journal_commit_transaction()
775 err = journal_finish_inode_data_buffers(journal, commit_transaction); in jbd2_journal_commit_transaction()
779 "on %s\n", journal->j_devname); in jbd2_journal_commit_transaction()
780 if (journal->j_flags & JBD2_ABORT_ON_SYNCDATA_ERR) in jbd2_journal_commit_transaction()
781 jbd2_journal_abort(journal, err); in jbd2_journal_commit_transaction()
793 jbd2_journal_get_log_tail(journal, &first_tid, &first_block); in jbd2_journal_commit_transaction()
795 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
797 long freed = first_block - journal->j_tail; in jbd2_journal_commit_transaction()
799 if (first_block < journal->j_tail) in jbd2_journal_commit_transaction()
800 freed += journal->j_last - journal->j_first; in jbd2_journal_commit_transaction()
802 if (freed < jbd2_journal_get_max_txn_bufs(journal)) in jbd2_journal_commit_transaction()
807 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
815 (journal->j_fs_dev != journal->j_dev) && in jbd2_journal_commit_transaction()
816 (journal->j_flags & JBD2_BARRIER)) in jbd2_journal_commit_transaction()
817 blkdev_issue_flush(journal->j_fs_dev); in jbd2_journal_commit_transaction()
820 if (jbd2_has_feature_async_commit(journal)) { in jbd2_journal_commit_transaction()
821 err = journal_submit_commit_record(journal, commit_transaction, in jbd2_journal_commit_transaction()
824 jbd2_journal_abort(journal, err); in jbd2_journal_commit_transaction()
905 jbd2_journal_abort(journal, err); in jbd2_journal_commit_transaction()
908 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
911 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
913 if (!jbd2_has_feature_async_commit(journal)) { in jbd2_journal_commit_transaction()
914 err = journal_submit_commit_record(journal, commit_transaction, in jbd2_journal_commit_transaction()
917 jbd2_journal_abort(journal, err); in jbd2_journal_commit_transaction()
920 err = journal_wait_on_commit_record(journal, cbh); in jbd2_journal_commit_transaction()
922 if (jbd2_has_feature_async_commit(journal) && in jbd2_journal_commit_transaction()
923 journal->j_flags & JBD2_BARRIER) { in jbd2_journal_commit_transaction()
924 blkdev_issue_flush(journal->j_dev); in jbd2_journal_commit_transaction()
928 jbd2_journal_abort(journal, err); in jbd2_journal_commit_transaction()
939 jbd2_update_log_tail(journal, first_tid, first_block); in jbd2_journal_commit_transaction()
958 spin_lock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
966 spin_unlock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1003 spin_lock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1056 if (is_journal_aborted(journal)) in jbd2_journal_commit_transaction()
1081 cond_resched_lock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1083 spin_unlock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1090 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
1091 spin_lock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1097 spin_unlock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1098 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
1105 if (journal->j_checkpoint_transactions == NULL) { in jbd2_journal_commit_transaction()
1106 journal->j_checkpoint_transactions = commit_transaction; in jbd2_journal_commit_transaction()
1111 journal->j_checkpoint_transactions; in jbd2_journal_commit_transaction()
1119 spin_unlock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1137 trace_jbd2_run_stats(journal->j_fs_dev->bd_dev, in jbd2_journal_commit_transaction()
1142 J_ASSERT(commit_transaction == journal->j_committing_transaction); in jbd2_journal_commit_transaction()
1143 journal->j_commit_sequence = commit_transaction->t_tid; in jbd2_journal_commit_transaction()
1144 journal->j_committing_transaction = NULL; in jbd2_journal_commit_transaction()
1151 if (likely(journal->j_average_commit_time)) in jbd2_journal_commit_transaction()
1152 journal->j_average_commit_time = (commit_time + in jbd2_journal_commit_transaction()
1153 journal->j_average_commit_time*3) / 4; in jbd2_journal_commit_transaction()
1155 journal->j_average_commit_time = commit_time; in jbd2_journal_commit_transaction()
1157 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
1159 if (journal->j_commit_callback) in jbd2_journal_commit_transaction()
1160 journal->j_commit_callback(journal, commit_transaction); in jbd2_journal_commit_transaction()
1161 if (journal->j_fc_cleanup_callback) in jbd2_journal_commit_transaction()
1162 journal->j_fc_cleanup_callback(journal, 1, commit_transaction->t_tid); in jbd2_journal_commit_transaction()
1164 trace_jbd2_end_commit(journal, commit_transaction); in jbd2_journal_commit_transaction()
1166 journal->j_commit_sequence, journal->j_tail_sequence); in jbd2_journal_commit_transaction()
1168 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
1169 journal->j_flags &= ~JBD2_FULL_COMMIT_ONGOING; in jbd2_journal_commit_transaction()
1170 journal->j_flags &= ~JBD2_FAST_COMMIT_ONGOING; in jbd2_journal_commit_transaction()
1171 spin_lock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1176 __jbd2_journal_drop_transaction(journal, commit_transaction); in jbd2_journal_commit_transaction()
1179 spin_unlock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1180 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
1181 wake_up(&journal->j_wait_done_commit); in jbd2_journal_commit_transaction()
1182 wake_up(&journal->j_fc_wait); in jbd2_journal_commit_transaction()
1187 spin_lock(&journal->j_history_lock); in jbd2_journal_commit_transaction()
1188 journal->j_stats.ts_tid++; in jbd2_journal_commit_transaction()
1189 journal->j_stats.ts_requested += stats.ts_requested; in jbd2_journal_commit_transaction()
1190 journal->j_stats.run.rs_wait += stats.run.rs_wait; in jbd2_journal_commit_transaction()
1191 journal->j_stats.run.rs_request_delay += stats.run.rs_request_delay; in jbd2_journal_commit_transaction()
1192 journal->j_stats.run.rs_running += stats.run.rs_running; in jbd2_journal_commit_transaction()
1193 journal->j_stats.run.rs_locked += stats.run.rs_locked; in jbd2_journal_commit_transaction()
1194 journal->j_stats.run.rs_flushing += stats.run.rs_flushing; in jbd2_journal_commit_transaction()
1195 journal->j_stats.run.rs_logging += stats.run.rs_logging; in jbd2_journal_commit_transaction()
1196 journal->j_stats.run.rs_handle_count += stats.run.rs_handle_count; in jbd2_journal_commit_transaction()
1197 journal->j_stats.run.rs_blocks += stats.run.rs_blocks; in jbd2_journal_commit_transaction()
1198 journal->j_stats.run.rs_blocks_logged += stats.run.rs_blocks_logged; in jbd2_journal_commit_transaction()
1199 spin_unlock(&journal->j_history_lock); in jbd2_journal_commit_transaction()