diff options
Diffstat (limited to 'fs/jbd2/transaction.c')
-rw-r--r-- | fs/jbd2/transaction.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 39b7805a599a..4f925a4f3d05 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -741,6 +741,12 @@ done: | |||
741 | source = kmap_atomic(page, KM_USER0); | 741 | source = kmap_atomic(page, KM_USER0); |
742 | memcpy(jh->b_frozen_data, source+offset, jh2bh(jh)->b_size); | 742 | memcpy(jh->b_frozen_data, source+offset, jh2bh(jh)->b_size); |
743 | kunmap_atomic(source, KM_USER0); | 743 | kunmap_atomic(source, KM_USER0); |
744 | |||
745 | /* | ||
746 | * Now that the frozen data is saved off, we need to store | ||
747 | * any matching triggers. | ||
748 | */ | ||
749 | jh->b_frozen_triggers = jh->b_triggers; | ||
744 | } | 750 | } |
745 | jbd_unlock_bh_state(bh); | 751 | jbd_unlock_bh_state(bh); |
746 | 752 | ||
@@ -944,6 +950,47 @@ out: | |||
944 | } | 950 | } |
945 | 951 | ||
946 | /** | 952 | /** |
953 | * void jbd2_journal_set_triggers() - Add triggers for commit writeout | ||
954 | * @bh: buffer to trigger on | ||
955 | * @type: struct jbd2_buffer_trigger_type containing the trigger(s). | ||
956 | * | ||
957 | * Set any triggers on this journal_head. This is always safe, because | ||
958 | * triggers for a committing buffer will be saved off, and triggers for | ||
959 | * a running transaction will match the buffer in that transaction. | ||
960 | * | ||
961 | * Call with NULL to clear the triggers. | ||
962 | */ | ||
963 | void jbd2_journal_set_triggers(struct buffer_head *bh, | ||
964 | struct jbd2_buffer_trigger_type *type) | ||
965 | { | ||
966 | struct journal_head *jh = bh2jh(bh); | ||
967 | |||
968 | jh->b_triggers = type; | ||
969 | } | ||
970 | |||
971 | void jbd2_buffer_commit_trigger(struct journal_head *jh, void *mapped_data, | ||
972 | struct jbd2_buffer_trigger_type *triggers) | ||
973 | { | ||
974 | struct buffer_head *bh = jh2bh(jh); | ||
975 | |||
976 | if (!triggers || !triggers->t_commit) | ||
977 | return; | ||
978 | |||
979 | triggers->t_commit(triggers, bh, mapped_data, bh->b_size); | ||
980 | } | ||
981 | |||
982 | void jbd2_buffer_abort_trigger(struct journal_head *jh, | ||
983 | struct jbd2_buffer_trigger_type *triggers) | ||
984 | { | ||
985 | if (!triggers || !triggers->t_abort) | ||
986 | return; | ||
987 | |||
988 | triggers->t_abort(triggers, jh2bh(jh)); | ||
989 | } | ||
990 | |||
991 | |||
992 | |||
993 | /** | ||
947 | * int jbd2_journal_dirty_metadata() - mark a buffer as containing dirty metadata | 994 | * int jbd2_journal_dirty_metadata() - mark a buffer as containing dirty metadata |
948 | * @handle: transaction to add buffer to. | 995 | * @handle: transaction to add buffer to. |
949 | * @bh: buffer to mark | 996 | * @bh: buffer to mark |