aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd2/commit.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-22 20:07:18 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-22 20:07:18 -0400
commita2887097f25cd38cadfc11d10769e2b349fb5eca (patch)
treecd4adcb305365d6ba9acd2c02d4eb9d0125c6f8d /fs/jbd2/commit.c
parent8abfc6e7a45eb74e51904bbae676fae008b11366 (diff)
parent005a1d15f5a6b2bb4ada80349513effbf22b4588 (diff)
Merge branch 'for-2.6.37/barrier' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.37/barrier' of git://git.kernel.dk/linux-2.6-block: (46 commits) xen-blkfront: disable barrier/flush write support Added blk-lib.c and blk-barrier.c was renamed to blk-flush.c block: remove BLKDEV_IFL_WAIT aic7xxx_old: removed unused 'req' variable block: remove the BH_Eopnotsupp flag block: remove the BLKDEV_IFL_BARRIER flag block: remove the WRITE_BARRIER flag swap: do not send discards as barriers fat: do not send discards as barriers ext4: do not send discards as barriers jbd2: replace barriers with explicit flush / FUA usage jbd2: Modify ASYNC_COMMIT code to not rely on queue draining on barrier jbd: replace barriers with explicit flush / FUA usage nilfs2: replace barriers with explicit flush / FUA usage reiserfs: replace barriers with explicit flush / FUA usage gfs2: replace barriers with explicit flush / FUA usage btrfs: replace barriers with explicit flush / FUA usage xfs: replace barriers with explicit flush / FUA usage block: pass gfp_mask and flags to sb_issue_discard dm: convey that all flushes are processed as empty ...
Diffstat (limited to 'fs/jbd2/commit.c')
-rw-r--r--fs/jbd2/commit.c74
1 files changed, 20 insertions, 54 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 80910f51d4b4..bc6be8bda1cc 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -134,25 +134,11 @@ static int journal_submit_commit_record(journal_t *journal,
134 134
135 if (journal->j_flags & JBD2_BARRIER && 135 if (journal->j_flags & JBD2_BARRIER &&
136 !JBD2_HAS_INCOMPAT_FEATURE(journal, 136 !JBD2_HAS_INCOMPAT_FEATURE(journal,
137 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) { 137 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT))
138 ret = submit_bh(WRITE_SYNC_PLUG | WRITE_BARRIER, bh); 138 ret = submit_bh(WRITE_SYNC_PLUG | WRITE_FLUSH_FUA, bh);
139 if (ret == -EOPNOTSUPP) { 139 else
140 printk(KERN_WARNING
141 "JBD2: Disabling barriers on %s, "
142 "not supported by device\n", journal->j_devname);
143 write_lock(&journal->j_state_lock);
144 journal->j_flags &= ~JBD2_BARRIER;
145 write_unlock(&journal->j_state_lock);
146
147 /* And try again, without the barrier */
148 lock_buffer(bh);
149 set_buffer_uptodate(bh);
150 clear_buffer_dirty(bh);
151 ret = submit_bh(WRITE_SYNC_PLUG, bh);
152 }
153 } else {
154 ret = submit_bh(WRITE_SYNC_PLUG, bh); 140 ret = submit_bh(WRITE_SYNC_PLUG, bh);
155 } 141
156 *cbh = bh; 142 *cbh = bh;
157 return ret; 143 return ret;
158} 144}
@@ -166,29 +152,8 @@ static int journal_wait_on_commit_record(journal_t *journal,
166{ 152{
167 int ret = 0; 153 int ret = 0;
168 154
169retry:
170 clear_buffer_dirty(bh); 155 clear_buffer_dirty(bh);
171 wait_on_buffer(bh); 156 wait_on_buffer(bh);
172 if (buffer_eopnotsupp(bh) && (journal->j_flags & JBD2_BARRIER)) {
173 printk(KERN_WARNING
174 "JBD2: %s: disabling barries on %s - not supported "
175 "by device\n", __func__, journal->j_devname);
176 write_lock(&journal->j_state_lock);
177 journal->j_flags &= ~JBD2_BARRIER;
178 write_unlock(&journal->j_state_lock);
179
180 lock_buffer(bh);
181 clear_buffer_dirty(bh);
182 set_buffer_uptodate(bh);
183 bh->b_end_io = journal_end_buffer_io_sync;
184
185 ret = submit_bh(WRITE_SYNC_PLUG, bh);
186 if (ret) {
187 unlock_buffer(bh);
188 return ret;
189 }
190 goto retry;
191 }
192 157
193 if (unlikely(!buffer_uptodate(bh))) 158 if (unlikely(!buffer_uptodate(bh)))
194 ret = -EIO; 159 ret = -EIO;
@@ -701,6 +666,16 @@ start_journal_io:
701 } 666 }
702 } 667 }
703 668
669 err = journal_finish_inode_data_buffers(journal, commit_transaction);
670 if (err) {
671 printk(KERN_WARNING
672 "JBD2: Detected IO errors while flushing file data "
673 "on %s\n", journal->j_devname);
674 if (journal->j_flags & JBD2_ABORT_ON_SYNCDATA_ERR)
675 jbd2_journal_abort(journal, err);
676 err = 0;
677 }
678
704 /* 679 /*
705 * If the journal is not located on the file system device, 680 * If the journal is not located on the file system device,
706 * then we must flush the file system device before we issue 681 * then we must flush the file system device before we issue
@@ -709,8 +684,7 @@ start_journal_io:
709 if (commit_transaction->t_flushed_data_blocks && 684 if (commit_transaction->t_flushed_data_blocks &&
710 (journal->j_fs_dev != journal->j_dev) && 685 (journal->j_fs_dev != journal->j_dev) &&
711 (journal->j_flags & JBD2_BARRIER)) 686 (journal->j_flags & JBD2_BARRIER))
712 blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL, 687 blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL);
713 BLKDEV_IFL_WAIT);
714 688
715 /* Done it all: now write the commit record asynchronously. */ 689 /* Done it all: now write the commit record asynchronously. */
716 if (JBD2_HAS_INCOMPAT_FEATURE(journal, 690 if (JBD2_HAS_INCOMPAT_FEATURE(journal,
@@ -719,19 +693,6 @@ start_journal_io:
719 &cbh, crc32_sum); 693 &cbh, crc32_sum);
720 if (err) 694 if (err)
721 __jbd2_journal_abort_hard(journal); 695 __jbd2_journal_abort_hard(journal);
722 if (journal->j_flags & JBD2_BARRIER)
723 blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL,
724 BLKDEV_IFL_WAIT);
725 }
726
727 err = journal_finish_inode_data_buffers(journal, commit_transaction);
728 if (err) {
729 printk(KERN_WARNING
730 "JBD2: Detected IO errors while flushing file data "
731 "on %s\n", journal->j_devname);
732 if (journal->j_flags & JBD2_ABORT_ON_SYNCDATA_ERR)
733 jbd2_journal_abort(journal, err);
734 err = 0;
735 } 696 }
736 697
737 /* Lo and behold: we have just managed to send a transaction to 698 /* Lo and behold: we have just managed to send a transaction to
@@ -845,6 +806,11 @@ wait_for_iobuf:
845 } 806 }
846 if (!err && !is_journal_aborted(journal)) 807 if (!err && !is_journal_aborted(journal))
847 err = journal_wait_on_commit_record(journal, cbh); 808 err = journal_wait_on_commit_record(journal, cbh);
809 if (JBD2_HAS_INCOMPAT_FEATURE(journal,
810 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) &&
811 journal->j_flags & JBD2_BARRIER) {
812 blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL);
813 }
848 814
849 if (err) 815 if (err)
850 jbd2_journal_abort(journal, err); 816 jbd2_journal_abort(journal, err);