diff options
author | Len Brown <len.brown@intel.com> | 2009-04-05 02:14:15 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-04-05 02:14:15 -0400 |
commit | 478c6a43fcbc6c11609f8cee7c7b57223907754f (patch) | |
tree | a7f7952099da60d33032aed6de9c0c56c9f8779e /fs/jbd2 | |
parent | 8a3f257c704e02aee9869decd069a806b45be3f1 (diff) | |
parent | 6bb597507f9839b13498781e481f5458aea33620 (diff) |
Merge branch 'linus' into release
Conflicts:
arch/x86/kernel/cpu/cpufreq/longhaul.c
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'fs/jbd2')
-rw-r--r-- | fs/jbd2/commit.c | 5 | ||||
-rw-r--r-- | fs/jbd2/revoke.c | 24 | ||||
-rw-r--r-- | fs/jbd2/transaction.c | 2 |
3 files changed, 25 insertions, 6 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 62804e57a44c..4ea72377c7a2 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -367,6 +367,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
367 | int tag_bytes = journal_tag_bytes(journal); | 367 | int tag_bytes = journal_tag_bytes(journal); |
368 | struct buffer_head *cbh = NULL; /* For transactional checksums */ | 368 | struct buffer_head *cbh = NULL; /* For transactional checksums */ |
369 | __u32 crc32_sum = ~0; | 369 | __u32 crc32_sum = ~0; |
370 | int write_op = WRITE; | ||
370 | 371 | ||
371 | /* | 372 | /* |
372 | * First job: lock down the current transaction and wait for | 373 | * First job: lock down the current transaction and wait for |
@@ -401,6 +402,8 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
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 | if (commit_transaction->t_synchronous_commit) | ||
406 | write_op = WRITE_SYNC; | ||
404 | stats.u.run.rs_wait = commit_transaction->t_max_wait; | 407 | stats.u.run.rs_wait = commit_transaction->t_max_wait; |
405 | stats.u.run.rs_locked = jiffies; | 408 | stats.u.run.rs_locked = jiffies; |
406 | stats.u.run.rs_running = jbd2_time_diff(commit_transaction->t_start, | 409 | stats.u.run.rs_running = jbd2_time_diff(commit_transaction->t_start, |
@@ -680,7 +683,7 @@ start_journal_io: | |||
680 | clear_buffer_dirty(bh); | 683 | clear_buffer_dirty(bh); |
681 | set_buffer_uptodate(bh); | 684 | set_buffer_uptodate(bh); |
682 | bh->b_end_io = journal_end_buffer_io_sync; | 685 | bh->b_end_io = journal_end_buffer_io_sync; |
683 | submit_bh(WRITE, bh); | 686 | submit_bh(write_op, bh); |
684 | } | 687 | } |
685 | cond_resched(); | 688 | cond_resched(); |
686 | stats.u.run.rs_blocks_logged += bufs; | 689 | stats.u.run.rs_blocks_logged += bufs; |
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index 257ff2625765..bbe6d592d8b3 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c | |||
@@ -55,6 +55,25 @@ | |||
55 | * need do nothing. | 55 | * need do nothing. |
56 | * RevokeValid set, Revoked set: | 56 | * RevokeValid set, Revoked set: |
57 | * buffer has been revoked. | 57 | * buffer has been revoked. |
58 | * | ||
59 | * Locking rules: | ||
60 | * We keep two hash tables of revoke records. One hashtable belongs to the | ||
61 | * running transaction (is pointed to by journal->j_revoke), the other one | ||
62 | * belongs to the committing transaction. Accesses to the second hash table | ||
63 | * happen only from the kjournald and no other thread touches this table. Also | ||
64 | * journal_switch_revoke_table() which switches which hashtable belongs to the | ||
65 | * running and which to the committing transaction is called only from | ||
66 | * kjournald. Therefore we need no locks when accessing the hashtable belonging | ||
67 | * to the committing transaction. | ||
68 | * | ||
69 | * All users operating on the hash table belonging to the running transaction | ||
70 | * have a handle to the transaction. Therefore they are safe from kjournald | ||
71 | * switching hash tables under them. For operations on the lists of entries in | ||
72 | * the hash table j_revoke_lock is used. | ||
73 | * | ||
74 | * Finally, also replay code uses the hash tables but at this moment noone else | ||
75 | * can touch them (filesystem isn't mounted yet) and hence no locking is | ||
76 | * needed. | ||
58 | */ | 77 | */ |
59 | 78 | ||
60 | #ifndef __KERNEL__ | 79 | #ifndef __KERNEL__ |
@@ -401,8 +420,6 @@ int jbd2_journal_revoke(handle_t *handle, unsigned long long blocknr, | |||
401 | * the second time we would still have a pending revoke to cancel. So, | 420 | * the second time we would still have a pending revoke to cancel. So, |
402 | * do not trust the Revoked bit on buffers unless RevokeValid is also | 421 | * do not trust the Revoked bit on buffers unless RevokeValid is also |
403 | * set. | 422 | * set. |
404 | * | ||
405 | * The caller must have the journal locked. | ||
406 | */ | 423 | */ |
407 | int jbd2_journal_cancel_revoke(handle_t *handle, struct journal_head *jh) | 424 | int jbd2_journal_cancel_revoke(handle_t *handle, struct journal_head *jh) |
408 | { | 425 | { |
@@ -480,10 +497,7 @@ void jbd2_journal_switch_revoke_table(journal_t *journal) | |||
480 | /* | 497 | /* |
481 | * Write revoke records to the journal for all entries in the current | 498 | * Write revoke records to the journal for all entries in the current |
482 | * revoke hash, deleting the entries as we go. | 499 | * revoke hash, deleting the entries as we go. |
483 | * | ||
484 | * Called with the journal lock held. | ||
485 | */ | 500 | */ |
486 | |||
487 | void jbd2_journal_write_revoke_records(journal_t *journal, | 501 | void jbd2_journal_write_revoke_records(journal_t *journal, |
488 | transaction_t *transaction) | 502 | transaction_t *transaction) |
489 | { | 503 | { |
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 28ce21d8598e..996ffda06bf3 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -1315,6 +1315,8 @@ int jbd2_journal_stop(handle_t *handle) | |||
1315 | } | 1315 | } |
1316 | } | 1316 | } |
1317 | 1317 | ||
1318 | if (handle->h_sync) | ||
1319 | transaction->t_synchronous_commit = 1; | ||
1318 | current->journal_info = NULL; | 1320 | current->journal_info = NULL; |
1319 | spin_lock(&journal->j_state_lock); | 1321 | spin_lock(&journal->j_state_lock); |
1320 | spin_lock(&transaction->t_handle_lock); | 1322 | spin_lock(&transaction->t_handle_lock); |