aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jbd2')
-rw-r--r--fs/jbd2/journal.c15
-rw-r--r--fs/jbd2/transaction.c9
2 files changed, 13 insertions, 11 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index e7bf0fd9cec7..ad5866aaf0f9 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -296,7 +296,6 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
296 struct page *new_page; 296 struct page *new_page;
297 unsigned int new_offset; 297 unsigned int new_offset;
298 struct buffer_head *bh_in = jh2bh(jh_in); 298 struct buffer_head *bh_in = jh2bh(jh_in);
299 struct jbd2_buffer_trigger_type *triggers;
300 journal_t *journal = transaction->t_journal; 299 journal_t *journal = transaction->t_journal;
301 300
302 /* 301 /*
@@ -337,21 +336,21 @@ repeat:
337 done_copy_out = 1; 336 done_copy_out = 1;
338 new_page = virt_to_page(jh_in->b_frozen_data); 337 new_page = virt_to_page(jh_in->b_frozen_data);
339 new_offset = offset_in_page(jh_in->b_frozen_data); 338 new_offset = offset_in_page(jh_in->b_frozen_data);
340 triggers = jh_in->b_frozen_triggers;
341 } else { 339 } else {
342 new_page = jh2bh(jh_in)->b_page; 340 new_page = jh2bh(jh_in)->b_page;
343 new_offset = offset_in_page(jh2bh(jh_in)->b_data); 341 new_offset = offset_in_page(jh2bh(jh_in)->b_data);
344 triggers = jh_in->b_triggers;
345 } 342 }
346 343
347 mapped_data = kmap_atomic(new_page, KM_USER0); 344 mapped_data = kmap_atomic(new_page, KM_USER0);
348 /* 345 /*
349 * Fire any commit trigger. Do this before checking for escaping, 346 * Fire data frozen trigger if data already wasn't frozen. Do this
350 * as the trigger may modify the magic offset. If a copy-out 347 * before checking for escaping, as the trigger may modify the magic
351 * happens afterwards, it will have the correct data in the buffer. 348 * offset. If a copy-out happens afterwards, it will have the correct
349 * data in the buffer.
352 */ 350 */
353 jbd2_buffer_commit_trigger(jh_in, mapped_data + new_offset, 351 if (!done_copy_out)
354 triggers); 352 jbd2_buffer_frozen_trigger(jh_in, mapped_data + new_offset,
353 jh_in->b_triggers);
355 354
356 /* 355 /*
357 * Check for escaping 356 * Check for escaping
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 0752bcda535f..d95cc9d0401d 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -767,6 +767,9 @@ done:
767 page = jh2bh(jh)->b_page; 767 page = jh2bh(jh)->b_page;
768 offset = ((unsigned long) jh2bh(jh)->b_data) & ~PAGE_MASK; 768 offset = ((unsigned long) jh2bh(jh)->b_data) & ~PAGE_MASK;
769 source = kmap_atomic(page, KM_USER0); 769 source = kmap_atomic(page, KM_USER0);
770 /* Fire data frozen trigger just before we copy the data */
771 jbd2_buffer_frozen_trigger(jh, source + offset,
772 jh->b_triggers);
770 memcpy(jh->b_frozen_data, source+offset, jh2bh(jh)->b_size); 773 memcpy(jh->b_frozen_data, source+offset, jh2bh(jh)->b_size);
771 kunmap_atomic(source, KM_USER0); 774 kunmap_atomic(source, KM_USER0);
772 775
@@ -1005,15 +1008,15 @@ void jbd2_journal_set_triggers(struct buffer_head *bh,
1005 jh->b_triggers = type; 1008 jh->b_triggers = type;
1006} 1009}
1007 1010
1008void jbd2_buffer_commit_trigger(struct journal_head *jh, void *mapped_data, 1011void jbd2_buffer_frozen_trigger(struct journal_head *jh, void *mapped_data,
1009 struct jbd2_buffer_trigger_type *triggers) 1012 struct jbd2_buffer_trigger_type *triggers)
1010{ 1013{
1011 struct buffer_head *bh = jh2bh(jh); 1014 struct buffer_head *bh = jh2bh(jh);
1012 1015
1013 if (!triggers || !triggers->t_commit) 1016 if (!triggers || !triggers->t_frozen)
1014 return; 1017 return;
1015 1018
1016 triggers->t_commit(triggers, bh, mapped_data, bh->b_size); 1019 triggers->t_frozen(triggers, bh, mapped_data, bh->b_size);
1017} 1020}
1018 1021
1019void jbd2_buffer_abort_trigger(struct journal_head *jh, 1022void jbd2_buffer_abort_trigger(struct journal_head *jh,