diff options
| author | Theodore Ts'o <tytso@mit.edu> | 2009-04-14 10:10:47 -0400 |
|---|---|---|
| committer | Theodore Ts'o <tytso@mit.edu> | 2009-04-14 10:10:47 -0400 |
| commit | 38d726d153cfe5efe5fe22d28d36ab382dda3a5c (patch) | |
| tree | f5403a0abb0ac7e8bbdd12403a70d4151559e778 | |
| parent | 67c457a8c378a006a34d92f9bd3078a80a92f250 (diff) | |
jbd: use SWRITE_SYNC_PLUG when writing synchronous revoke records
The revoke records must be written using the same way as the rest of
the blocks during the commit process; that is, either marked as
synchronous writes or as asynchornous writes.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
| -rw-r--r-- | fs/jbd/commit.c | 2 | ||||
| -rw-r--r-- | fs/jbd/revoke.c | 20 | ||||
| -rw-r--r-- | include/linux/jbd.h | 3 |
3 files changed, 14 insertions, 11 deletions
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index a8e8513a78a9..06560c520f49 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c | |||
| @@ -502,7 +502,7 @@ void journal_commit_transaction(journal_t *journal) | |||
| 502 | err = 0; | 502 | err = 0; |
| 503 | } | 503 | } |
| 504 | 504 | ||
| 505 | journal_write_revoke_records(journal, commit_transaction); | 505 | journal_write_revoke_records(journal, commit_transaction, write_op); |
| 506 | 506 | ||
| 507 | /* | 507 | /* |
| 508 | * If we found any dirty or locked buffers, then we should have | 508 | * If we found any dirty or locked buffers, then we should have |
diff --git a/fs/jbd/revoke.c b/fs/jbd/revoke.c index c7bd649bbbdc..1b1a06e1c836 100644 --- a/fs/jbd/revoke.c +++ b/fs/jbd/revoke.c | |||
| @@ -67,6 +67,7 @@ | |||
| 67 | #include <linux/slab.h> | 67 | #include <linux/slab.h> |
| 68 | #include <linux/list.h> | 68 | #include <linux/list.h> |
| 69 | #include <linux/init.h> | 69 | #include <linux/init.h> |
| 70 | #include <linux/bio.h> | ||
| 70 | #endif | 71 | #endif |
| 71 | #include <linux/log2.h> | 72 | #include <linux/log2.h> |
| 72 | 73 | ||
| @@ -99,8 +100,8 @@ struct jbd_revoke_table_s | |||
| 99 | #ifdef __KERNEL__ | 100 | #ifdef __KERNEL__ |
| 100 | static void write_one_revoke_record(journal_t *, transaction_t *, | 101 | static void write_one_revoke_record(journal_t *, transaction_t *, |
| 101 | struct journal_head **, int *, | 102 | struct journal_head **, int *, |
| 102 | struct jbd_revoke_record_s *); | 103 | struct jbd_revoke_record_s *, int); |
| 103 | static void flush_descriptor(journal_t *, struct journal_head *, int); | 104 | static void flush_descriptor(journal_t *, struct journal_head *, int, int); |
| 104 | #endif | 105 | #endif |
| 105 | 106 | ||
| 106 | /* Utility functions to maintain the revoke table */ | 107 | /* Utility functions to maintain the revoke table */ |
| @@ -486,7 +487,7 @@ void journal_switch_revoke_table(journal_t *journal) | |||
| 486 | */ | 487 | */ |
| 487 | 488 | ||
| 488 | void journal_write_revoke_records(journal_t *journal, | 489 | void journal_write_revoke_records(journal_t *journal, |
| 489 | transaction_t *transaction) | 490 | transaction_t *transaction, int write_op) |
| 490 | { | 491 | { |
| 491 | struct journal_head *descriptor; | 492 | struct journal_head *descriptor; |
| 492 | struct jbd_revoke_record_s *record; | 493 | struct jbd_revoke_record_s *record; |
| @@ -510,14 +511,14 @@ void journal_write_revoke_records(journal_t *journal, | |||
| 510 | hash_list->next; | 511 | hash_list->next; |
| 511 | write_one_revoke_record(journal, transaction, | 512 | write_one_revoke_record(journal, transaction, |
| 512 | &descriptor, &offset, | 513 | &descriptor, &offset, |
| 513 | record); | 514 | record, write_op); |
| 514 | count++; | 515 | count++; |
| 515 | list_del(&record->hash); | 516 | list_del(&record->hash); |
| 516 | kmem_cache_free(revoke_record_cache, record); | 517 | kmem_cache_free(revoke_record_cache, record); |
| 517 | } | 518 | } |
| 518 | } | 519 | } |
| 519 | if (descriptor) | 520 | if (descriptor) |
| 520 | flush_descriptor(journal, descriptor, offset); | 521 | flush_descriptor(journal, descriptor, offset, write_op); |
| 521 | jbd_debug(1, "Wrote %d revoke records\n", count); | 522 | jbd_debug(1, "Wrote %d revoke records\n", count); |
| 522 | } | 523 | } |
| 523 | 524 | ||
| @@ -530,7 +531,8 @@ static void write_one_revoke_record(journal_t *journal, | |||
| 530 | transaction_t *transaction, | 531 | transaction_t *transaction, |
| 531 | struct journal_head **descriptorp, | 532 | struct journal_head **descriptorp, |
| 532 | int *offsetp, | 533 | int *offsetp, |
| 533 | struct jbd_revoke_record_s *record) | 534 | struct jbd_revoke_record_s *record, |
| 535 | int write_op) | ||
| 534 | { | 536 | { |
| 535 | struct journal_head *descriptor; | 537 | struct journal_head *descriptor; |
| 536 | int offset; | 538 | int offset; |
| @@ -549,7 +551,7 @@ static void write_one_revoke_record(journal_t *journal, | |||
| 549 | /* Make sure we have a descriptor with space left for the record */ | 551 | /* Make sure we have a descriptor with space left for the record */ |
| 550 | if (descriptor) { | 552 | if (descriptor) { |
| 551 | if (offset == journal->j_blocksize) { | 553 | if (offset == journal->j_blocksize) { |
| 552 | flush_descriptor(journal, descriptor, offset); | 554 | flush_descriptor(journal, descriptor, offset, write_op); |
| 553 | descriptor = NULL; | 555 | descriptor = NULL; |
| 554 | } | 556 | } |
| 555 | } | 557 | } |
| @@ -586,7 +588,7 @@ static void write_one_revoke_record(journal_t *journal, | |||
| 586 | 588 | ||
| 587 | static void flush_descriptor(journal_t *journal, | 589 | static void flush_descriptor(journal_t *journal, |
| 588 | struct journal_head *descriptor, | 590 | struct journal_head *descriptor, |
| 589 | int offset) | 591 | int offset, int write_op) |
| 590 | { | 592 | { |
| 591 | journal_revoke_header_t *header; | 593 | journal_revoke_header_t *header; |
| 592 | struct buffer_head *bh = jh2bh(descriptor); | 594 | struct buffer_head *bh = jh2bh(descriptor); |
| @@ -601,7 +603,7 @@ static void flush_descriptor(journal_t *journal, | |||
| 601 | set_buffer_jwrite(bh); | 603 | set_buffer_jwrite(bh); |
| 602 | BUFFER_TRACE(bh, "write"); | 604 | BUFFER_TRACE(bh, "write"); |
| 603 | set_buffer_dirty(bh); | 605 | set_buffer_dirty(bh); |
| 604 | ll_rw_block(SWRITE, 1, &bh); | 606 | ll_rw_block((write_op == WRITE) ? SWRITE : SWRITE_SYNC_PLUG, 1, &bh); |
| 605 | } | 607 | } |
| 606 | #endif | 608 | #endif |
| 607 | 609 | ||
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 53ae4399da2d..c2049a04fa0b 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
| @@ -978,7 +978,8 @@ extern void journal_destroy_revoke(journal_t *); | |||
| 978 | extern int journal_revoke (handle_t *, | 978 | extern int journal_revoke (handle_t *, |
| 979 | unsigned long, struct buffer_head *); | 979 | unsigned long, struct buffer_head *); |
| 980 | extern int journal_cancel_revoke(handle_t *, struct journal_head *); | 980 | extern int journal_cancel_revoke(handle_t *, struct journal_head *); |
| 981 | extern void journal_write_revoke_records(journal_t *, transaction_t *); | 981 | extern void journal_write_revoke_records(journal_t *, |
| 982 | transaction_t *, int); | ||
| 982 | 983 | ||
| 983 | /* Recovery revoke support */ | 984 | /* Recovery revoke support */ |
| 984 | extern int journal_set_revoke(journal_t *, unsigned long, tid_t); | 985 | extern int journal_set_revoke(journal_t *, unsigned long, tid_t); |
