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