Lines Matching refs:journal

114 static int journal_submit_commit_record(journal_t *journal,  in journal_submit_commit_record()  argument
126 if (is_journal_aborted(journal)) in journal_submit_commit_record()
139 if (jbd2_has_feature_checksum(journal)) { in journal_submit_commit_record()
144 jbd2_commit_block_csum_set(journal, bh); in journal_submit_commit_record()
152 if (journal->j_flags & JBD2_BARRIER && in journal_submit_commit_record()
153 !jbd2_has_feature_async_commit(journal)) in journal_submit_commit_record()
165 static int journal_wait_on_commit_record(journal_t *journal, in journal_wait_on_commit_record() argument
181 int jbd2_submit_inode_data(journal_t *journal, struct jbd2_inode *jinode) in jbd2_submit_inode_data() argument
187 return journal->j_submit_inode_data_buffers(jinode); in jbd2_submit_inode_data()
192 int jbd2_wait_inode_data(journal_t *journal, struct jbd2_inode *jinode) in jbd2_wait_inode_data() argument
211 static int journal_submit_data_buffers(journal_t *journal, in journal_submit_data_buffers() argument
217 spin_lock(&journal->j_list_lock); in journal_submit_data_buffers()
222 spin_unlock(&journal->j_list_lock); in journal_submit_data_buffers()
225 if (journal->j_submit_inode_data_buffers) { in journal_submit_data_buffers()
226 err = journal->j_submit_inode_data_buffers(jinode); in journal_submit_data_buffers()
230 spin_lock(&journal->j_list_lock); in journal_submit_data_buffers()
236 spin_unlock(&journal->j_list_lock); in journal_submit_data_buffers()
254 static int journal_finish_inode_data_buffers(journal_t *journal, in journal_finish_inode_data_buffers() argument
261 spin_lock(&journal->j_list_lock); in journal_finish_inode_data_buffers()
266 spin_unlock(&journal->j_list_lock); in journal_finish_inode_data_buffers()
268 if (journal->j_finish_inode_data_buffers) { in journal_finish_inode_data_buffers()
269 err = journal->j_finish_inode_data_buffers(jinode); in journal_finish_inode_data_buffers()
274 spin_lock(&journal->j_list_lock); in journal_finish_inode_data_buffers()
295 spin_unlock(&journal->j_list_lock); in journal_finish_inode_data_buffers()
348 void jbd2_journal_commit_transaction(journal_t *journal) in jbd2_journal_commit_transaction() argument
354 struct buffer_head **wbuf = journal->j_wbuf; in jbd2_journal_commit_transaction()
367 int tag_bytes = journal_tag_bytes(journal); in jbd2_journal_commit_transaction()
379 if (jbd2_journal_has_csum_v2or3(journal)) in jbd2_journal_commit_transaction()
388 if (journal->j_flags & JBD2_FLUSHED) { in jbd2_journal_commit_transaction()
390 mutex_lock_io(&journal->j_checkpoint_mutex); in jbd2_journal_commit_transaction()
397 jbd2_journal_update_sb_log_tail(journal, in jbd2_journal_commit_transaction()
398 journal->j_tail_sequence, in jbd2_journal_commit_transaction()
399 journal->j_tail, 0); in jbd2_journal_commit_transaction()
400 mutex_unlock(&journal->j_checkpoint_mutex); in jbd2_journal_commit_transaction()
405 J_ASSERT(journal->j_running_transaction != NULL); in jbd2_journal_commit_transaction()
406 J_ASSERT(journal->j_committing_transaction == NULL); in jbd2_journal_commit_transaction()
408 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
409 journal->j_flags |= JBD2_FULL_COMMIT_ONGOING; in jbd2_journal_commit_transaction()
410 while (journal->j_flags & JBD2_FAST_COMMIT_ONGOING) { in jbd2_journal_commit_transaction()
413 prepare_to_wait(&journal->j_fc_wait, &wait, in jbd2_journal_commit_transaction()
415 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
417 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
418 finish_wait(&journal->j_fc_wait, &wait); in jbd2_journal_commit_transaction()
429 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
431 commit_transaction = journal->j_running_transaction; in jbd2_journal_commit_transaction()
433 trace_jbd2_start_commit(journal, commit_transaction); in jbd2_journal_commit_transaction()
437 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
438 journal->j_fc_off = 0; in jbd2_journal_commit_transaction()
442 trace_jbd2_commit_locking(journal, commit_transaction); in jbd2_journal_commit_transaction()
454 jbd2_journal_wait_updates(journal); in jbd2_journal_commit_transaction()
459 journal->j_max_transaction_buffers); in jbd2_journal_commit_transaction()
494 jbd2_journal_refile_buffer(journal, jh); in jbd2_journal_commit_transaction()
497 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
503 spin_lock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
504 __jbd2_journal_clean_checkpoint_list(journal, JBD2_SHRINK_BUSY_STOP); in jbd2_journal_commit_transaction()
505 spin_unlock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
513 jbd2_clear_buffer_revoked_flags(journal); in jbd2_journal_commit_transaction()
518 jbd2_journal_switch_revoke_table(journal); in jbd2_journal_commit_transaction()
520 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
524 atomic_sub(atomic_read(&journal->j_reserved_credits), in jbd2_journal_commit_transaction()
527 trace_jbd2_commit_flushing(journal, commit_transaction); in jbd2_journal_commit_transaction()
533 journal->j_committing_transaction = commit_transaction; in jbd2_journal_commit_transaction()
534 journal->j_running_transaction = NULL; in jbd2_journal_commit_transaction()
536 commit_transaction->t_log_start = journal->j_head; in jbd2_journal_commit_transaction()
537 wake_up_all(&journal->j_wait_transaction_locked); in jbd2_journal_commit_transaction()
538 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
546 err = journal_submit_data_buffers(journal, commit_transaction); in jbd2_journal_commit_transaction()
548 jbd2_journal_abort(journal, err); in jbd2_journal_commit_transaction()
560 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
562 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
564 trace_jbd2_commit_logging(journal, commit_transaction); in jbd2_journal_commit_transaction()
585 if (is_journal_aborted(journal)) { in jbd2_journal_commit_transaction()
592 jbd2_journal_refile_buffer(journal, jh); in jbd2_journal_commit_transaction()
614 jbd2_journal_abort(journal, -EIO); in jbd2_journal_commit_transaction()
637 err = jbd2_journal_next_log_block(journal, &blocknr); in jbd2_journal_commit_transaction()
642 jbd2_journal_abort(journal, err); in jbd2_journal_commit_transaction()
666 jbd2_journal_abort(journal, escape); in jbd2_journal_commit_transaction()
681 write_tag_block(journal, tag, jh2bh(jh)->b_blocknr); in jbd2_journal_commit_transaction()
683 jbd2_block_tag_csum_set(journal, tag, wbuf[bufs], in jbd2_journal_commit_transaction()
690 memcpy (tagp, journal->j_uuid, 16); in jbd2_journal_commit_transaction()
699 if (bufs == journal->j_wbufsize || in jbd2_journal_commit_transaction()
712 jbd2_descriptor_block_csum_set(journal, in jbd2_journal_commit_transaction()
721 if (jbd2_has_feature_checksum(journal)) { in jbd2_journal_commit_transaction()
742 err = journal_finish_inode_data_buffers(journal, commit_transaction); in jbd2_journal_commit_transaction()
746 "on %s\n", journal->j_devname); in jbd2_journal_commit_transaction()
747 if (journal->j_flags & JBD2_ABORT_ON_SYNCDATA_ERR) in jbd2_journal_commit_transaction()
748 jbd2_journal_abort(journal, err); in jbd2_journal_commit_transaction()
760 jbd2_journal_get_log_tail(journal, &first_tid, &first_block); in jbd2_journal_commit_transaction()
762 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
764 long freed = first_block - journal->j_tail; in jbd2_journal_commit_transaction()
766 if (first_block < journal->j_tail) in jbd2_journal_commit_transaction()
767 freed += journal->j_last - journal->j_first; in jbd2_journal_commit_transaction()
769 if (freed < journal->j_max_transaction_buffers) in jbd2_journal_commit_transaction()
774 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
782 (journal->j_fs_dev != journal->j_dev) && in jbd2_journal_commit_transaction()
783 (journal->j_flags & JBD2_BARRIER)) in jbd2_journal_commit_transaction()
784 blkdev_issue_flush(journal->j_fs_dev); in jbd2_journal_commit_transaction()
787 if (jbd2_has_feature_async_commit(journal)) { in jbd2_journal_commit_transaction()
788 err = journal_submit_commit_record(journal, commit_transaction, in jbd2_journal_commit_transaction()
791 jbd2_journal_abort(journal, err); in jbd2_journal_commit_transaction()
872 jbd2_journal_abort(journal, err); in jbd2_journal_commit_transaction()
875 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
878 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
880 if (!jbd2_has_feature_async_commit(journal)) { in jbd2_journal_commit_transaction()
881 err = journal_submit_commit_record(journal, commit_transaction, in jbd2_journal_commit_transaction()
884 jbd2_journal_abort(journal, err); in jbd2_journal_commit_transaction()
887 err = journal_wait_on_commit_record(journal, cbh); in jbd2_journal_commit_transaction()
889 if (jbd2_has_feature_async_commit(journal) && in jbd2_journal_commit_transaction()
890 journal->j_flags & JBD2_BARRIER) { in jbd2_journal_commit_transaction()
891 blkdev_issue_flush(journal->j_dev); in jbd2_journal_commit_transaction()
895 jbd2_journal_abort(journal, err); in jbd2_journal_commit_transaction()
906 jbd2_update_log_tail(journal, first_tid, first_block); in jbd2_journal_commit_transaction()
925 spin_lock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
933 spin_unlock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
970 spin_lock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1023 if (is_journal_aborted(journal)) in jbd2_journal_commit_transaction()
1048 cond_resched_lock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1050 spin_unlock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1057 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
1058 spin_lock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1064 spin_unlock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1065 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
1072 if (journal->j_checkpoint_transactions == NULL) { in jbd2_journal_commit_transaction()
1073 journal->j_checkpoint_transactions = commit_transaction; in jbd2_journal_commit_transaction()
1078 journal->j_checkpoint_transactions; in jbd2_journal_commit_transaction()
1086 spin_unlock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1104 trace_jbd2_run_stats(journal->j_fs_dev->bd_dev, in jbd2_journal_commit_transaction()
1109 J_ASSERT(commit_transaction == journal->j_committing_transaction); in jbd2_journal_commit_transaction()
1110 WRITE_ONCE(journal->j_commit_sequence, commit_transaction->t_tid); in jbd2_journal_commit_transaction()
1111 journal->j_committing_transaction = NULL; in jbd2_journal_commit_transaction()
1118 if (likely(journal->j_average_commit_time)) in jbd2_journal_commit_transaction()
1119 journal->j_average_commit_time = (commit_time + in jbd2_journal_commit_transaction()
1120 journal->j_average_commit_time*3) / 4; in jbd2_journal_commit_transaction()
1122 journal->j_average_commit_time = commit_time; in jbd2_journal_commit_transaction()
1124 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
1126 if (journal->j_commit_callback) in jbd2_journal_commit_transaction()
1127 journal->j_commit_callback(journal, commit_transaction); in jbd2_journal_commit_transaction()
1128 if (journal->j_fc_cleanup_callback) in jbd2_journal_commit_transaction()
1129 journal->j_fc_cleanup_callback(journal, 1, commit_transaction->t_tid); in jbd2_journal_commit_transaction()
1131 trace_jbd2_end_commit(journal, commit_transaction); in jbd2_journal_commit_transaction()
1133 journal->j_commit_sequence, journal->j_tail_sequence); in jbd2_journal_commit_transaction()
1135 write_lock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
1136 journal->j_flags &= ~JBD2_FULL_COMMIT_ONGOING; in jbd2_journal_commit_transaction()
1137 journal->j_flags &= ~JBD2_FAST_COMMIT_ONGOING; in jbd2_journal_commit_transaction()
1138 spin_lock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1142 __jbd2_journal_drop_transaction(journal, commit_transaction); in jbd2_journal_commit_transaction()
1145 spin_unlock(&journal->j_list_lock); in jbd2_journal_commit_transaction()
1146 write_unlock(&journal->j_state_lock); in jbd2_journal_commit_transaction()
1147 wake_up(&journal->j_wait_done_commit); in jbd2_journal_commit_transaction()
1148 wake_up(&journal->j_fc_wait); in jbd2_journal_commit_transaction()
1153 spin_lock(&journal->j_history_lock); in jbd2_journal_commit_transaction()
1154 journal->j_stats.ts_tid++; in jbd2_journal_commit_transaction()
1155 journal->j_stats.ts_requested += stats.ts_requested; in jbd2_journal_commit_transaction()
1156 journal->j_stats.run.rs_wait += stats.run.rs_wait; in jbd2_journal_commit_transaction()
1157 journal->j_stats.run.rs_request_delay += stats.run.rs_request_delay; in jbd2_journal_commit_transaction()
1158 journal->j_stats.run.rs_running += stats.run.rs_running; in jbd2_journal_commit_transaction()
1159 journal->j_stats.run.rs_locked += stats.run.rs_locked; in jbd2_journal_commit_transaction()
1160 journal->j_stats.run.rs_flushing += stats.run.rs_flushing; in jbd2_journal_commit_transaction()
1161 journal->j_stats.run.rs_logging += stats.run.rs_logging; in jbd2_journal_commit_transaction()
1162 journal->j_stats.run.rs_handle_count += stats.run.rs_handle_count; in jbd2_journal_commit_transaction()
1163 journal->j_stats.run.rs_blocks += stats.run.rs_blocks; in jbd2_journal_commit_transaction()
1164 journal->j_stats.run.rs_blocks_logged += stats.run.rs_blocks_logged; in jbd2_journal_commit_transaction()
1165 spin_unlock(&journal->j_history_lock); in jbd2_journal_commit_transaction()