diff options
Diffstat (limited to 'fs/jbd2/commit.c')
-rw-r--r-- | fs/jbd2/commit.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 62804e57a44c..7b4088b2364d 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/time.h> | 16 | #include <linux/time.h> |
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/jbd2.h> | 18 | #include <linux/jbd2.h> |
19 | #include <linux/marker.h> | ||
20 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
21 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
22 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
@@ -26,6 +25,7 @@ | |||
26 | #include <linux/writeback.h> | 25 | #include <linux/writeback.h> |
27 | #include <linux/backing-dev.h> | 26 | #include <linux/backing-dev.h> |
28 | #include <linux/bio.h> | 27 | #include <linux/bio.h> |
28 | #include <trace/events/jbd2.h> | ||
29 | 29 | ||
30 | /* | 30 | /* |
31 | * Default IO end handler for temporary BJ_IO buffer_heads. | 31 | * Default IO end handler for temporary BJ_IO buffer_heads. |
@@ -138,7 +138,7 @@ static int journal_submit_commit_record(journal_t *journal, | |||
138 | set_buffer_ordered(bh); | 138 | set_buffer_ordered(bh); |
139 | barrier_done = 1; | 139 | barrier_done = 1; |
140 | } | 140 | } |
141 | ret = submit_bh(WRITE_SYNC, bh); | 141 | ret = submit_bh(WRITE_SYNC_PLUG, bh); |
142 | if (barrier_done) | 142 | if (barrier_done) |
143 | clear_buffer_ordered(bh); | 143 | clear_buffer_ordered(bh); |
144 | 144 | ||
@@ -159,7 +159,7 @@ static int journal_submit_commit_record(journal_t *journal, | |||
159 | lock_buffer(bh); | 159 | lock_buffer(bh); |
160 | set_buffer_uptodate(bh); | 160 | set_buffer_uptodate(bh); |
161 | clear_buffer_dirty(bh); | 161 | clear_buffer_dirty(bh); |
162 | ret = submit_bh(WRITE_SYNC, bh); | 162 | ret = submit_bh(WRITE_SYNC_PLUG, bh); |
163 | } | 163 | } |
164 | *cbh = bh; | 164 | *cbh = bh; |
165 | return ret; | 165 | return ret; |
@@ -190,7 +190,7 @@ retry: | |||
190 | set_buffer_uptodate(bh); | 190 | set_buffer_uptodate(bh); |
191 | bh->b_end_io = journal_end_buffer_io_sync; | 191 | bh->b_end_io = journal_end_buffer_io_sync; |
192 | 192 | ||
193 | ret = submit_bh(WRITE_SYNC, bh); | 193 | ret = submit_bh(WRITE_SYNC_PLUG, bh); |
194 | if (ret) { | 194 | if (ret) { |
195 | unlock_buffer(bh); | 195 | unlock_buffer(bh); |
196 | return ret; | 196 | return ret; |
@@ -253,6 +253,7 @@ static int journal_submit_data_buffers(journal_t *journal, | |||
253 | * block allocation with delalloc. We need to write | 253 | * block allocation with delalloc. We need to write |
254 | * only allocated blocks here. | 254 | * only allocated blocks here. |
255 | */ | 255 | */ |
256 | trace_jbd2_submit_inode_data(jinode->i_vfs_inode); | ||
256 | err = journal_submit_inode_data_buffers(mapping); | 257 | err = journal_submit_inode_data_buffers(mapping); |
257 | if (!ret) | 258 | if (!ret) |
258 | ret = err; | 259 | ret = err; |
@@ -367,6 +368,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
367 | int tag_bytes = journal_tag_bytes(journal); | 368 | int tag_bytes = journal_tag_bytes(journal); |
368 | struct buffer_head *cbh = NULL; /* For transactional checksums */ | 369 | struct buffer_head *cbh = NULL; /* For transactional checksums */ |
369 | __u32 crc32_sum = ~0; | 370 | __u32 crc32_sum = ~0; |
371 | int write_op = WRITE; | ||
370 | 372 | ||
371 | /* | 373 | /* |
372 | * First job: lock down the current transaction and wait for | 374 | * First job: lock down the current transaction and wait for |
@@ -393,14 +395,21 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
393 | commit_transaction = journal->j_running_transaction; | 395 | commit_transaction = journal->j_running_transaction; |
394 | J_ASSERT(commit_transaction->t_state == T_RUNNING); | 396 | J_ASSERT(commit_transaction->t_state == T_RUNNING); |
395 | 397 | ||
396 | trace_mark(jbd2_start_commit, "dev %s transaction %d", | 398 | trace_jbd2_start_commit(journal, commit_transaction); |
397 | journal->j_devname, commit_transaction->t_tid); | ||
398 | jbd_debug(1, "JBD: starting commit of transaction %d\n", | 399 | jbd_debug(1, "JBD: starting commit of transaction %d\n", |
399 | commit_transaction->t_tid); | 400 | commit_transaction->t_tid); |
400 | 401 | ||
401 | spin_lock(&journal->j_state_lock); | 402 | spin_lock(&journal->j_state_lock); |
402 | commit_transaction->t_state = T_LOCKED; | 403 | commit_transaction->t_state = T_LOCKED; |
403 | 404 | ||
405 | /* | ||
406 | * Use plugged writes here, since we want to submit several before | ||
407 | * we unplug the device. We don't do explicit unplugging in here, | ||
408 | * instead we rely on sync_buffer() doing the unplug for us. | ||
409 | */ | ||
410 | if (commit_transaction->t_synchronous_commit) | ||
411 | write_op = WRITE_SYNC_PLUG; | ||
412 | trace_jbd2_commit_locking(journal, commit_transaction); | ||
404 | stats.u.run.rs_wait = commit_transaction->t_max_wait; | 413 | stats.u.run.rs_wait = commit_transaction->t_max_wait; |
405 | stats.u.run.rs_locked = jiffies; | 414 | stats.u.run.rs_locked = jiffies; |
406 | stats.u.run.rs_running = jbd2_time_diff(commit_transaction->t_start, | 415 | stats.u.run.rs_running = jbd2_time_diff(commit_transaction->t_start, |
@@ -476,6 +485,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
476 | */ | 485 | */ |
477 | jbd2_journal_switch_revoke_table(journal); | 486 | jbd2_journal_switch_revoke_table(journal); |
478 | 487 | ||
488 | trace_jbd2_commit_flushing(journal, commit_transaction); | ||
479 | stats.u.run.rs_flushing = jiffies; | 489 | stats.u.run.rs_flushing = jiffies; |
480 | stats.u.run.rs_locked = jbd2_time_diff(stats.u.run.rs_locked, | 490 | stats.u.run.rs_locked = jbd2_time_diff(stats.u.run.rs_locked, |
481 | stats.u.run.rs_flushing); | 491 | stats.u.run.rs_flushing); |
@@ -498,7 +508,8 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
498 | if (err) | 508 | if (err) |
499 | jbd2_journal_abort(journal, err); | 509 | jbd2_journal_abort(journal, err); |
500 | 510 | ||
501 | jbd2_journal_write_revoke_records(journal, commit_transaction); | 511 | jbd2_journal_write_revoke_records(journal, commit_transaction, |
512 | write_op); | ||
502 | 513 | ||
503 | jbd_debug(3, "JBD: commit phase 2\n"); | 514 | jbd_debug(3, "JBD: commit phase 2\n"); |
504 | 515 | ||
@@ -511,6 +522,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
511 | commit_transaction->t_state = T_COMMIT; | 522 | commit_transaction->t_state = T_COMMIT; |
512 | spin_unlock(&journal->j_state_lock); | 523 | spin_unlock(&journal->j_state_lock); |
513 | 524 | ||
525 | trace_jbd2_commit_logging(journal, commit_transaction); | ||
514 | stats.u.run.rs_logging = jiffies; | 526 | stats.u.run.rs_logging = jiffies; |
515 | stats.u.run.rs_flushing = jbd2_time_diff(stats.u.run.rs_flushing, | 527 | stats.u.run.rs_flushing = jbd2_time_diff(stats.u.run.rs_flushing, |
516 | stats.u.run.rs_logging); | 528 | stats.u.run.rs_logging); |
@@ -680,7 +692,7 @@ start_journal_io: | |||
680 | clear_buffer_dirty(bh); | 692 | clear_buffer_dirty(bh); |
681 | set_buffer_uptodate(bh); | 693 | set_buffer_uptodate(bh); |
682 | bh->b_end_io = journal_end_buffer_io_sync; | 694 | bh->b_end_io = journal_end_buffer_io_sync; |
683 | submit_bh(WRITE, bh); | 695 | submit_bh(write_op, bh); |
684 | } | 696 | } |
685 | cond_resched(); | 697 | cond_resched(); |
686 | stats.u.run.rs_blocks_logged += bufs; | 698 | stats.u.run.rs_blocks_logged += bufs; |
@@ -1045,9 +1057,7 @@ restart_loop: | |||
1045 | if (journal->j_commit_callback) | 1057 | if (journal->j_commit_callback) |
1046 | journal->j_commit_callback(journal, commit_transaction); | 1058 | journal->j_commit_callback(journal, commit_transaction); |
1047 | 1059 | ||
1048 | trace_mark(jbd2_end_commit, "dev %s transaction %d head %d", | 1060 | trace_jbd2_end_commit(journal, commit_transaction); |
1049 | journal->j_devname, commit_transaction->t_tid, | ||
1050 | journal->j_tail_sequence); | ||
1051 | jbd_debug(1, "JBD: commit %d complete, head %d\n", | 1061 | jbd_debug(1, "JBD: commit %d complete, head %d\n", |
1052 | journal->j_commit_sequence, journal->j_tail_sequence); | 1062 | journal->j_commit_sequence, journal->j_tail_sequence); |
1053 | if (to_free) | 1063 | if (to_free) |