diff options
Diffstat (limited to 'include/linux/jbd2.h')
-rw-r--r-- | include/linux/jbd2.h | 70 |
1 files changed, 67 insertions, 3 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index c7d106ef22e2..b45109c61fba 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -329,6 +329,7 @@ enum jbd_state_bits { | |||
329 | BH_State, /* Pins most journal_head state */ | 329 | BH_State, /* Pins most journal_head state */ |
330 | BH_JournalHead, /* Pins bh->b_private and jh->b_bh */ | 330 | BH_JournalHead, /* Pins bh->b_private and jh->b_bh */ |
331 | BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */ | 331 | BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */ |
332 | BH_JBDPrivateStart, /* First bit available for private use by FS */ | ||
332 | }; | 333 | }; |
333 | 334 | ||
334 | BUFFER_FNS(JBD, jbd) | 335 | BUFFER_FNS(JBD, jbd) |
@@ -637,6 +638,11 @@ struct transaction_s | |||
637 | unsigned long t_expires; | 638 | unsigned long t_expires; |
638 | 639 | ||
639 | /* | 640 | /* |
641 | * When this transaction started, in nanoseconds [no locking] | ||
642 | */ | ||
643 | ktime_t t_start_time; | ||
644 | |||
645 | /* | ||
640 | * How many handles used this transaction? [t_handle_lock] | 646 | * How many handles used this transaction? [t_handle_lock] |
641 | */ | 647 | */ |
642 | int t_handle_count; | 648 | int t_handle_count; |
@@ -681,6 +687,8 @@ jbd2_time_diff(unsigned long start, unsigned long end) | |||
681 | return end + (MAX_JIFFY_OFFSET - start); | 687 | return end + (MAX_JIFFY_OFFSET - start); |
682 | } | 688 | } |
683 | 689 | ||
690 | #define JBD2_NR_BATCH 64 | ||
691 | |||
684 | /** | 692 | /** |
685 | * struct journal_s - The journal_s type is the concrete type associated with | 693 | * struct journal_s - The journal_s type is the concrete type associated with |
686 | * journal_t. | 694 | * journal_t. |
@@ -825,6 +833,14 @@ struct journal_s | |||
825 | struct mutex j_checkpoint_mutex; | 833 | struct mutex j_checkpoint_mutex; |
826 | 834 | ||
827 | /* | 835 | /* |
836 | * List of buffer heads used by the checkpoint routine. This | ||
837 | * was moved from jbd2_log_do_checkpoint() to reduce stack | ||
838 | * usage. Access to this array is controlled by the | ||
839 | * j_checkpoint_mutex. [j_checkpoint_mutex] | ||
840 | */ | ||
841 | struct buffer_head *j_chkpt_bhs[JBD2_NR_BATCH]; | ||
842 | |||
843 | /* | ||
828 | * Journal head: identifies the first unused block in the journal. | 844 | * Journal head: identifies the first unused block in the journal. |
829 | * [j_state_lock] | 845 | * [j_state_lock] |
830 | */ | 846 | */ |
@@ -938,8 +954,26 @@ struct journal_s | |||
938 | struct buffer_head **j_wbuf; | 954 | struct buffer_head **j_wbuf; |
939 | int j_wbufsize; | 955 | int j_wbufsize; |
940 | 956 | ||
957 | /* | ||
958 | * this is the pid of hte last person to run a synchronous operation | ||
959 | * through the journal | ||
960 | */ | ||
941 | pid_t j_last_sync_writer; | 961 | pid_t j_last_sync_writer; |
942 | 962 | ||
963 | /* | ||
964 | * the average amount of time in nanoseconds it takes to commit a | ||
965 | * transaction to disk. [j_state_lock] | ||
966 | */ | ||
967 | u64 j_average_commit_time; | ||
968 | |||
969 | /* | ||
970 | * minimum and maximum times that we should wait for | ||
971 | * additional filesystem operations to get batched into a | ||
972 | * synchronous handle in microseconds | ||
973 | */ | ||
974 | u32 j_min_batch_time; | ||
975 | u32 j_max_batch_time; | ||
976 | |||
943 | /* This function is called when a transaction is closed */ | 977 | /* This function is called when a transaction is closed */ |
944 | void (*j_commit_callback)(journal_t *, | 978 | void (*j_commit_callback)(journal_t *, |
945 | transaction_t *); | 979 | transaction_t *); |
@@ -1007,6 +1041,35 @@ int __jbd2_journal_clean_checkpoint_list(journal_t *journal); | |||
1007 | int __jbd2_journal_remove_checkpoint(struct journal_head *); | 1041 | int __jbd2_journal_remove_checkpoint(struct journal_head *); |
1008 | void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *); | 1042 | void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *); |
1009 | 1043 | ||
1044 | |||
1045 | /* | ||
1046 | * Triggers | ||
1047 | */ | ||
1048 | |||
1049 | struct jbd2_buffer_trigger_type { | ||
1050 | /* | ||
1051 | * Fired just before a buffer is written to the journal. | ||
1052 | * mapped_data is a mapped buffer that is the frozen data for | ||
1053 | * commit. | ||
1054 | */ | ||
1055 | void (*t_commit)(struct jbd2_buffer_trigger_type *type, | ||
1056 | struct buffer_head *bh, void *mapped_data, | ||
1057 | size_t size); | ||
1058 | |||
1059 | /* | ||
1060 | * Fired during journal abort for dirty buffers that will not be | ||
1061 | * committed. | ||
1062 | */ | ||
1063 | void (*t_abort)(struct jbd2_buffer_trigger_type *type, | ||
1064 | struct buffer_head *bh); | ||
1065 | }; | ||
1066 | |||
1067 | extern void jbd2_buffer_commit_trigger(struct journal_head *jh, | ||
1068 | void *mapped_data, | ||
1069 | struct jbd2_buffer_trigger_type *triggers); | ||
1070 | extern void jbd2_buffer_abort_trigger(struct journal_head *jh, | ||
1071 | struct jbd2_buffer_trigger_type *triggers); | ||
1072 | |||
1010 | /* Buffer IO */ | 1073 | /* Buffer IO */ |
1011 | extern int | 1074 | extern int |
1012 | jbd2_journal_write_metadata_buffer(transaction_t *transaction, | 1075 | jbd2_journal_write_metadata_buffer(transaction_t *transaction, |
@@ -1045,6 +1108,8 @@ extern int jbd2_journal_extend (handle_t *, int nblocks); | |||
1045 | extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); | 1108 | extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); |
1046 | extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); | 1109 | extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); |
1047 | extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *); | 1110 | extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *); |
1111 | void jbd2_journal_set_triggers(struct buffer_head *, | ||
1112 | struct jbd2_buffer_trigger_type *type); | ||
1048 | extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); | 1113 | extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); |
1049 | extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *); | 1114 | extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *); |
1050 | extern int jbd2_journal_forget (handle_t *, struct buffer_head *); | 1115 | extern int jbd2_journal_forget (handle_t *, struct buffer_head *); |
@@ -1070,7 +1135,6 @@ extern int jbd2_journal_set_features | |||
1070 | (journal_t *, unsigned long, unsigned long, unsigned long); | 1135 | (journal_t *, unsigned long, unsigned long, unsigned long); |
1071 | extern void jbd2_journal_clear_features | 1136 | extern void jbd2_journal_clear_features |
1072 | (journal_t *, unsigned long, unsigned long, unsigned long); | 1137 | (journal_t *, unsigned long, unsigned long, unsigned long); |
1073 | extern int jbd2_journal_create (journal_t *); | ||
1074 | extern int jbd2_journal_load (journal_t *journal); | 1138 | extern int jbd2_journal_load (journal_t *journal); |
1075 | extern int jbd2_journal_destroy (journal_t *); | 1139 | extern int jbd2_journal_destroy (journal_t *); |
1076 | extern int jbd2_journal_recover (journal_t *journal); | 1140 | extern int jbd2_journal_recover (journal_t *journal); |
@@ -1145,8 +1209,8 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid); | |||
1145 | int jbd2_log_do_checkpoint(journal_t *journal); | 1209 | int jbd2_log_do_checkpoint(journal_t *journal); |
1146 | 1210 | ||
1147 | void __jbd2_log_wait_for_space(journal_t *journal); | 1211 | void __jbd2_log_wait_for_space(journal_t *journal); |
1148 | extern void __jbd2_journal_drop_transaction(journal_t *, transaction_t *); | 1212 | extern void __jbd2_journal_drop_transaction(journal_t *, transaction_t *); |
1149 | extern int jbd2_cleanup_journal_tail(journal_t *); | 1213 | extern int jbd2_cleanup_journal_tail(journal_t *); |
1150 | 1214 | ||
1151 | /* Debugging code only: */ | 1215 | /* Debugging code only: */ |
1152 | 1216 | ||