aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd/commit.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jbd/commit.c')
-rw-r--r--fs/jbd/commit.c41
1 files changed, 9 insertions, 32 deletions
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c
index 28a9ddaa0c49..34a4861c14b8 100644
--- a/fs/jbd/commit.c
+++ b/fs/jbd/commit.c
@@ -119,7 +119,6 @@ static int journal_write_commit_record(journal_t *journal,
119 struct buffer_head *bh; 119 struct buffer_head *bh;
120 journal_header_t *header; 120 journal_header_t *header;
121 int ret; 121 int ret;
122 int barrier_done = 0;
123 122
124 if (is_journal_aborted(journal)) 123 if (is_journal_aborted(journal))
125 return 0; 124 return 0;
@@ -137,34 +136,12 @@ static int journal_write_commit_record(journal_t *journal,
137 136
138 JBUFFER_TRACE(descriptor, "write commit block"); 137 JBUFFER_TRACE(descriptor, "write commit block");
139 set_buffer_dirty(bh); 138 set_buffer_dirty(bh);
140 if (journal->j_flags & JFS_BARRIER) {
141 set_buffer_ordered(bh);
142 barrier_done = 1;
143 }
144 ret = sync_dirty_buffer(bh);
145 if (barrier_done)
146 clear_buffer_ordered(bh);
147 /* is it possible for another commit to fail at roughly
148 * the same time as this one? If so, we don't want to
149 * trust the barrier flag in the super, but instead want
150 * to remember if we sent a barrier request
151 */
152 if (ret == -EOPNOTSUPP && barrier_done) {
153 char b[BDEVNAME_SIZE];
154
155 printk(KERN_WARNING
156 "JBD: barrier-based sync failed on %s - "
157 "disabling barriers\n",
158 bdevname(journal->j_dev, b));
159 spin_lock(&journal->j_state_lock);
160 journal->j_flags &= ~JFS_BARRIER;
161 spin_unlock(&journal->j_state_lock);
162 139
163 /* And try again, without the barrier */ 140 if (journal->j_flags & JFS_BARRIER)
164 set_buffer_uptodate(bh); 141 ret = __sync_dirty_buffer(bh, WRITE_SYNC | WRITE_FLUSH_FUA);
165 set_buffer_dirty(bh); 142 else
166 ret = sync_dirty_buffer(bh); 143 ret = sync_dirty_buffer(bh);
167 } 144
168 put_bh(bh); /* One for getblk() */ 145 put_bh(bh); /* One for getblk() */
169 journal_put_journal_head(descriptor); 146 journal_put_journal_head(descriptor);
170 147
@@ -317,7 +294,7 @@ void journal_commit_transaction(journal_t *journal)
317 int first_tag = 0; 294 int first_tag = 0;
318 int tag_flag; 295 int tag_flag;
319 int i; 296 int i;
320 int write_op = WRITE; 297 int write_op = WRITE_SYNC;
321 298
322 /* 299 /*
323 * First job: lock down the current transaction and wait for 300 * First job: lock down the current transaction and wait for
@@ -610,13 +587,13 @@ void journal_commit_transaction(journal_t *journal)
610 /* Bump b_count to prevent truncate from stumbling over 587 /* Bump b_count to prevent truncate from stumbling over
611 the shadowed buffer! @@@ This can go if we ever get 588 the shadowed buffer! @@@ This can go if we ever get
612 rid of the BJ_IO/BJ_Shadow pairing of buffers. */ 589 rid of the BJ_IO/BJ_Shadow pairing of buffers. */
613 atomic_inc(&jh2bh(jh)->b_count); 590 get_bh(jh2bh(jh));
614 591
615 /* Make a temporary IO buffer with which to write it out 592 /* Make a temporary IO buffer with which to write it out
616 (this will requeue both the metadata buffer and the 593 (this will requeue both the metadata buffer and the
617 temporary IO buffer). new_bh goes on BJ_IO*/ 594 temporary IO buffer). new_bh goes on BJ_IO*/
618 595
619 set_bit(BH_JWrite, &jh2bh(jh)->b_state); 596 set_buffer_jwrite(jh2bh(jh));
620 /* 597 /*
621 * akpm: journal_write_metadata_buffer() sets 598 * akpm: journal_write_metadata_buffer() sets
622 * new_bh->b_transaction to commit_transaction. 599 * new_bh->b_transaction to commit_transaction.
@@ -626,7 +603,7 @@ void journal_commit_transaction(journal_t *journal)
626 JBUFFER_TRACE(jh, "ph3: write metadata"); 603 JBUFFER_TRACE(jh, "ph3: write metadata");
627 flags = journal_write_metadata_buffer(commit_transaction, 604 flags = journal_write_metadata_buffer(commit_transaction,
628 jh, &new_jh, blocknr); 605 jh, &new_jh, blocknr);
629 set_bit(BH_JWrite, &jh2bh(new_jh)->b_state); 606 set_buffer_jwrite(jh2bh(new_jh));
630 wbuf[bufs++] = jh2bh(new_jh); 607 wbuf[bufs++] = jh2bh(new_jh);
631 608
632 /* Record the new block's tag in the current descriptor 609 /* Record the new block's tag in the current descriptor
@@ -736,7 +713,7 @@ wait_for_iobuf:
736 shadowed buffer */ 713 shadowed buffer */
737 jh = commit_transaction->t_shadow_list->b_tprev; 714 jh = commit_transaction->t_shadow_list->b_tprev;
738 bh = jh2bh(jh); 715 bh = jh2bh(jh);
739 clear_bit(BH_JWrite, &bh->b_state); 716 clear_buffer_jwrite(bh);
740 J_ASSERT_BH(bh, buffer_jbddirty(bh)); 717 J_ASSERT_BH(bh, buffer_jbddirty(bh));
741 718
742 /* The metadata is now released for reuse, but we need 719 /* The metadata is now released for reuse, but we need