diff options
Diffstat (limited to 'fs/jbd2/commit.c')
-rw-r--r-- | fs/jbd2/commit.c | 76 |
1 files changed, 21 insertions, 55 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 6494c81e3b0..f3ad1598b20 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -136,25 +136,11 @@ static int journal_submit_commit_record(journal_t *journal, | |||
136 | 136 | ||
137 | if (journal->j_flags & JBD2_BARRIER && | 137 | if (journal->j_flags & JBD2_BARRIER && |
138 | !JBD2_HAS_INCOMPAT_FEATURE(journal, | 138 | !JBD2_HAS_INCOMPAT_FEATURE(journal, |
139 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) { | 139 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) |
140 | ret = submit_bh(WRITE_SYNC_PLUG | WRITE_BARRIER, bh); | 140 | ret = submit_bh(WRITE_SYNC_PLUG | WRITE_FLUSH_FUA, bh); |
141 | if (ret == -EOPNOTSUPP) { | 141 | else |
142 | printk(KERN_WARNING | ||
143 | "JBD2: Disabling barriers on %s, " | ||
144 | "not supported by device\n", journal->j_devname); | ||
145 | write_lock(&journal->j_state_lock); | ||
146 | journal->j_flags &= ~JBD2_BARRIER; | ||
147 | write_unlock(&journal->j_state_lock); | ||
148 | |||
149 | /* And try again, without the barrier */ | ||
150 | lock_buffer(bh); | ||
151 | set_buffer_uptodate(bh); | ||
152 | clear_buffer_dirty(bh); | ||
153 | ret = submit_bh(WRITE_SYNC_PLUG, bh); | ||
154 | } | ||
155 | } else { | ||
156 | ret = submit_bh(WRITE_SYNC_PLUG, bh); | 142 | ret = submit_bh(WRITE_SYNC_PLUG, bh); |
157 | } | 143 | |
158 | *cbh = bh; | 144 | *cbh = bh; |
159 | return ret; | 145 | return ret; |
160 | } | 146 | } |
@@ -168,29 +154,8 @@ static int journal_wait_on_commit_record(journal_t *journal, | |||
168 | { | 154 | { |
169 | int ret = 0; | 155 | int ret = 0; |
170 | 156 | ||
171 | retry: | ||
172 | clear_buffer_dirty(bh); | 157 | clear_buffer_dirty(bh); |
173 | wait_on_buffer(bh); | 158 | wait_on_buffer(bh); |
174 | if (buffer_eopnotsupp(bh) && (journal->j_flags & JBD2_BARRIER)) { | ||
175 | printk(KERN_WARNING | ||
176 | "JBD2: %s: disabling barries on %s - not supported " | ||
177 | "by device\n", __func__, journal->j_devname); | ||
178 | write_lock(&journal->j_state_lock); | ||
179 | journal->j_flags &= ~JBD2_BARRIER; | ||
180 | write_unlock(&journal->j_state_lock); | ||
181 | |||
182 | lock_buffer(bh); | ||
183 | clear_buffer_dirty(bh); | ||
184 | set_buffer_uptodate(bh); | ||
185 | bh->b_end_io = journal_end_buffer_io_sync; | ||
186 | |||
187 | ret = submit_bh(WRITE_SYNC_PLUG, bh); | ||
188 | if (ret) { | ||
189 | unlock_buffer(bh); | ||
190 | return ret; | ||
191 | } | ||
192 | goto retry; | ||
193 | } | ||
194 | 159 | ||
195 | if (unlikely(!buffer_uptodate(bh))) | 160 | if (unlikely(!buffer_uptodate(bh))) |
196 | ret = -EIO; | 161 | ret = -EIO; |
@@ -364,7 +329,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
364 | int tag_bytes = journal_tag_bytes(journal); | 329 | int tag_bytes = journal_tag_bytes(journal); |
365 | struct buffer_head *cbh = NULL; /* For transactional checksums */ | 330 | struct buffer_head *cbh = NULL; /* For transactional checksums */ |
366 | __u32 crc32_sum = ~0; | 331 | __u32 crc32_sum = ~0; |
367 | int write_op = WRITE; | 332 | int write_op = WRITE_SYNC; |
368 | 333 | ||
369 | /* | 334 | /* |
370 | * First job: lock down the current transaction and wait for | 335 | * First job: lock down the current transaction and wait for |
@@ -705,6 +670,16 @@ start_journal_io: | |||
705 | } | 670 | } |
706 | } | 671 | } |
707 | 672 | ||
673 | err = journal_finish_inode_data_buffers(journal, commit_transaction); | ||
674 | if (err) { | ||
675 | printk(KERN_WARNING | ||
676 | "JBD2: Detected IO errors while flushing file data " | ||
677 | "on %s\n", journal->j_devname); | ||
678 | if (journal->j_flags & JBD2_ABORT_ON_SYNCDATA_ERR) | ||
679 | jbd2_journal_abort(journal, err); | ||
680 | err = 0; | ||
681 | } | ||
682 | |||
708 | /* | 683 | /* |
709 | * If the journal is not located on the file system device, | 684 | * If the journal is not located on the file system device, |
710 | * then we must flush the file system device before we issue | 685 | * then we must flush the file system device before we issue |
@@ -713,8 +688,7 @@ start_journal_io: | |||
713 | if (commit_transaction->t_flushed_data_blocks && | 688 | if (commit_transaction->t_flushed_data_blocks && |
714 | (journal->j_fs_dev != journal->j_dev) && | 689 | (journal->j_fs_dev != journal->j_dev) && |
715 | (journal->j_flags & JBD2_BARRIER)) | 690 | (journal->j_flags & JBD2_BARRIER)) |
716 | blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL, | 691 | blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL); |
717 | BLKDEV_IFL_WAIT); | ||
718 | 692 | ||
719 | /* Done it all: now write the commit record asynchronously. */ | 693 | /* Done it all: now write the commit record asynchronously. */ |
720 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, | 694 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, |
@@ -723,19 +697,6 @@ start_journal_io: | |||
723 | &cbh, crc32_sum); | 697 | &cbh, crc32_sum); |
724 | if (err) | 698 | if (err) |
725 | __jbd2_journal_abort_hard(journal); | 699 | __jbd2_journal_abort_hard(journal); |
726 | if (journal->j_flags & JBD2_BARRIER) | ||
727 | blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL, | ||
728 | BLKDEV_IFL_WAIT); | ||
729 | } | ||
730 | |||
731 | err = journal_finish_inode_data_buffers(journal, commit_transaction); | ||
732 | if (err) { | ||
733 | printk(KERN_WARNING | ||
734 | "JBD2: Detected IO errors while flushing file data " | ||
735 | "on %s\n", journal->j_devname); | ||
736 | if (journal->j_flags & JBD2_ABORT_ON_SYNCDATA_ERR) | ||
737 | jbd2_journal_abort(journal, err); | ||
738 | err = 0; | ||
739 | } | 700 | } |
740 | 701 | ||
741 | /* Lo and behold: we have just managed to send a transaction to | 702 | /* Lo and behold: we have just managed to send a transaction to |
@@ -849,6 +810,11 @@ wait_for_iobuf: | |||
849 | } | 810 | } |
850 | if (!err && !is_journal_aborted(journal)) | 811 | if (!err && !is_journal_aborted(journal)) |
851 | err = journal_wait_on_commit_record(journal, cbh); | 812 | err = journal_wait_on_commit_record(journal, cbh); |
813 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, | ||
814 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) && | ||
815 | journal->j_flags & JBD2_BARRIER) { | ||
816 | blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL); | ||
817 | } | ||
852 | 818 | ||
853 | if (err) | 819 | if (err) |
854 | jbd2_journal_abort(journal, err); | 820 | jbd2_journal_abort(journal, err); |