summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Christie <mchristi@redhat.com>2016-06-05 15:31:43 -0400
committerJens Axboe <axboe@fb.com>2016-06-07 15:41:38 -0400
commit2a222ca992c35aee1e83af428f3dd26a3f5d5d94 (patch)
treea5ff0a4f59f8fc44a276dd054ea04314eec1a043
parentf21508211d2b16e65821abd171378fa6ece126fe (diff)
fs: have submit_bh users pass in op and flags separately
This has submit_bh users pass in the operation and flags separately, so submit_bh_wbc can setup the bio op and bi_rw flags on the bio that is submitted. Signed-off-by: Mike Christie <mchristi@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--drivers/md/bitmap.c4
-rw-r--r--fs/btrfs/check-integrity.c24
-rw-r--r--fs/btrfs/check-integrity.h2
-rw-r--r--fs/btrfs/disk-io.c4
-rw-r--r--fs/buffer.c53
-rw-r--r--fs/ext4/balloc.c2
-rw-r--r--fs/ext4/ialloc.c2
-rw-r--r--fs/ext4/inode.c2
-rw-r--r--fs/ext4/mmp.c4
-rw-r--r--fs/fat/misc.c2
-rw-r--r--fs/gfs2/bmap.c2
-rw-r--r--fs/gfs2/dir.c2
-rw-r--r--fs/gfs2/meta_io.c6
-rw-r--r--fs/jbd2/commit.c6
-rw-r--r--fs/jbd2/journal.c8
-rw-r--r--fs/nilfs2/btnode.c6
-rw-r--r--fs/nilfs2/btnode.h2
-rw-r--r--fs/nilfs2/btree.c6
-rw-r--r--fs/nilfs2/gcinode.c5
-rw-r--r--fs/nilfs2/mdt.c11
-rw-r--r--fs/ntfs/aops.c6
-rw-r--r--fs/ntfs/compress.c2
-rw-r--r--fs/ntfs/file.c2
-rw-r--r--fs/ntfs/logfile.c2
-rw-r--r--fs/ntfs/mft.c4
-rw-r--r--fs/ocfs2/buffer_head_io.c8
-rw-r--r--fs/reiserfs/inode.c4
-rw-r--r--fs/reiserfs/journal.c6
-rw-r--r--fs/ufs/util.c2
-rw-r--r--include/linux/buffer_head.h9
30 files changed, 102 insertions, 96 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index d8129ec93ebd..bc6dced4094c 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -297,7 +297,7 @@ static void write_page(struct bitmap *bitmap, struct page *page, int wait)
297 atomic_inc(&bitmap->pending_writes); 297 atomic_inc(&bitmap->pending_writes);
298 set_buffer_locked(bh); 298 set_buffer_locked(bh);
299 set_buffer_mapped(bh); 299 set_buffer_mapped(bh);
300 submit_bh(WRITE | REQ_SYNC, bh); 300 submit_bh(REQ_OP_WRITE, REQ_SYNC, bh);
301 bh = bh->b_this_page; 301 bh = bh->b_this_page;
302 } 302 }
303 303
@@ -392,7 +392,7 @@ static int read_page(struct file *file, unsigned long index,
392 atomic_inc(&bitmap->pending_writes); 392 atomic_inc(&bitmap->pending_writes);
393 set_buffer_locked(bh); 393 set_buffer_locked(bh);
394 set_buffer_mapped(bh); 394 set_buffer_mapped(bh);
395 submit_bh(READ, bh); 395 submit_bh(REQ_OP_READ, 0, bh);
396 } 396 }
397 block++; 397 block++;
398 bh = bh->b_this_page; 398 bh = bh->b_this_page;
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 50f81916663b..0d3748b07aba 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -2856,12 +2856,12 @@ static struct btrfsic_dev_state *btrfsic_dev_state_lookup(
2856 return ds; 2856 return ds;
2857} 2857}
2858 2858
2859int btrfsic_submit_bh(int rw, struct buffer_head *bh) 2859int btrfsic_submit_bh(int op, int op_flags, struct buffer_head *bh)
2860{ 2860{
2861 struct btrfsic_dev_state *dev_state; 2861 struct btrfsic_dev_state *dev_state;
2862 2862
2863 if (!btrfsic_is_initialized) 2863 if (!btrfsic_is_initialized)
2864 return submit_bh(rw, bh); 2864 return submit_bh(op, op_flags, bh);
2865 2865
2866 mutex_lock(&btrfsic_mutex); 2866 mutex_lock(&btrfsic_mutex);
2867 /* since btrfsic_submit_bh() might also be called before 2867 /* since btrfsic_submit_bh() might also be called before
@@ -2870,26 +2870,26 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh)
2870 2870
2871 /* Only called to write the superblock (incl. FLUSH/FUA) */ 2871 /* Only called to write the superblock (incl. FLUSH/FUA) */
2872 if (NULL != dev_state && 2872 if (NULL != dev_state &&
2873 (rw & WRITE) && bh->b_size > 0) { 2873 (op == REQ_OP_WRITE) && bh->b_size > 0) {
2874 u64 dev_bytenr; 2874 u64 dev_bytenr;
2875 2875
2876 dev_bytenr = 4096 * bh->b_blocknr; 2876 dev_bytenr = 4096 * bh->b_blocknr;
2877 if (dev_state->state->print_mask & 2877 if (dev_state->state->print_mask &
2878 BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH) 2878 BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH)
2879 printk(KERN_INFO 2879 printk(KERN_INFO
2880 "submit_bh(rw=0x%x, blocknr=%llu (bytenr %llu)," 2880 "submit_bh(op=0x%x,0x%x, blocknr=%llu "
2881 " size=%zu, data=%p, bdev=%p)\n", 2881 "(bytenr %llu), size=%zu, data=%p, bdev=%p)\n",
2882 rw, (unsigned long long)bh->b_blocknr, 2882 op, op_flags, (unsigned long long)bh->b_blocknr,
2883 dev_bytenr, bh->b_size, bh->b_data, bh->b_bdev); 2883 dev_bytenr, bh->b_size, bh->b_data, bh->b_bdev);
2884 btrfsic_process_written_block(dev_state, dev_bytenr, 2884 btrfsic_process_written_block(dev_state, dev_bytenr,
2885 &bh->b_data, 1, NULL, 2885 &bh->b_data, 1, NULL,
2886 NULL, bh, rw); 2886 NULL, bh, op_flags);
2887 } else if (NULL != dev_state && (rw & REQ_FLUSH)) { 2887 } else if (NULL != dev_state && (op_flags & REQ_FLUSH)) {
2888 if (dev_state->state->print_mask & 2888 if (dev_state->state->print_mask &
2889 BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH) 2889 BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH)
2890 printk(KERN_INFO 2890 printk(KERN_INFO
2891 "submit_bh(rw=0x%x FLUSH, bdev=%p)\n", 2891 "submit_bh(op=0x%x,0x%x FLUSH, bdev=%p)\n",
2892 rw, bh->b_bdev); 2892 op, op_flags, bh->b_bdev);
2893 if (!dev_state->dummy_block_for_bio_bh_flush.is_iodone) { 2893 if (!dev_state->dummy_block_for_bio_bh_flush.is_iodone) {
2894 if ((dev_state->state->print_mask & 2894 if ((dev_state->state->print_mask &
2895 (BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH | 2895 (BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH |
@@ -2907,7 +2907,7 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh)
2907 block->never_written = 0; 2907 block->never_written = 0;
2908 block->iodone_w_error = 0; 2908 block->iodone_w_error = 0;
2909 block->flush_gen = dev_state->last_flush_gen + 1; 2909 block->flush_gen = dev_state->last_flush_gen + 1;
2910 block->submit_bio_bh_rw = rw; 2910 block->submit_bio_bh_rw = op_flags;
2911 block->orig_bio_bh_private = bh->b_private; 2911 block->orig_bio_bh_private = bh->b_private;
2912 block->orig_bio_bh_end_io.bh = bh->b_end_io; 2912 block->orig_bio_bh_end_io.bh = bh->b_end_io;
2913 block->next_in_same_bio = NULL; 2913 block->next_in_same_bio = NULL;
@@ -2916,7 +2916,7 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh)
2916 } 2916 }
2917 } 2917 }
2918 mutex_unlock(&btrfsic_mutex); 2918 mutex_unlock(&btrfsic_mutex);
2919 return submit_bh(rw, bh); 2919 return submit_bh(op, op_flags, bh);
2920} 2920}
2921 2921
2922static void __btrfsic_submit_bio(struct bio *bio) 2922static void __btrfsic_submit_bio(struct bio *bio)
diff --git a/fs/btrfs/check-integrity.h b/fs/btrfs/check-integrity.h
index c04e249058c3..f78dff1c7e86 100644
--- a/fs/btrfs/check-integrity.h
+++ b/fs/btrfs/check-integrity.h
@@ -20,7 +20,7 @@
20#define __BTRFS_CHECK_INTEGRITY__ 20#define __BTRFS_CHECK_INTEGRITY__
21 21
22#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY 22#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
23int btrfsic_submit_bh(int rw, struct buffer_head *bh); 23int btrfsic_submit_bh(int op, int op_flags, struct buffer_head *bh);
24void btrfsic_submit_bio(struct bio *bio); 24void btrfsic_submit_bio(struct bio *bio);
25int btrfsic_submit_bio_wait(struct bio *bio); 25int btrfsic_submit_bio_wait(struct bio *bio);
26#else 26#else
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 3666558a2375..11033ce82f8a 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3420,9 +3420,9 @@ static int write_dev_supers(struct btrfs_device *device,
3420 * to go down lazy. 3420 * to go down lazy.
3421 */ 3421 */
3422 if (i == 0) 3422 if (i == 0)
3423 ret = btrfsic_submit_bh(WRITE_FUA, bh); 3423 ret = btrfsic_submit_bh(REQ_OP_WRITE, WRITE_FUA, bh);
3424 else 3424 else
3425 ret = btrfsic_submit_bh(WRITE_SYNC, bh); 3425 ret = btrfsic_submit_bh(REQ_OP_WRITE, WRITE_SYNC, bh);
3426 if (ret) 3426 if (ret)
3427 errors++; 3427 errors++;
3428 } 3428 }
diff --git a/fs/buffer.c b/fs/buffer.c
index 9a55e7f8b25c..881d33606830 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -45,7 +45,7 @@
45#include <trace/events/block.h> 45#include <trace/events/block.h>
46 46
47static int fsync_buffers_list(spinlock_t *lock, struct list_head *list); 47static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
48static int submit_bh_wbc(int rw, struct buffer_head *bh, 48static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
49 unsigned long bio_flags, 49 unsigned long bio_flags,
50 struct writeback_control *wbc); 50 struct writeback_control *wbc);
51 51
@@ -1225,7 +1225,7 @@ static struct buffer_head *__bread_slow(struct buffer_head *bh)
1225 } else { 1225 } else {
1226 get_bh(bh); 1226 get_bh(bh);
1227 bh->b_end_io = end_buffer_read_sync; 1227 bh->b_end_io = end_buffer_read_sync;
1228 submit_bh(READ, bh); 1228 submit_bh(REQ_OP_READ, 0, bh);
1229 wait_on_buffer(bh); 1229 wait_on_buffer(bh);
1230 if (buffer_uptodate(bh)) 1230 if (buffer_uptodate(bh))
1231 return bh; 1231 return bh;
@@ -1697,7 +1697,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
1697 struct buffer_head *bh, *head; 1697 struct buffer_head *bh, *head;
1698 unsigned int blocksize, bbits; 1698 unsigned int blocksize, bbits;
1699 int nr_underway = 0; 1699 int nr_underway = 0;
1700 int write_op = (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE); 1700 int write_flags = (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : 0);
1701 1701
1702 head = create_page_buffers(page, inode, 1702 head = create_page_buffers(page, inode,
1703 (1 << BH_Dirty)|(1 << BH_Uptodate)); 1703 (1 << BH_Dirty)|(1 << BH_Uptodate));
@@ -1786,7 +1786,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
1786 do { 1786 do {
1787 struct buffer_head *next = bh->b_this_page; 1787 struct buffer_head *next = bh->b_this_page;
1788 if (buffer_async_write(bh)) { 1788 if (buffer_async_write(bh)) {
1789 submit_bh_wbc(write_op, bh, 0, wbc); 1789 submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, 0, wbc);
1790 nr_underway++; 1790 nr_underway++;
1791 } 1791 }
1792 bh = next; 1792 bh = next;
@@ -1840,7 +1840,7 @@ recover:
1840 struct buffer_head *next = bh->b_this_page; 1840 struct buffer_head *next = bh->b_this_page;
1841 if (buffer_async_write(bh)) { 1841 if (buffer_async_write(bh)) {
1842 clear_buffer_dirty(bh); 1842 clear_buffer_dirty(bh);
1843 submit_bh_wbc(write_op, bh, 0, wbc); 1843 submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, 0, wbc);
1844 nr_underway++; 1844 nr_underway++;
1845 } 1845 }
1846 bh = next; 1846 bh = next;
@@ -2248,7 +2248,7 @@ int block_read_full_page(struct page *page, get_block_t *get_block)
2248 if (buffer_uptodate(bh)) 2248 if (buffer_uptodate(bh))
2249 end_buffer_async_read(bh, 1); 2249 end_buffer_async_read(bh, 1);
2250 else 2250 else
2251 submit_bh(READ, bh); 2251 submit_bh(REQ_OP_READ, 0, bh);
2252 } 2252 }
2253 return 0; 2253 return 0;
2254} 2254}
@@ -2582,7 +2582,7 @@ int nobh_write_begin(struct address_space *mapping,
2582 if (block_start < from || block_end > to) { 2582 if (block_start < from || block_end > to) {
2583 lock_buffer(bh); 2583 lock_buffer(bh);
2584 bh->b_end_io = end_buffer_read_nobh; 2584 bh->b_end_io = end_buffer_read_nobh;
2585 submit_bh(READ, bh); 2585 submit_bh(REQ_OP_READ, 0, bh);
2586 nr_reads++; 2586 nr_reads++;
2587 } 2587 }
2588 } 2588 }
@@ -2949,7 +2949,7 @@ static void end_bio_bh_io_sync(struct bio *bio)
2949 * errors, this only handles the "we need to be able to 2949 * errors, this only handles the "we need to be able to
2950 * do IO at the final sector" case. 2950 * do IO at the final sector" case.
2951 */ 2951 */
2952void guard_bio_eod(int rw, struct bio *bio) 2952void guard_bio_eod(int op, struct bio *bio)
2953{ 2953{
2954 sector_t maxsector; 2954 sector_t maxsector;
2955 struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1]; 2955 struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1];
@@ -2979,13 +2979,13 @@ void guard_bio_eod(int rw, struct bio *bio)
2979 bvec->bv_len -= truncated_bytes; 2979 bvec->bv_len -= truncated_bytes;
2980 2980
2981 /* ..and clear the end of the buffer for reads */ 2981 /* ..and clear the end of the buffer for reads */
2982 if ((rw & RW_MASK) == READ) { 2982 if (op == REQ_OP_READ) {
2983 zero_user(bvec->bv_page, bvec->bv_offset + bvec->bv_len, 2983 zero_user(bvec->bv_page, bvec->bv_offset + bvec->bv_len,
2984 truncated_bytes); 2984 truncated_bytes);
2985 } 2985 }
2986} 2986}
2987 2987
2988static int submit_bh_wbc(int rw, struct buffer_head *bh, 2988static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
2989 unsigned long bio_flags, struct writeback_control *wbc) 2989 unsigned long bio_flags, struct writeback_control *wbc)
2990{ 2990{
2991 struct bio *bio; 2991 struct bio *bio;
@@ -2999,7 +2999,7 @@ static int submit_bh_wbc(int rw, struct buffer_head *bh,
2999 /* 2999 /*
3000 * Only clear out a write error when rewriting 3000 * Only clear out a write error when rewriting
3001 */ 3001 */
3002 if (test_set_buffer_req(bh) && (rw & WRITE)) 3002 if (test_set_buffer_req(bh) && (op == REQ_OP_WRITE))
3003 clear_buffer_write_io_error(bh); 3003 clear_buffer_write_io_error(bh);
3004 3004
3005 /* 3005 /*
@@ -3024,27 +3024,28 @@ static int submit_bh_wbc(int rw, struct buffer_head *bh,
3024 bio->bi_flags |= bio_flags; 3024 bio->bi_flags |= bio_flags;
3025 3025
3026 /* Take care of bh's that straddle the end of the device */ 3026 /* Take care of bh's that straddle the end of the device */
3027 guard_bio_eod(rw, bio); 3027 guard_bio_eod(op, bio);
3028 3028
3029 if (buffer_meta(bh)) 3029 if (buffer_meta(bh))
3030 rw |= REQ_META; 3030 op_flags |= REQ_META;
3031 if (buffer_prio(bh)) 3031 if (buffer_prio(bh))
3032 rw |= REQ_PRIO; 3032 op_flags |= REQ_PRIO;
3033 bio->bi_rw = rw; 3033 bio_set_op_attrs(bio, op, op_flags);
3034 3034
3035 submit_bio(bio); 3035 submit_bio(bio);
3036 return 0; 3036 return 0;
3037} 3037}
3038 3038
3039int _submit_bh(int rw, struct buffer_head *bh, unsigned long bio_flags) 3039int _submit_bh(int op, int op_flags, struct buffer_head *bh,
3040 unsigned long bio_flags)
3040{ 3041{
3041 return submit_bh_wbc(rw, bh, bio_flags, NULL); 3042 return submit_bh_wbc(op, op_flags, bh, bio_flags, NULL);
3042} 3043}
3043EXPORT_SYMBOL_GPL(_submit_bh); 3044EXPORT_SYMBOL_GPL(_submit_bh);
3044 3045
3045int submit_bh(int rw, struct buffer_head *bh) 3046int submit_bh(int op, int op_flags, struct buffer_head *bh)
3046{ 3047{
3047 return submit_bh_wbc(rw, bh, 0, NULL); 3048 return submit_bh_wbc(op, op_flags, bh, 0, NULL);
3048} 3049}
3049EXPORT_SYMBOL(submit_bh); 3050EXPORT_SYMBOL(submit_bh);
3050 3051
@@ -3086,14 +3087,14 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhs[])
3086 if (test_clear_buffer_dirty(bh)) { 3087 if (test_clear_buffer_dirty(bh)) {
3087 bh->b_end_io = end_buffer_write_sync; 3088 bh->b_end_io = end_buffer_write_sync;
3088 get_bh(bh); 3089 get_bh(bh);
3089 submit_bh(WRITE, bh); 3090 submit_bh(rw, 0, bh);
3090 continue; 3091 continue;
3091 } 3092 }
3092 } else { 3093 } else {
3093 if (!buffer_uptodate(bh)) { 3094 if (!buffer_uptodate(bh)) {
3094 bh->b_end_io = end_buffer_read_sync; 3095 bh->b_end_io = end_buffer_read_sync;
3095 get_bh(bh); 3096 get_bh(bh);
3096 submit_bh(rw, bh); 3097 submit_bh(rw, 0, bh);
3097 continue; 3098 continue;
3098 } 3099 }
3099 } 3100 }
@@ -3102,7 +3103,7 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhs[])
3102} 3103}
3103EXPORT_SYMBOL(ll_rw_block); 3104EXPORT_SYMBOL(ll_rw_block);
3104 3105
3105void write_dirty_buffer(struct buffer_head *bh, int rw) 3106void write_dirty_buffer(struct buffer_head *bh, int op_flags)
3106{ 3107{
3107 lock_buffer(bh); 3108 lock_buffer(bh);
3108 if (!test_clear_buffer_dirty(bh)) { 3109 if (!test_clear_buffer_dirty(bh)) {
@@ -3111,7 +3112,7 @@ void write_dirty_buffer(struct buffer_head *bh, int rw)
3111 } 3112 }
3112 bh->b_end_io = end_buffer_write_sync; 3113 bh->b_end_io = end_buffer_write_sync;
3113 get_bh(bh); 3114 get_bh(bh);
3114 submit_bh(rw, bh); 3115 submit_bh(REQ_OP_WRITE, op_flags, bh);
3115} 3116}
3116EXPORT_SYMBOL(write_dirty_buffer); 3117EXPORT_SYMBOL(write_dirty_buffer);
3117 3118
@@ -3120,7 +3121,7 @@ EXPORT_SYMBOL(write_dirty_buffer);
3120 * and then start new I/O and then wait upon it. The caller must have a ref on 3121 * and then start new I/O and then wait upon it. The caller must have a ref on
3121 * the buffer_head. 3122 * the buffer_head.
3122 */ 3123 */
3123int __sync_dirty_buffer(struct buffer_head *bh, int rw) 3124int __sync_dirty_buffer(struct buffer_head *bh, int op_flags)
3124{ 3125{
3125 int ret = 0; 3126 int ret = 0;
3126 3127
@@ -3129,7 +3130,7 @@ int __sync_dirty_buffer(struct buffer_head *bh, int rw)
3129 if (test_clear_buffer_dirty(bh)) { 3130 if (test_clear_buffer_dirty(bh)) {
3130 get_bh(bh); 3131 get_bh(bh);
3131 bh->b_end_io = end_buffer_write_sync; 3132 bh->b_end_io = end_buffer_write_sync;
3132 ret = submit_bh(rw, bh); 3133 ret = submit_bh(REQ_OP_WRITE, op_flags, bh);
3133 wait_on_buffer(bh); 3134 wait_on_buffer(bh);
3134 if (!ret && !buffer_uptodate(bh)) 3135 if (!ret && !buffer_uptodate(bh))
3135 ret = -EIO; 3136 ret = -EIO;
@@ -3392,7 +3393,7 @@ int bh_submit_read(struct buffer_head *bh)
3392 3393
3393 get_bh(bh); 3394 get_bh(bh);
3394 bh->b_end_io = end_buffer_read_sync; 3395 bh->b_end_io = end_buffer_read_sync;
3395 submit_bh(READ, bh); 3396 submit_bh(REQ_OP_READ, 0, bh);
3396 wait_on_buffer(bh); 3397 wait_on_buffer(bh);
3397 if (buffer_uptodate(bh)) 3398 if (buffer_uptodate(bh))
3398 return 0; 3399 return 0;
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 3020fd70c392..a806b58e4646 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -470,7 +470,7 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)
470 trace_ext4_read_block_bitmap_load(sb, block_group); 470 trace_ext4_read_block_bitmap_load(sb, block_group);
471 bh->b_end_io = ext4_end_bitmap_read; 471 bh->b_end_io = ext4_end_bitmap_read;
472 get_bh(bh); 472 get_bh(bh);
473 submit_bh(READ | REQ_META | REQ_PRIO, bh); 473 submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO, bh);
474 return bh; 474 return bh;
475verify: 475verify:
476 err = ext4_validate_block_bitmap(sb, desc, block_group, bh); 476 err = ext4_validate_block_bitmap(sb, desc, block_group, bh);
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 3da4cf8d18b6..1e4b0b7425e5 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -214,7 +214,7 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
214 trace_ext4_load_inode_bitmap(sb, block_group); 214 trace_ext4_load_inode_bitmap(sb, block_group);
215 bh->b_end_io = ext4_end_bitmap_read; 215 bh->b_end_io = ext4_end_bitmap_read;
216 get_bh(bh); 216 get_bh(bh);
217 submit_bh(READ | REQ_META | REQ_PRIO, bh); 217 submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO, bh);
218 wait_on_buffer(bh); 218 wait_on_buffer(bh);
219 if (!buffer_uptodate(bh)) { 219 if (!buffer_uptodate(bh)) {
220 put_bh(bh); 220 put_bh(bh);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index f7140ca66e3b..ee3c7d84ef9d 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4281,7 +4281,7 @@ make_io:
4281 trace_ext4_load_inode(inode); 4281 trace_ext4_load_inode(inode);
4282 get_bh(bh); 4282 get_bh(bh);
4283 bh->b_end_io = end_buffer_read_sync; 4283 bh->b_end_io = end_buffer_read_sync;
4284 submit_bh(READ | REQ_META | REQ_PRIO, bh); 4284 submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO, bh);
4285 wait_on_buffer(bh); 4285 wait_on_buffer(bh);
4286 if (!buffer_uptodate(bh)) { 4286 if (!buffer_uptodate(bh)) {
4287 EXT4_ERROR_INODE_BLOCK(inode, block, 4287 EXT4_ERROR_INODE_BLOCK(inode, block,
diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
index 23d436d6f8b8..d89754ef1aab 100644
--- a/fs/ext4/mmp.c
+++ b/fs/ext4/mmp.c
@@ -52,7 +52,7 @@ static int write_mmp_block(struct super_block *sb, struct buffer_head *bh)
52 lock_buffer(bh); 52 lock_buffer(bh);
53 bh->b_end_io = end_buffer_write_sync; 53 bh->b_end_io = end_buffer_write_sync;
54 get_bh(bh); 54 get_bh(bh);
55 submit_bh(WRITE_SYNC | REQ_META | REQ_PRIO, bh); 55 submit_bh(REQ_OP_WRITE, WRITE_SYNC | REQ_META | REQ_PRIO, bh);
56 wait_on_buffer(bh); 56 wait_on_buffer(bh);
57 sb_end_write(sb); 57 sb_end_write(sb);
58 if (unlikely(!buffer_uptodate(bh))) 58 if (unlikely(!buffer_uptodate(bh)))
@@ -88,7 +88,7 @@ static int read_mmp_block(struct super_block *sb, struct buffer_head **bh,
88 get_bh(*bh); 88 get_bh(*bh);
89 lock_buffer(*bh); 89 lock_buffer(*bh);
90 (*bh)->b_end_io = end_buffer_read_sync; 90 (*bh)->b_end_io = end_buffer_read_sync;
91 submit_bh(READ_SYNC | REQ_META | REQ_PRIO, *bh); 91 submit_bh(REQ_OP_READ, READ_SYNC | REQ_META | REQ_PRIO, *bh);
92 wait_on_buffer(*bh); 92 wait_on_buffer(*bh);
93 if (!buffer_uptodate(*bh)) { 93 if (!buffer_uptodate(*bh)) {
94 ret = -EIO; 94 ret = -EIO;
diff --git a/fs/fat/misc.c b/fs/fat/misc.c
index c4589e981760..8a8698119ff7 100644
--- a/fs/fat/misc.c
+++ b/fs/fat/misc.c
@@ -267,7 +267,7 @@ int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs)
267 int i, err = 0; 267 int i, err = 0;
268 268
269 for (i = 0; i < nr_bhs; i++) 269 for (i = 0; i < nr_bhs; i++)
270 write_dirty_buffer(bhs[i], WRITE); 270 write_dirty_buffer(bhs[i], 0);
271 271
272 for (i = 0; i < nr_bhs; i++) { 272 for (i = 0; i < nr_bhs; i++) {
273 wait_on_buffer(bhs[i]); 273 wait_on_buffer(bhs[i]);
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 24ce1cdd434a..06d79aa4fe51 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -285,7 +285,7 @@ static void gfs2_metapath_ra(struct gfs2_glock *gl,
285 if (trylock_buffer(rabh)) { 285 if (trylock_buffer(rabh)) {
286 if (!buffer_uptodate(rabh)) { 286 if (!buffer_uptodate(rabh)) {
287 rabh->b_end_io = end_buffer_read_sync; 287 rabh->b_end_io = end_buffer_read_sync;
288 submit_bh(READA | REQ_META, rabh); 288 submit_bh(REQ_OP_READ, READA | REQ_META, rabh);
289 continue; 289 continue;
290 } 290 }
291 unlock_buffer(rabh); 291 unlock_buffer(rabh);
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 271d93905bac..0fbb42679cef 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -1513,7 +1513,7 @@ static void gfs2_dir_readahead(struct inode *inode, unsigned hsize, u32 index,
1513 continue; 1513 continue;
1514 } 1514 }
1515 bh->b_end_io = end_buffer_read_sync; 1515 bh->b_end_io = end_buffer_read_sync;
1516 submit_bh(READA | REQ_META, bh); 1516 submit_bh(REQ_OP_READ, READA | REQ_META, bh);
1517 continue; 1517 continue;
1518 } 1518 }
1519 brelse(bh); 1519 brelse(bh);
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 66670e14f654..091483e0ca76 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -37,8 +37,8 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
37{ 37{
38 struct buffer_head *bh, *head; 38 struct buffer_head *bh, *head;
39 int nr_underway = 0; 39 int nr_underway = 0;
40 int write_op = REQ_META | REQ_PRIO | 40 int write_flags = REQ_META | REQ_PRIO |
41 (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE); 41 (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : 0);
42 42
43 BUG_ON(!PageLocked(page)); 43 BUG_ON(!PageLocked(page));
44 BUG_ON(!page_has_buffers(page)); 44 BUG_ON(!page_has_buffers(page));
@@ -79,7 +79,7 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
79 do { 79 do {
80 struct buffer_head *next = bh->b_this_page; 80 struct buffer_head *next = bh->b_this_page;
81 if (buffer_async_write(bh)) { 81 if (buffer_async_write(bh)) {
82 submit_bh(write_op, bh); 82 submit_bh(REQ_OP_WRITE, write_flags, bh);
83 nr_underway++; 83 nr_underway++;
84 } 84 }
85 bh = next; 85 bh = next;
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 70078096117d..8f7d1339c973 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -155,9 +155,9 @@ static int journal_submit_commit_record(journal_t *journal,
155 155
156 if (journal->j_flags & JBD2_BARRIER && 156 if (journal->j_flags & JBD2_BARRIER &&
157 !jbd2_has_feature_async_commit(journal)) 157 !jbd2_has_feature_async_commit(journal))
158 ret = submit_bh(WRITE_SYNC | WRITE_FLUSH_FUA, bh); 158 ret = submit_bh(REQ_OP_WRITE, WRITE_SYNC | WRITE_FLUSH_FUA, bh);
159 else 159 else
160 ret = submit_bh(WRITE_SYNC, bh); 160 ret = submit_bh(REQ_OP_WRITE, WRITE_SYNC, bh);
161 161
162 *cbh = bh; 162 *cbh = bh;
163 return ret; 163 return ret;
@@ -718,7 +718,7 @@ start_journal_io:
718 clear_buffer_dirty(bh); 718 clear_buffer_dirty(bh);
719 set_buffer_uptodate(bh); 719 set_buffer_uptodate(bh);
720 bh->b_end_io = journal_end_buffer_io_sync; 720 bh->b_end_io = journal_end_buffer_io_sync;
721 submit_bh(WRITE_SYNC, bh); 721 submit_bh(REQ_OP_WRITE, WRITE_SYNC, bh);
722 } 722 }
723 cond_resched(); 723 cond_resched();
724 stats.run.rs_blocks_logged += bufs; 724 stats.run.rs_blocks_logged += bufs;
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index b31852f76f46..2606de4fa661 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1346,15 +1346,15 @@ static int journal_reset(journal_t *journal)
1346 return jbd2_journal_start_thread(journal); 1346 return jbd2_journal_start_thread(journal);
1347} 1347}
1348 1348
1349static int jbd2_write_superblock(journal_t *journal, int write_op) 1349static int jbd2_write_superblock(journal_t *journal, int write_flags)
1350{ 1350{
1351 struct buffer_head *bh = journal->j_sb_buffer; 1351 struct buffer_head *bh = journal->j_sb_buffer;
1352 journal_superblock_t *sb = journal->j_superblock; 1352 journal_superblock_t *sb = journal->j_superblock;
1353 int ret; 1353 int ret;
1354 1354
1355 trace_jbd2_write_superblock(journal, write_op); 1355 trace_jbd2_write_superblock(journal, write_flags);
1356 if (!(journal->j_flags & JBD2_BARRIER)) 1356 if (!(journal->j_flags & JBD2_BARRIER))
1357 write_op &= ~(REQ_FUA | REQ_FLUSH); 1357 write_flags &= ~(REQ_FUA | REQ_FLUSH);
1358 lock_buffer(bh); 1358 lock_buffer(bh);
1359 if (buffer_write_io_error(bh)) { 1359 if (buffer_write_io_error(bh)) {
1360 /* 1360 /*
@@ -1374,7 +1374,7 @@ static int jbd2_write_superblock(journal_t *journal, int write_op)
1374 jbd2_superblock_csum_set(journal, sb); 1374 jbd2_superblock_csum_set(journal, sb);
1375 get_bh(bh); 1375 get_bh(bh);
1376 bh->b_end_io = end_buffer_write_sync; 1376 bh->b_end_io = end_buffer_write_sync;
1377 ret = submit_bh(write_op, bh); 1377 ret = submit_bh(REQ_OP_WRITE, write_flags, bh);
1378 wait_on_buffer(bh); 1378 wait_on_buffer(bh);
1379 if (buffer_write_io_error(bh)) { 1379 if (buffer_write_io_error(bh)) {
1380 clear_buffer_write_io_error(bh); 1380 clear_buffer_write_io_error(bh);
diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c
index 0576033699bc..4cca998ec7a0 100644
--- a/fs/nilfs2/btnode.c
+++ b/fs/nilfs2/btnode.c
@@ -62,7 +62,7 @@ nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr)
62} 62}
63 63
64int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr, 64int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
65 sector_t pblocknr, int mode, 65 sector_t pblocknr, int mode, int mode_flags,
66 struct buffer_head **pbh, sector_t *submit_ptr) 66 struct buffer_head **pbh, sector_t *submit_ptr)
67{ 67{
68 struct buffer_head *bh; 68 struct buffer_head *bh;
@@ -95,7 +95,7 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
95 } 95 }
96 } 96 }
97 97
98 if (mode == READA) { 98 if (mode_flags & REQ_RAHEAD) {
99 if (pblocknr != *submit_ptr + 1 || !trylock_buffer(bh)) { 99 if (pblocknr != *submit_ptr + 1 || !trylock_buffer(bh)) {
100 err = -EBUSY; /* internal code */ 100 err = -EBUSY; /* internal code */
101 brelse(bh); 101 brelse(bh);
@@ -114,7 +114,7 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
114 bh->b_blocknr = pblocknr; /* set block address for read */ 114 bh->b_blocknr = pblocknr; /* set block address for read */
115 bh->b_end_io = end_buffer_read_sync; 115 bh->b_end_io = end_buffer_read_sync;
116 get_bh(bh); 116 get_bh(bh);
117 submit_bh(mode, bh); 117 submit_bh(mode, mode_flags, bh);
118 bh->b_blocknr = blocknr; /* set back to the given block address */ 118 bh->b_blocknr = blocknr; /* set back to the given block address */
119 *submit_ptr = pblocknr; 119 *submit_ptr = pblocknr;
120 err = 0; 120 err = 0;
diff --git a/fs/nilfs2/btnode.h b/fs/nilfs2/btnode.h
index 2cc1b80e18f7..4e8aaa1aeb65 100644
--- a/fs/nilfs2/btnode.h
+++ b/fs/nilfs2/btnode.h
@@ -43,7 +43,7 @@ void nilfs_btnode_cache_clear(struct address_space *);
43struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc, 43struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc,
44 __u64 blocknr); 44 __u64 blocknr);
45int nilfs_btnode_submit_block(struct address_space *, __u64, sector_t, int, 45int nilfs_btnode_submit_block(struct address_space *, __u64, sector_t, int,
46 struct buffer_head **, sector_t *); 46 int, struct buffer_head **, sector_t *);
47void nilfs_btnode_delete(struct buffer_head *); 47void nilfs_btnode_delete(struct buffer_head *);
48int nilfs_btnode_prepare_change_key(struct address_space *, 48int nilfs_btnode_prepare_change_key(struct address_space *,
49 struct nilfs_btnode_chkey_ctxt *); 49 struct nilfs_btnode_chkey_ctxt *);
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index eccb1c89ccbb..982d1e3df3a5 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -476,7 +476,8 @@ static int __nilfs_btree_get_block(const struct nilfs_bmap *btree, __u64 ptr,
476 sector_t submit_ptr = 0; 476 sector_t submit_ptr = 0;
477 int ret; 477 int ret;
478 478
479 ret = nilfs_btnode_submit_block(btnc, ptr, 0, READ, &bh, &submit_ptr); 479 ret = nilfs_btnode_submit_block(btnc, ptr, 0, REQ_OP_READ, 0, &bh,
480 &submit_ptr);
480 if (ret) { 481 if (ret) {
481 if (ret != -EEXIST) 482 if (ret != -EEXIST)
482 return ret; 483 return ret;
@@ -492,7 +493,8 @@ static int __nilfs_btree_get_block(const struct nilfs_bmap *btree, __u64 ptr,
492 n > 0 && i < ra->ncmax; n--, i++) { 493 n > 0 && i < ra->ncmax; n--, i++) {
493 ptr2 = nilfs_btree_node_get_ptr(ra->node, i, ra->ncmax); 494 ptr2 = nilfs_btree_node_get_ptr(ra->node, i, ra->ncmax);
494 495
495 ret = nilfs_btnode_submit_block(btnc, ptr2, 0, READA, 496 ret = nilfs_btnode_submit_block(btnc, ptr2, 0,
497 REQ_OP_READ, REQ_RAHEAD,
496 &ra_bh, &submit_ptr); 498 &ra_bh, &submit_ptr);
497 if (likely(!ret || ret == -EEXIST)) 499 if (likely(!ret || ret == -EEXIST))
498 brelse(ra_bh); 500 brelse(ra_bh);
diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c
index 693aded72498..e9148f94d696 100644
--- a/fs/nilfs2/gcinode.c
+++ b/fs/nilfs2/gcinode.c
@@ -101,7 +101,7 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
101 bh->b_blocknr = pbn; 101 bh->b_blocknr = pbn;
102 bh->b_end_io = end_buffer_read_sync; 102 bh->b_end_io = end_buffer_read_sync;
103 get_bh(bh); 103 get_bh(bh);
104 submit_bh(READ, bh); 104 submit_bh(REQ_OP_READ, 0, bh);
105 if (vbn) 105 if (vbn)
106 bh->b_blocknr = vbn; 106 bh->b_blocknr = vbn;
107 out: 107 out:
@@ -138,7 +138,8 @@ int nilfs_gccache_submit_read_node(struct inode *inode, sector_t pbn,
138 int ret; 138 int ret;
139 139
140 ret = nilfs_btnode_submit_block(&NILFS_I(inode)->i_btnode_cache, 140 ret = nilfs_btnode_submit_block(&NILFS_I(inode)->i_btnode_cache,
141 vbn ? : pbn, pbn, READ, out_bh, &pbn); 141 vbn ? : pbn, pbn, REQ_OP_READ, 0,
142 out_bh, &pbn);
142 if (ret == -EEXIST) /* internal code (cache hit) */ 143 if (ret == -EEXIST) /* internal code (cache hit) */
143 ret = 0; 144 ret = 0;
144 return ret; 145 return ret;
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c
index 3417d859a03c..0d7b71fbeff8 100644
--- a/fs/nilfs2/mdt.c
+++ b/fs/nilfs2/mdt.c
@@ -121,7 +121,7 @@ static int nilfs_mdt_create_block(struct inode *inode, unsigned long block,
121 121
122static int 122static int
123nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff, 123nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff,
124 int mode, struct buffer_head **out_bh) 124 int mode, int mode_flags, struct buffer_head **out_bh)
125{ 125{
126 struct buffer_head *bh; 126 struct buffer_head *bh;
127 __u64 blknum = 0; 127 __u64 blknum = 0;
@@ -135,7 +135,7 @@ nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff,
135 if (buffer_uptodate(bh)) 135 if (buffer_uptodate(bh))
136 goto out; 136 goto out;
137 137
138 if (mode == READA) { 138 if (mode_flags & REQ_RAHEAD) {
139 if (!trylock_buffer(bh)) { 139 if (!trylock_buffer(bh)) {
140 ret = -EBUSY; 140 ret = -EBUSY;
141 goto failed_bh; 141 goto failed_bh;
@@ -157,7 +157,7 @@ nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff,
157 157
158 bh->b_end_io = end_buffer_read_sync; 158 bh->b_end_io = end_buffer_read_sync;
159 get_bh(bh); 159 get_bh(bh);
160 submit_bh(mode, bh); 160 submit_bh(mode, mode_flags, bh);
161 ret = 0; 161 ret = 0;
162 162
163 trace_nilfs2_mdt_submit_block(inode, inode->i_ino, blkoff, mode); 163 trace_nilfs2_mdt_submit_block(inode, inode->i_ino, blkoff, mode);
@@ -181,7 +181,7 @@ static int nilfs_mdt_read_block(struct inode *inode, unsigned long block,
181 int i, nr_ra_blocks = NILFS_MDT_MAX_RA_BLOCKS; 181 int i, nr_ra_blocks = NILFS_MDT_MAX_RA_BLOCKS;
182 int err; 182 int err;
183 183
184 err = nilfs_mdt_submit_block(inode, block, READ, &first_bh); 184 err = nilfs_mdt_submit_block(inode, block, REQ_OP_READ, 0, &first_bh);
185 if (err == -EEXIST) /* internal code */ 185 if (err == -EEXIST) /* internal code */
186 goto out; 186 goto out;
187 187
@@ -191,7 +191,8 @@ static int nilfs_mdt_read_block(struct inode *inode, unsigned long block,
191 if (readahead) { 191 if (readahead) {
192 blkoff = block + 1; 192 blkoff = block + 1;
193 for (i = 0; i < nr_ra_blocks; i++, blkoff++) { 193 for (i = 0; i < nr_ra_blocks; i++, blkoff++) {
194 err = nilfs_mdt_submit_block(inode, blkoff, READA, &bh); 194 err = nilfs_mdt_submit_block(inode, blkoff, REQ_OP_READ,
195 REQ_RAHEAD, &bh);
195 if (likely(!err || err == -EEXIST)) 196 if (likely(!err || err == -EEXIST))
196 brelse(bh); 197 brelse(bh);
197 else if (err != -EBUSY) 198 else if (err != -EBUSY)
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c
index 97768a1379f2..fe251f187ff8 100644
--- a/fs/ntfs/aops.c
+++ b/fs/ntfs/aops.c
@@ -362,7 +362,7 @@ handle_zblock:
362 for (i = 0; i < nr; i++) { 362 for (i = 0; i < nr; i++) {
363 tbh = arr[i]; 363 tbh = arr[i];
364 if (likely(!buffer_uptodate(tbh))) 364 if (likely(!buffer_uptodate(tbh)))
365 submit_bh(READ, tbh); 365 submit_bh(REQ_OP_READ, 0, tbh);
366 else 366 else
367 ntfs_end_buffer_async_read(tbh, 1); 367 ntfs_end_buffer_async_read(tbh, 1);
368 } 368 }
@@ -877,7 +877,7 @@ lock_retry_remap:
877 do { 877 do {
878 struct buffer_head *next = bh->b_this_page; 878 struct buffer_head *next = bh->b_this_page;
879 if (buffer_async_write(bh)) { 879 if (buffer_async_write(bh)) {
880 submit_bh(WRITE, bh); 880 submit_bh(REQ_OP_WRITE, 0, bh);
881 need_end_writeback = false; 881 need_end_writeback = false;
882 } 882 }
883 bh = next; 883 bh = next;
@@ -1202,7 +1202,7 @@ lock_retry_remap:
1202 BUG_ON(!buffer_mapped(tbh)); 1202 BUG_ON(!buffer_mapped(tbh));
1203 get_bh(tbh); 1203 get_bh(tbh);
1204 tbh->b_end_io = end_buffer_write_sync; 1204 tbh->b_end_io = end_buffer_write_sync;
1205 submit_bh(WRITE, tbh); 1205 submit_bh(REQ_OP_WRITE, 0, tbh);
1206 } 1206 }
1207 /* Synchronize the mft mirror now if not @sync. */ 1207 /* Synchronize the mft mirror now if not @sync. */
1208 if (is_mft && !sync) 1208 if (is_mft && !sync)
diff --git a/fs/ntfs/compress.c b/fs/ntfs/compress.c
index f2b5e746f49b..f8eb04387ca4 100644
--- a/fs/ntfs/compress.c
+++ b/fs/ntfs/compress.c
@@ -670,7 +670,7 @@ lock_retry_remap:
670 } 670 }
671 get_bh(tbh); 671 get_bh(tbh);
672 tbh->b_end_io = end_buffer_read_sync; 672 tbh->b_end_io = end_buffer_read_sync;
673 submit_bh(READ, tbh); 673 submit_bh(REQ_OP_READ, 0, tbh);
674 } 674 }
675 675
676 /* Wait for io completion on all buffer heads. */ 676 /* Wait for io completion on all buffer heads. */
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index 5622ed5a201e..f548629dfaac 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -553,7 +553,7 @@ static inline int ntfs_submit_bh_for_read(struct buffer_head *bh)
553 lock_buffer(bh); 553 lock_buffer(bh);
554 get_bh(bh); 554 get_bh(bh);
555 bh->b_end_io = end_buffer_read_sync; 555 bh->b_end_io = end_buffer_read_sync;
556 return submit_bh(READ, bh); 556 return submit_bh(REQ_OP_READ, 0, bh);
557} 557}
558 558
559/** 559/**
diff --git a/fs/ntfs/logfile.c b/fs/ntfs/logfile.c
index 9d71213ca81e..761f12f7f3ef 100644
--- a/fs/ntfs/logfile.c
+++ b/fs/ntfs/logfile.c
@@ -821,7 +821,7 @@ map_vcn:
821 * completed ignore errors afterwards as we can assume 821 * completed ignore errors afterwards as we can assume
822 * that if one buffer worked all of them will work. 822 * that if one buffer worked all of them will work.
823 */ 823 */
824 submit_bh(WRITE, bh); 824 submit_bh(REQ_OP_WRITE, 0, bh);
825 if (should_wait) { 825 if (should_wait) {
826 should_wait = false; 826 should_wait = false;
827 wait_on_buffer(bh); 827 wait_on_buffer(bh);
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c
index 37b2501caaa4..d15d492ce47b 100644
--- a/fs/ntfs/mft.c
+++ b/fs/ntfs/mft.c
@@ -592,7 +592,7 @@ int ntfs_sync_mft_mirror(ntfs_volume *vol, const unsigned long mft_no,
592 clear_buffer_dirty(tbh); 592 clear_buffer_dirty(tbh);
593 get_bh(tbh); 593 get_bh(tbh);
594 tbh->b_end_io = end_buffer_write_sync; 594 tbh->b_end_io = end_buffer_write_sync;
595 submit_bh(WRITE, tbh); 595 submit_bh(REQ_OP_WRITE, 0, tbh);
596 } 596 }
597 /* Wait on i/o completion of buffers. */ 597 /* Wait on i/o completion of buffers. */
598 for (i_bhs = 0; i_bhs < nr_bhs; i_bhs++) { 598 for (i_bhs = 0; i_bhs < nr_bhs; i_bhs++) {
@@ -785,7 +785,7 @@ int write_mft_record_nolock(ntfs_inode *ni, MFT_RECORD *m, int sync)
785 clear_buffer_dirty(tbh); 785 clear_buffer_dirty(tbh);
786 get_bh(tbh); 786 get_bh(tbh);
787 tbh->b_end_io = end_buffer_write_sync; 787 tbh->b_end_io = end_buffer_write_sync;
788 submit_bh(WRITE, tbh); 788 submit_bh(REQ_OP_WRITE, 0, tbh);
789 } 789 }
790 /* Synchronize the mft mirror now if not @sync. */ 790 /* Synchronize the mft mirror now if not @sync. */
791 if (!sync && ni->mft_no < vol->mftmirr_size) 791 if (!sync && ni->mft_no < vol->mftmirr_size)
diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c
index fe50ded1b4ce..fb775c940d5f 100644
--- a/fs/ocfs2/buffer_head_io.c
+++ b/fs/ocfs2/buffer_head_io.c
@@ -79,7 +79,7 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh,
79 79
80 get_bh(bh); /* for end_buffer_write_sync() */ 80 get_bh(bh); /* for end_buffer_write_sync() */
81 bh->b_end_io = end_buffer_write_sync; 81 bh->b_end_io = end_buffer_write_sync;
82 submit_bh(WRITE, bh); 82 submit_bh(REQ_OP_WRITE, 0, bh);
83 83
84 wait_on_buffer(bh); 84 wait_on_buffer(bh);
85 85
@@ -149,7 +149,7 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block,
149 clear_buffer_uptodate(bh); 149 clear_buffer_uptodate(bh);
150 get_bh(bh); /* for end_buffer_read_sync() */ 150 get_bh(bh); /* for end_buffer_read_sync() */
151 bh->b_end_io = end_buffer_read_sync; 151 bh->b_end_io = end_buffer_read_sync;
152 submit_bh(READ, bh); 152 submit_bh(REQ_OP_READ, 0, bh);
153 } 153 }
154 154
155 for (i = nr; i > 0; i--) { 155 for (i = nr; i > 0; i--) {
@@ -305,7 +305,7 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
305 if (validate) 305 if (validate)
306 set_buffer_needs_validate(bh); 306 set_buffer_needs_validate(bh);
307 bh->b_end_io = end_buffer_read_sync; 307 bh->b_end_io = end_buffer_read_sync;
308 submit_bh(READ, bh); 308 submit_bh(REQ_OP_READ, 0, bh);
309 continue; 309 continue;
310 } 310 }
311 } 311 }
@@ -419,7 +419,7 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
419 get_bh(bh); /* for end_buffer_write_sync() */ 419 get_bh(bh); /* for end_buffer_write_sync() */
420 bh->b_end_io = end_buffer_write_sync; 420 bh->b_end_io = end_buffer_write_sync;
421 ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &di->i_check); 421 ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &di->i_check);
422 submit_bh(WRITE, bh); 422 submit_bh(REQ_OP_WRITE, 0, bh);
423 423
424 wait_on_buffer(bh); 424 wait_on_buffer(bh);
425 425
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 825455d3e4ba..c2c59f9ff04b 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -2668,7 +2668,7 @@ static int reiserfs_write_full_page(struct page *page,
2668 do { 2668 do {
2669 struct buffer_head *next = bh->b_this_page; 2669 struct buffer_head *next = bh->b_this_page;
2670 if (buffer_async_write(bh)) { 2670 if (buffer_async_write(bh)) {
2671 submit_bh(WRITE, bh); 2671 submit_bh(REQ_OP_WRITE, 0, bh);
2672 nr++; 2672 nr++;
2673 } 2673 }
2674 put_bh(bh); 2674 put_bh(bh);
@@ -2728,7 +2728,7 @@ fail:
2728 struct buffer_head *next = bh->b_this_page; 2728 struct buffer_head *next = bh->b_this_page;
2729 if (buffer_async_write(bh)) { 2729 if (buffer_async_write(bh)) {
2730 clear_buffer_dirty(bh); 2730 clear_buffer_dirty(bh);
2731 submit_bh(WRITE, bh); 2731 submit_bh(REQ_OP_WRITE, 0, bh);
2732 nr++; 2732 nr++;
2733 } 2733 }
2734 put_bh(bh); 2734 put_bh(bh);
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 2ace90e981f0..6945e719bdab 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -652,7 +652,7 @@ static void submit_logged_buffer(struct buffer_head *bh)
652 BUG(); 652 BUG();
653 if (!buffer_uptodate(bh)) 653 if (!buffer_uptodate(bh))
654 BUG(); 654 BUG();
655 submit_bh(WRITE, bh); 655 submit_bh(REQ_OP_WRITE, 0, bh);
656} 656}
657 657
658static void submit_ordered_buffer(struct buffer_head *bh) 658static void submit_ordered_buffer(struct buffer_head *bh)
@@ -662,7 +662,7 @@ static void submit_ordered_buffer(struct buffer_head *bh)
662 clear_buffer_dirty(bh); 662 clear_buffer_dirty(bh);
663 if (!buffer_uptodate(bh)) 663 if (!buffer_uptodate(bh))
664 BUG(); 664 BUG();
665 submit_bh(WRITE, bh); 665 submit_bh(REQ_OP_WRITE, 0, bh);
666} 666}
667 667
668#define CHUNK_SIZE 32 668#define CHUNK_SIZE 32
@@ -2269,7 +2269,7 @@ abort_replay:
2269 /* flush out the real blocks */ 2269 /* flush out the real blocks */
2270 for (i = 0; i < get_desc_trans_len(desc); i++) { 2270 for (i = 0; i < get_desc_trans_len(desc); i++) {
2271 set_buffer_dirty(real_blocks[i]); 2271 set_buffer_dirty(real_blocks[i]);
2272 write_dirty_buffer(real_blocks[i], WRITE); 2272 write_dirty_buffer(real_blocks[i], 0);
2273 } 2273 }
2274 for (i = 0; i < get_desc_trans_len(desc); i++) { 2274 for (i = 0; i < get_desc_trans_len(desc); i++) {
2275 wait_on_buffer(real_blocks[i]); 2275 wait_on_buffer(real_blocks[i]);
diff --git a/fs/ufs/util.c b/fs/ufs/util.c
index a409e3e7827a..f41ad0a6106f 100644
--- a/fs/ufs/util.c
+++ b/fs/ufs/util.c
@@ -118,7 +118,7 @@ void ubh_sync_block(struct ufs_buffer_head *ubh)
118 unsigned i; 118 unsigned i;
119 119
120 for (i = 0; i < ubh->count; i++) 120 for (i = 0; i < ubh->count; i++)
121 write_dirty_buffer(ubh->bh[i], WRITE); 121 write_dirty_buffer(ubh->bh[i], 0);
122 122
123 for (i = 0; i < ubh->count; i++) 123 for (i = 0; i < ubh->count; i++)
124 wait_on_buffer(ubh->bh[i]); 124 wait_on_buffer(ubh->bh[i]);
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index d48daa3f6f20..bc9a45d1e3af 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -189,10 +189,11 @@ void unlock_buffer(struct buffer_head *bh);
189void __lock_buffer(struct buffer_head *bh); 189void __lock_buffer(struct buffer_head *bh);
190void ll_rw_block(int, int, struct buffer_head * bh[]); 190void ll_rw_block(int, int, struct buffer_head * bh[]);
191int sync_dirty_buffer(struct buffer_head *bh); 191int sync_dirty_buffer(struct buffer_head *bh);
192int __sync_dirty_buffer(struct buffer_head *bh, int rw); 192int __sync_dirty_buffer(struct buffer_head *bh, int op_flags);
193void write_dirty_buffer(struct buffer_head *bh, int rw); 193void write_dirty_buffer(struct buffer_head *bh, int op_flags);
194int _submit_bh(int rw, struct buffer_head *bh, unsigned long bio_flags); 194int _submit_bh(int op, int op_flags, struct buffer_head *bh,
195int submit_bh(int, struct buffer_head *); 195 unsigned long bio_flags);
196int submit_bh(int, int, struct buffer_head *);
196void write_boundary_block(struct block_device *bdev, 197void write_boundary_block(struct block_device *bdev,
197 sector_t bblock, unsigned blocksize); 198 sector_t bblock, unsigned blocksize);
198int bh_uptodate_or_lock(struct buffer_head *bh); 199int bh_uptodate_or_lock(struct buffer_head *bh);