aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd2
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2013-06-04 12:06:01 -0400
committerTheodore Ts'o <tytso@mit.edu>2013-06-04 12:06:01 -0400
commite5a120aeb57f40ae568a5ca1dd6ace53d0213582 (patch)
tree4381bec9a9ef322a7feb8c29ff0912b8edbf0407 /fs/jbd2
parentf5113effc2a2ee6b86a4b345ce557353dcbcfffe (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')
-rw-r--r--fs/jbd2/checkpoint.c1
-rw-r--r--fs/jbd2/commit.c78
-rw-r--r--fs/jbd2/journal.c4
-rw-r--r--fs/jbd2/revoke.c49
-rw-r--r--fs/jbd2/transaction.c6
5 files changed, 57 insertions, 81 deletions
diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c
index 2735fef6e55e..65ec076e41f2 100644
--- a/fs/jbd2/checkpoint.c
+++ b/fs/jbd2/checkpoint.c
@@ -691,7 +691,6 @@ void __jbd2_journal_drop_transaction(journal_t *journal, transaction_t *transact
691 J_ASSERT(transaction->t_buffers == NULL); 691 J_ASSERT(transaction->t_buffers == NULL);
692 J_ASSERT(transaction->t_forget == NULL); 692 J_ASSERT(transaction->t_forget == NULL);
693 J_ASSERT(transaction->t_shadow_list == NULL); 693 J_ASSERT(transaction->t_shadow_list == NULL);
694 J_ASSERT(transaction->t_log_list == NULL);
695 J_ASSERT(transaction->t_checkpoint_list == NULL); 694 J_ASSERT(transaction->t_checkpoint_list == NULL);
696 J_ASSERT(transaction->t_checkpoint_io_list == NULL); 695 J_ASSERT(transaction->t_checkpoint_io_list == NULL);
697 J_ASSERT(atomic_read(&transaction->t_updates) == 0); 696 J_ASSERT(atomic_read(&transaction->t_updates) == 0);
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 57bd2ff97888..7c6f7eea2316 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -85,8 +85,7 @@ nope:
85 __brelse(bh); 85 __brelse(bh);
86} 86}
87 87
88static void jbd2_commit_block_csum_set(journal_t *j, 88static void jbd2_commit_block_csum_set(journal_t *j, struct buffer_head *bh)
89 struct journal_head *descriptor)
90{ 89{
91 struct commit_header *h; 90 struct commit_header *h;
92 __u32 csum; 91 __u32 csum;
@@ -94,12 +93,11 @@ static void jbd2_commit_block_csum_set(journal_t *j,
94 if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) 93 if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
95 return; 94 return;
96 95
97 h = (struct commit_header *)(jh2bh(descriptor)->b_data); 96 h = (struct commit_header *)(bh->b_data);
98 h->h_chksum_type = 0; 97 h->h_chksum_type = 0;
99 h->h_chksum_size = 0; 98 h->h_chksum_size = 0;
100 h->h_chksum[0] = 0; 99 h->h_chksum[0] = 0;
101 csum = jbd2_chksum(j, j->j_csum_seed, jh2bh(descriptor)->b_data, 100 csum = jbd2_chksum(j, j->j_csum_seed, bh->b_data, j->j_blocksize);
102 j->j_blocksize);
103 h->h_chksum[0] = cpu_to_be32(csum); 101 h->h_chksum[0] = cpu_to_be32(csum);
104} 102}
105 103
@@ -116,7 +114,6 @@ static int journal_submit_commit_record(journal_t *journal,
116 struct buffer_head **cbh, 114 struct buffer_head **cbh,
117 __u32 crc32_sum) 115 __u32 crc32_sum)
118{ 116{
119 struct journal_head *descriptor;
120 struct commit_header *tmp; 117 struct commit_header *tmp;
121 struct buffer_head *bh; 118 struct buffer_head *bh;
122 int ret; 119 int ret;
@@ -127,12 +124,10 @@ static int journal_submit_commit_record(journal_t *journal,
127 if (is_journal_aborted(journal)) 124 if (is_journal_aborted(journal))
128 return 0; 125 return 0;
129 126
130 descriptor = jbd2_journal_get_descriptor_buffer(journal); 127 bh = jbd2_journal_get_descriptor_buffer(journal);
131 if (!descriptor) 128 if (!bh)
132 return 1; 129 return 1;
133 130
134 bh = jh2bh(descriptor);
135
136 tmp = (struct commit_header *)bh->b_data; 131 tmp = (struct commit_header *)bh->b_data;
137 tmp->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER); 132 tmp->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER);
138 tmp->h_blocktype = cpu_to_be32(JBD2_COMMIT_BLOCK); 133 tmp->h_blocktype = cpu_to_be32(JBD2_COMMIT_BLOCK);
@@ -146,9 +141,9 @@ static int journal_submit_commit_record(journal_t *journal,
146 tmp->h_chksum_size = JBD2_CRC32_CHKSUM_SIZE; 141 tmp->h_chksum_size = JBD2_CRC32_CHKSUM_SIZE;
147 tmp->h_chksum[0] = cpu_to_be32(crc32_sum); 142 tmp->h_chksum[0] = cpu_to_be32(crc32_sum);
148 } 143 }
149 jbd2_commit_block_csum_set(journal, descriptor); 144 jbd2_commit_block_csum_set(journal, bh);
150 145
151 JBUFFER_TRACE(descriptor, "submit commit block"); 146 BUFFER_TRACE(bh, "submit commit block");
152 lock_buffer(bh); 147 lock_buffer(bh);
153 clear_buffer_dirty(bh); 148 clear_buffer_dirty(bh);
154 set_buffer_uptodate(bh); 149 set_buffer_uptodate(bh);
@@ -180,7 +175,6 @@ static int journal_wait_on_commit_record(journal_t *journal,
180 if (unlikely(!buffer_uptodate(bh))) 175 if (unlikely(!buffer_uptodate(bh)))
181 ret = -EIO; 176 ret = -EIO;
182 put_bh(bh); /* One for getblk() */ 177 put_bh(bh); /* One for getblk() */
183 jbd2_journal_put_journal_head(bh2jh(bh));
184 178
185 return ret; 179 return ret;
186} 180}
@@ -321,7 +315,7 @@ static void write_tag_block(int tag_bytes, journal_block_tag_t *tag,
321} 315}
322 316
323static void jbd2_descr_block_csum_set(journal_t *j, 317static void jbd2_descr_block_csum_set(journal_t *j,
324 struct journal_head *descriptor) 318 struct buffer_head *bh)
325{ 319{
326 struct jbd2_journal_block_tail *tail; 320 struct jbd2_journal_block_tail *tail;
327 __u32 csum; 321 __u32 csum;
@@ -329,12 +323,10 @@ static void jbd2_descr_block_csum_set(journal_t *j,
329 if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) 323 if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
330 return; 324 return;
331 325
332 tail = (struct jbd2_journal_block_tail *) 326 tail = (struct jbd2_journal_block_tail *)(bh->b_data + j->j_blocksize -
333 (jh2bh(descriptor)->b_data + j->j_blocksize -
334 sizeof(struct jbd2_journal_block_tail)); 327 sizeof(struct jbd2_journal_block_tail));
335 tail->t_checksum = 0; 328 tail->t_checksum = 0;
336 csum = jbd2_chksum(j, j->j_csum_seed, jh2bh(descriptor)->b_data, 329 csum = jbd2_chksum(j, j->j_csum_seed, bh->b_data, j->j_blocksize);
337 j->j_blocksize);
338 tail->t_checksum = cpu_to_be32(csum); 330 tail->t_checksum = cpu_to_be32(csum);
339} 331}
340 332
@@ -369,7 +361,8 @@ void jbd2_journal_commit_transaction(journal_t *journal)
369{ 361{
370 struct transaction_stats_s stats; 362 struct transaction_stats_s stats;
371 transaction_t *commit_transaction; 363 transaction_t *commit_transaction;
372 struct journal_head *jh, *descriptor; 364 struct journal_head *jh;
365 struct buffer_head *descriptor;
373 struct buffer_head **wbuf = journal->j_wbuf; 366 struct buffer_head **wbuf = journal->j_wbuf;
374 int bufs; 367 int bufs;
375 int flags; 368 int flags;
@@ -394,6 +387,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
394 int update_tail; 387 int update_tail;
395 int csum_size = 0; 388 int csum_size = 0;
396 LIST_HEAD(io_bufs); 389 LIST_HEAD(io_bufs);
390 LIST_HEAD(log_bufs);
397 391
398 if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) 392 if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2))
399 csum_size = sizeof(struct jbd2_journal_block_tail); 393 csum_size = sizeof(struct jbd2_journal_block_tail);
@@ -547,7 +541,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
547 541
548 blk_start_plug(&plug); 542 blk_start_plug(&plug);
549 jbd2_journal_write_revoke_records(journal, commit_transaction, 543 jbd2_journal_write_revoke_records(journal, commit_transaction,
550 WRITE_SYNC); 544 &log_bufs, WRITE_SYNC);
551 blk_finish_plug(&plug); 545 blk_finish_plug(&plug);
552 546
553 jbd_debug(3, "JBD2: commit phase 2\n"); 547 jbd_debug(3, "JBD2: commit phase 2\n");
@@ -573,8 +567,8 @@ void jbd2_journal_commit_transaction(journal_t *journal)
573 atomic_read(&commit_transaction->t_outstanding_credits)); 567 atomic_read(&commit_transaction->t_outstanding_credits));
574 568
575 err = 0; 569 err = 0;
576 descriptor = NULL;
577 bufs = 0; 570 bufs = 0;
571 descriptor = NULL;
578 blk_start_plug(&plug); 572 blk_start_plug(&plug);
579 while (commit_transaction->t_buffers) { 573 while (commit_transaction->t_buffers) {
580 574
@@ -606,8 +600,6 @@ void jbd2_journal_commit_transaction(journal_t *journal)
606 record the metadata buffer. */ 600 record the metadata buffer. */
607 601
608 if (!descriptor) { 602 if (!descriptor) {
609 struct buffer_head *bh;
610
611 J_ASSERT (bufs == 0); 603 J_ASSERT (bufs == 0);
612 604
613 jbd_debug(4, "JBD2: get descriptor\n"); 605 jbd_debug(4, "JBD2: get descriptor\n");
@@ -618,26 +610,26 @@ void jbd2_journal_commit_transaction(journal_t *journal)
618 continue; 610 continue;
619 } 611 }
620 612
621 bh = jh2bh(descriptor);
622 jbd_debug(4, "JBD2: got buffer %llu (%p)\n", 613 jbd_debug(4, "JBD2: got buffer %llu (%p)\n",
623 (unsigned long long)bh->b_blocknr, bh->b_data); 614 (unsigned long long)descriptor->b_blocknr,
624 header = (journal_header_t *)&bh->b_data[0]; 615 descriptor->b_data);
616 header = (journal_header_t *)descriptor->b_data;
625 header->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER); 617 header->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER);
626 header->h_blocktype = cpu_to_be32(JBD2_DESCRIPTOR_BLOCK); 618 header->h_blocktype = cpu_to_be32(JBD2_DESCRIPTOR_BLOCK);
627 header->h_sequence = cpu_to_be32(commit_transaction->t_tid); 619 header->h_sequence = cpu_to_be32(commit_transaction->t_tid);
628 620
629 tagp = &bh->b_data[sizeof(journal_header_t)]; 621 tagp = &descriptor->b_data[sizeof(journal_header_t)];
630 space_left = bh->b_size - sizeof(journal_header_t); 622 space_left = descriptor->b_size -
623 sizeof(journal_header_t);
631 first_tag = 1; 624 first_tag = 1;
632 set_buffer_jwrite(bh); 625 set_buffer_jwrite(descriptor);
633 set_buffer_dirty(bh); 626 set_buffer_dirty(descriptor);
634 wbuf[bufs++] = bh; 627 wbuf[bufs++] = descriptor;
635 628
636 /* Record it so that we can wait for IO 629 /* Record it so that we can wait for IO
637 completion later */ 630 completion later */
638 BUFFER_TRACE(bh, "ph3: file as descriptor"); 631 BUFFER_TRACE(descriptor, "ph3: file as descriptor");
639 jbd2_journal_file_buffer(descriptor, commit_transaction, 632 jbd2_file_log_bh(&log_bufs, descriptor);
640 BJ_LogCtl);
641 } 633 }
642 634
643 /* Where is the buffer to be written? */ 635 /* Where is the buffer to be written? */
@@ -864,26 +856,19 @@ start_journal_io:
864 jbd_debug(3, "JBD2: commit phase 4\n"); 856 jbd_debug(3, "JBD2: commit phase 4\n");
865 857
866 /* Here we wait for the revoke record and descriptor record buffers */ 858 /* Here we wait for the revoke record and descriptor record buffers */
867 wait_for_ctlbuf: 859 while (!list_empty(&log_bufs)) {
868 while (commit_transaction->t_log_list != NULL) {
869 struct buffer_head *bh; 860 struct buffer_head *bh;
870 861
871 jh = commit_transaction->t_log_list->b_tprev; 862 bh = list_entry(log_bufs.prev, struct buffer_head, b_assoc_buffers);
872 bh = jh2bh(jh); 863 wait_on_buffer(bh);
873 if (buffer_locked(bh)) { 864 cond_resched();
874 wait_on_buffer(bh);
875 goto wait_for_ctlbuf;
876 }
877 if (cond_resched())
878 goto wait_for_ctlbuf;
879 865
880 if (unlikely(!buffer_uptodate(bh))) 866 if (unlikely(!buffer_uptodate(bh)))
881 err = -EIO; 867 err = -EIO;
882 868
883 BUFFER_TRACE(bh, "ph5: control buffer writeout done: unfile"); 869 BUFFER_TRACE(bh, "ph5: control buffer writeout done: unfile");
884 clear_buffer_jwrite(bh); 870 clear_buffer_jwrite(bh);
885 jbd2_journal_unfile_buffer(journal, jh); 871 jbd2_unfile_log_bh(bh);
886 jbd2_journal_put_journal_head(jh);
887 __brelse(bh); /* One for getblk */ 872 __brelse(bh); /* One for getblk */
888 /* AKPM: bforget here */ 873 /* AKPM: bforget here */
889 } 874 }
@@ -934,7 +919,6 @@ start_journal_io:
934 J_ASSERT(commit_transaction->t_buffers == NULL); 919 J_ASSERT(commit_transaction->t_buffers == NULL);
935 J_ASSERT(commit_transaction->t_checkpoint_list == NULL); 920 J_ASSERT(commit_transaction->t_checkpoint_list == NULL);
936 J_ASSERT(commit_transaction->t_shadow_list == NULL); 921 J_ASSERT(commit_transaction->t_shadow_list == NULL);
937 J_ASSERT(commit_transaction->t_log_list == NULL);
938 922
939restart_loop: 923restart_loop:
940 /* 924 /*
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 45cdc080e466..b0a8d1e4703e 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -790,7 +790,7 @@ int jbd2_journal_bmap(journal_t *journal, unsigned long blocknr,
790 * But we don't bother doing that, so there will be coherency problems with 790 * But we don't bother doing that, so there will be coherency problems with
791 * mmaps of blockdevs which hold live JBD-controlled filesystems. 791 * mmaps of blockdevs which hold live JBD-controlled filesystems.
792 */ 792 */
793struct journal_head *jbd2_journal_get_descriptor_buffer(journal_t *journal) 793struct buffer_head *jbd2_journal_get_descriptor_buffer(journal_t *journal)
794{ 794{
795 struct buffer_head *bh; 795 struct buffer_head *bh;
796 unsigned long long blocknr; 796 unsigned long long blocknr;
@@ -809,7 +809,7 @@ struct journal_head *jbd2_journal_get_descriptor_buffer(journal_t *journal)
809 set_buffer_uptodate(bh); 809 set_buffer_uptodate(bh);
810 unlock_buffer(bh); 810 unlock_buffer(bh);
811 BUFFER_TRACE(bh, "return this buffer"); 811 BUFFER_TRACE(bh, "return this buffer");
812 return jbd2_journal_add_journal_head(bh); 812 return bh;
813} 813}
814 814
815/* 815/*
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__
124static void write_one_revoke_record(journal_t *, transaction_t *, 124static 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);
127static void flush_descriptor(journal_t *, struct journal_head *, int, int); 128static 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 */
532void jbd2_journal_write_revoke_records(journal_t *journal, 533void 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
574static void write_one_revoke_record(journal_t *journal, 576static 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
639static void jbd2_revoke_csum_set(journal_t *j, 642static 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
664static void flush_descriptor(journal_t *journal, 664static 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
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 983010900258..f1c5392e62b6 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -1637,9 +1637,6 @@ static void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh)
1637 case BJ_Shadow: 1637 case BJ_Shadow:
1638 list = &transaction->t_shadow_list; 1638 list = &transaction->t_shadow_list;
1639 break; 1639 break;
1640 case BJ_LogCtl:
1641 list = &transaction->t_log_list;
1642 break;
1643 case BJ_Reserved: 1640 case BJ_Reserved:
1644 list = &transaction->t_reserved_list; 1641 list = &transaction->t_reserved_list;
1645 break; 1642 break;
@@ -2148,9 +2145,6 @@ void __jbd2_journal_file_buffer(struct journal_head *jh,
2148 case BJ_Shadow: 2145 case BJ_Shadow:
2149 list = &transaction->t_shadow_list; 2146 list = &transaction->t_shadow_list;
2150 break; 2147 break;
2151 case BJ_LogCtl:
2152 list = &transaction->t_log_list;
2153 break;
2154 case BJ_Reserved: 2148 case BJ_Reserved:
2155 list = &transaction->t_reserved_list; 2149 list = &transaction->t_reserved_list;
2156 break; 2150 break;