diff options
author | Jan Kara <jack@suse.cz> | 2013-06-04 12:06:01 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-06-04 12:06:01 -0400 |
commit | e5a120aeb57f40ae568a5ca1dd6ace53d0213582 (patch) | |
tree | 4381bec9a9ef322a7feb8c29ff0912b8edbf0407 /fs/jbd2/revoke.c | |
parent | f5113effc2a2ee6b86a4b345ce557353dcbcfffe (diff) |
jbd2: remove journal_head from descriptor buffers
Similarly as for metadata buffers, also log descriptor buffers don't
really need the journal head. So strip it and remove BJ_LogCtl list.
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/jbd2/revoke.c')
-rw-r--r-- | fs/jbd2/revoke.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index f30b80b4ce8b..198c9c10276d 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c | |||
@@ -122,9 +122,10 @@ struct jbd2_revoke_table_s | |||
122 | 122 | ||
123 | #ifdef __KERNEL__ | 123 | #ifdef __KERNEL__ |
124 | static void write_one_revoke_record(journal_t *, transaction_t *, | 124 | static void write_one_revoke_record(journal_t *, transaction_t *, |
125 | struct journal_head **, int *, | 125 | struct list_head *, |
126 | struct buffer_head **, int *, | ||
126 | struct jbd2_revoke_record_s *, int); | 127 | struct jbd2_revoke_record_s *, int); |
127 | static void flush_descriptor(journal_t *, struct journal_head *, int, int); | 128 | static void flush_descriptor(journal_t *, struct buffer_head *, int, int); |
128 | #endif | 129 | #endif |
129 | 130 | ||
130 | /* Utility functions to maintain the revoke table */ | 131 | /* Utility functions to maintain the revoke table */ |
@@ -531,9 +532,10 @@ void jbd2_journal_switch_revoke_table(journal_t *journal) | |||
531 | */ | 532 | */ |
532 | void jbd2_journal_write_revoke_records(journal_t *journal, | 533 | void jbd2_journal_write_revoke_records(journal_t *journal, |
533 | transaction_t *transaction, | 534 | transaction_t *transaction, |
535 | struct list_head *log_bufs, | ||
534 | int write_op) | 536 | int write_op) |
535 | { | 537 | { |
536 | struct journal_head *descriptor; | 538 | struct buffer_head *descriptor; |
537 | struct jbd2_revoke_record_s *record; | 539 | struct jbd2_revoke_record_s *record; |
538 | struct jbd2_revoke_table_s *revoke; | 540 | struct jbd2_revoke_table_s *revoke; |
539 | struct list_head *hash_list; | 541 | struct list_head *hash_list; |
@@ -553,7 +555,7 @@ void jbd2_journal_write_revoke_records(journal_t *journal, | |||
553 | while (!list_empty(hash_list)) { | 555 | while (!list_empty(hash_list)) { |
554 | record = (struct jbd2_revoke_record_s *) | 556 | record = (struct jbd2_revoke_record_s *) |
555 | hash_list->next; | 557 | hash_list->next; |
556 | write_one_revoke_record(journal, transaction, | 558 | write_one_revoke_record(journal, transaction, log_bufs, |
557 | &descriptor, &offset, | 559 | &descriptor, &offset, |
558 | record, write_op); | 560 | record, write_op); |
559 | count++; | 561 | count++; |
@@ -573,13 +575,14 @@ void jbd2_journal_write_revoke_records(journal_t *journal, | |||
573 | 575 | ||
574 | static void write_one_revoke_record(journal_t *journal, | 576 | static void write_one_revoke_record(journal_t *journal, |
575 | transaction_t *transaction, | 577 | transaction_t *transaction, |
576 | struct journal_head **descriptorp, | 578 | struct list_head *log_bufs, |
579 | struct buffer_head **descriptorp, | ||
577 | int *offsetp, | 580 | int *offsetp, |
578 | struct jbd2_revoke_record_s *record, | 581 | struct jbd2_revoke_record_s *record, |
579 | int write_op) | 582 | int write_op) |
580 | { | 583 | { |
581 | int csum_size = 0; | 584 | int csum_size = 0; |
582 | struct journal_head *descriptor; | 585 | struct buffer_head *descriptor; |
583 | int offset; | 586 | int offset; |
584 | journal_header_t *header; | 587 | journal_header_t *header; |
585 | 588 | ||
@@ -609,26 +612,26 @@ static void write_one_revoke_record(journal_t *journal, | |||
609 | descriptor = jbd2_journal_get_descriptor_buffer(journal); | 612 | descriptor = jbd2_journal_get_descriptor_buffer(journal); |
610 | if (!descriptor) | 613 | if (!descriptor) |
611 | return; | 614 | return; |
612 | header = (journal_header_t *) &jh2bh(descriptor)->b_data[0]; | 615 | header = (journal_header_t *)descriptor->b_data; |
613 | header->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER); | 616 | header->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER); |
614 | header->h_blocktype = cpu_to_be32(JBD2_REVOKE_BLOCK); | 617 | header->h_blocktype = cpu_to_be32(JBD2_REVOKE_BLOCK); |
615 | header->h_sequence = cpu_to_be32(transaction->t_tid); | 618 | header->h_sequence = cpu_to_be32(transaction->t_tid); |
616 | 619 | ||
617 | /* Record it so that we can wait for IO completion later */ | 620 | /* Record it so that we can wait for IO completion later */ |
618 | JBUFFER_TRACE(descriptor, "file as BJ_LogCtl"); | 621 | BUFFER_TRACE(descriptor, "file in log_bufs"); |
619 | jbd2_journal_file_buffer(descriptor, transaction, BJ_LogCtl); | 622 | jbd2_file_log_bh(log_bufs, descriptor); |
620 | 623 | ||
621 | offset = sizeof(jbd2_journal_revoke_header_t); | 624 | offset = sizeof(jbd2_journal_revoke_header_t); |
622 | *descriptorp = descriptor; | 625 | *descriptorp = descriptor; |
623 | } | 626 | } |
624 | 627 | ||
625 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) { | 628 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) { |
626 | * ((__be64 *)(&jh2bh(descriptor)->b_data[offset])) = | 629 | * ((__be64 *)(&descriptor->b_data[offset])) = |
627 | cpu_to_be64(record->blocknr); | 630 | cpu_to_be64(record->blocknr); |
628 | offset += 8; | 631 | offset += 8; |
629 | 632 | ||
630 | } else { | 633 | } else { |
631 | * ((__be32 *)(&jh2bh(descriptor)->b_data[offset])) = | 634 | * ((__be32 *)(&descriptor->b_data[offset])) = |
632 | cpu_to_be32(record->blocknr); | 635 | cpu_to_be32(record->blocknr); |
633 | offset += 4; | 636 | offset += 4; |
634 | } | 637 | } |
@@ -636,8 +639,7 @@ static void write_one_revoke_record(journal_t *journal, | |||
636 | *offsetp = offset; | 639 | *offsetp = offset; |
637 | } | 640 | } |
638 | 641 | ||
639 | static void jbd2_revoke_csum_set(journal_t *j, | 642 | static void jbd2_revoke_csum_set(journal_t *j, struct buffer_head *bh) |
640 | struct journal_head *descriptor) | ||
641 | { | 643 | { |
642 | struct jbd2_journal_revoke_tail *tail; | 644 | struct jbd2_journal_revoke_tail *tail; |
643 | __u32 csum; | 645 | __u32 csum; |
@@ -645,12 +647,10 @@ static void jbd2_revoke_csum_set(journal_t *j, | |||
645 | if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 647 | if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) |
646 | return; | 648 | return; |
647 | 649 | ||
648 | tail = (struct jbd2_journal_revoke_tail *) | 650 | tail = (struct jbd2_journal_revoke_tail *)(bh->b_data + j->j_blocksize - |
649 | (jh2bh(descriptor)->b_data + j->j_blocksize - | ||
650 | sizeof(struct jbd2_journal_revoke_tail)); | 651 | sizeof(struct jbd2_journal_revoke_tail)); |
651 | tail->r_checksum = 0; | 652 | tail->r_checksum = 0; |
652 | csum = jbd2_chksum(j, j->j_csum_seed, jh2bh(descriptor)->b_data, | 653 | csum = jbd2_chksum(j, j->j_csum_seed, bh->b_data, j->j_blocksize); |
653 | j->j_blocksize); | ||
654 | tail->r_checksum = cpu_to_be32(csum); | 654 | tail->r_checksum = cpu_to_be32(csum); |
655 | } | 655 | } |
656 | 656 | ||
@@ -662,25 +662,24 @@ static void jbd2_revoke_csum_set(journal_t *j, | |||
662 | */ | 662 | */ |
663 | 663 | ||
664 | static void flush_descriptor(journal_t *journal, | 664 | static void flush_descriptor(journal_t *journal, |
665 | struct journal_head *descriptor, | 665 | struct buffer_head *descriptor, |
666 | int offset, int write_op) | 666 | int offset, int write_op) |
667 | { | 667 | { |
668 | jbd2_journal_revoke_header_t *header; | 668 | jbd2_journal_revoke_header_t *header; |
669 | struct buffer_head *bh = jh2bh(descriptor); | ||
670 | 669 | ||
671 | if (is_journal_aborted(journal)) { | 670 | if (is_journal_aborted(journal)) { |
672 | put_bh(bh); | 671 | put_bh(descriptor); |
673 | return; | 672 | return; |
674 | } | 673 | } |
675 | 674 | ||
676 | header = (jbd2_journal_revoke_header_t *) jh2bh(descriptor)->b_data; | 675 | header = (jbd2_journal_revoke_header_t *)descriptor->b_data; |
677 | header->r_count = cpu_to_be32(offset); | 676 | header->r_count = cpu_to_be32(offset); |
678 | jbd2_revoke_csum_set(journal, descriptor); | 677 | jbd2_revoke_csum_set(journal, descriptor); |
679 | 678 | ||
680 | set_buffer_jwrite(bh); | 679 | set_buffer_jwrite(descriptor); |
681 | BUFFER_TRACE(bh, "write"); | 680 | BUFFER_TRACE(descriptor, "write"); |
682 | set_buffer_dirty(bh); | 681 | set_buffer_dirty(descriptor); |
683 | write_dirty_buffer(bh, write_op); | 682 | write_dirty_buffer(descriptor, write_op); |
684 | } | 683 | } |
685 | #endif | 684 | #endif |
686 | 685 | ||