Commit 9c35575bbe6b1dd4914a5323c8df8b3159edcc75

Authored by Christoph Hellwig
Committed by Jens Axboe
1 parent f73bee4985

jbd2: replace barriers with explicit flush / FUA usage

Switch to the WRITE_FLUSH_FUA flag for journal commits and remove the
EOPNOTSUPP detection for barriers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>

Showing 1 changed file with 4 additions and 39 deletions Side-by-side Diff

... ... @@ -134,25 +134,11 @@
134 134  
135 135 if (journal->j_flags & JBD2_BARRIER &&
136 136 !JBD2_HAS_INCOMPAT_FEATURE(journal,
137   - JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) {
138   - ret = submit_bh(WRITE_SYNC_PLUG | WRITE_BARRIER, bh);
139   - if (ret == -EOPNOTSUPP) {
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 {
  137 + JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT))
  138 + ret = submit_bh(WRITE_SYNC_PLUG | WRITE_FLUSH_FUA, bh);
  139 + else
154 140 ret = submit_bh(WRITE_SYNC_PLUG, bh);
155   - }
  141 +
156 142 *cbh = bh;
157 143 return ret;
158 144 }
159 145  
... ... @@ -166,29 +152,8 @@
166 152 {
167 153 int ret = 0;
168 154  
169   -retry:
170 155 clear_buffer_dirty(bh);
171 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 158 if (unlikely(!buffer_uptodate(bh)))
194 159 ret = -EIO;