fs: have ll_rw_block users pass in op and flags separately
authorMike Christie <mchristi@redhat.com>
Sun, 5 Jun 2016 19:31:44 +0000 (14:31 -0500)
committerJens Axboe <axboe@fb.com>
Tue, 7 Jun 2016 19:41:38 +0000 (13:41 -0600)
This has ll_rw_block users pass in the operation and flags separately,
so ll_rw_block 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>
21 files changed:
fs/buffer.c
fs/ext4/inode.c
fs/ext4/namei.c
fs/ext4/super.c
fs/gfs2/bmap.c
fs/gfs2/meta_io.c
fs/gfs2/quota.c
fs/isofs/compress.c
fs/jbd2/journal.c
fs/jbd2/recovery.c
fs/ocfs2/aops.c
fs/ocfs2/super.c
fs/reiserfs/journal.c
fs/reiserfs/stree.c
fs/reiserfs/super.c
fs/squashfs/block.c
fs/udf/dir.c
fs/udf/directory.c
fs/udf/inode.c
fs/ufs/balloc.c
include/linux/buffer_head.h

index 881d3360683092ee9369b8ef1ac4b16acc8a5dfa..373aacb4f4c1e147e415b233c5ce927a833382ab 100644 (file)
@@ -588,7 +588,7 @@ void write_boundary_block(struct block_device *bdev,
        struct buffer_head *bh = __find_get_block(bdev, bblock + 1, blocksize);
        if (bh) {
                if (buffer_dirty(bh))
-                       ll_rw_block(WRITE, 1, &bh);
+                       ll_rw_block(REQ_OP_WRITE, 0, 1, &bh);
                put_bh(bh);
        }
 }
@@ -1395,7 +1395,7 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size)
 {
        struct buffer_head *bh = __getblk(bdev, block, size);
        if (likely(bh)) {
-               ll_rw_block(READA, 1, &bh);
+               ll_rw_block(REQ_OP_READ, READA, 1, &bh);
                brelse(bh);
        }
 }
@@ -1955,7 +1955,7 @@ int __block_write_begin(struct page *page, loff_t pos, unsigned len,
                if (!buffer_uptodate(bh) && !buffer_delay(bh) &&
                    !buffer_unwritten(bh) &&
                     (block_start < from || block_end > to)) {
-                       ll_rw_block(READ, 1, &bh);
+                       ll_rw_block(REQ_OP_READ, 0, 1, &bh);
                        *wait_bh++=bh;
                }
        }
@@ -2852,7 +2852,7 @@ int block_truncate_page(struct address_space *mapping,
 
        if (!buffer_uptodate(bh) && !buffer_delay(bh) && !buffer_unwritten(bh)) {
                err = -EIO;
-               ll_rw_block(READ, 1, &bh);
+               ll_rw_block(REQ_OP_READ, 0, 1, &bh);
                wait_on_buffer(bh);
                /* Uhhuh. Read error. Complain and punt. */
                if (!buffer_uptodate(bh))
@@ -3051,7 +3051,8 @@ EXPORT_SYMBOL(submit_bh);
 
 /**
  * ll_rw_block: low-level access to block devices (DEPRECATED)
- * @rw: whether to %READ or %WRITE or maybe %READA (readahead)
+ * @op: whether to %READ or %WRITE
+ * @op_flags: rq_flag_bits or %READA (readahead)
  * @nr: number of &struct buffer_heads in the array
  * @bhs: array of pointers to &struct buffer_head
  *
@@ -3074,7 +3075,7 @@ EXPORT_SYMBOL(submit_bh);
  * All of the buffers must be for the same device, and must also be a
  * multiple of the current approved size for the device.
  */
-void ll_rw_block(int rw, int nr, struct buffer_head *bhs[])
+void ll_rw_block(int op, int op_flags,  int nr, struct buffer_head *bhs[])
 {
        int i;
 
@@ -3083,18 +3084,18 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhs[])
 
                if (!trylock_buffer(bh))
                        continue;
-               if (rw == WRITE) {
+               if (op == WRITE) {
                        if (test_clear_buffer_dirty(bh)) {
                                bh->b_end_io = end_buffer_write_sync;
                                get_bh(bh);
-                               submit_bh(rw, 0, bh);
+                               submit_bh(op, op_flags, bh);
                                continue;
                        }
                } else {
                        if (!buffer_uptodate(bh)) {
                                bh->b_end_io = end_buffer_read_sync;
                                get_bh(bh);
-                               submit_bh(rw, 0, bh);
+                               submit_bh(op, op_flags, bh);
                                continue;
                        }
                }
index ee3c7d84ef9d789cd2a4b9312196057f4891a058..ae44916d40e2fb3c949b031a4a0bd51b8af3346c 100644 (file)
@@ -981,7 +981,7 @@ struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
                return bh;
        if (!bh || buffer_uptodate(bh))
                return bh;
-       ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh);
+       ll_rw_block(REQ_OP_READ, REQ_META | REQ_PRIO, 1, &bh);
        wait_on_buffer(bh);
        if (buffer_uptodate(bh))
                return bh;
@@ -1135,7 +1135,7 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len,
                if (!buffer_uptodate(bh) && !buffer_delay(bh) &&
                    !buffer_unwritten(bh) &&
                    (block_start < from || block_end > to)) {
-                       ll_rw_block(READ, 1, &bh);
+                       ll_rw_block(REQ_OP_READ, 0, 1, &bh);
                        *wait_bh++ = bh;
                        decrypt = ext4_encrypted_inode(inode) &&
                                S_ISREG(inode->i_mode);
@@ -3698,7 +3698,7 @@ static int __ext4_block_zero_page_range(handle_t *handle,
 
        if (!buffer_uptodate(bh)) {
                err = -EIO;
-               ll_rw_block(READ, 1, &bh);
+               ll_rw_block(REQ_OP_READ, 0, 1, &bh);
                wait_on_buffer(bh);
                /* Uhhuh. Read error. Complain and punt. */
                if (!buffer_uptodate(bh))
index ec4c39952e847462c9a4a62f7d4bcc1afb74fd37..6569c6b47da43b045e499d1523e04dbf0f4418b5 100644 (file)
@@ -1443,7 +1443,8 @@ restart:
                                }
                                bh_use[ra_max] = bh;
                                if (bh)
-                                       ll_rw_block(READ | REQ_META | REQ_PRIO,
+                                       ll_rw_block(REQ_OP_READ,
+                                                   REQ_META | REQ_PRIO,
                                                    1, &bh);
                        }
                }
index 3822a5aedc61b241d937c474192bfa57e5b3b2c5..b1a347100d5483a208c97ec2e70be420f67f94e7 100644 (file)
@@ -4204,7 +4204,7 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
                goto out_bdev;
        }
        journal->j_private = sb;
-       ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &journal->j_sb_buffer);
+       ll_rw_block(REQ_OP_READ, REQ_META | REQ_PRIO, 1, &journal->j_sb_buffer);
        wait_on_buffer(journal->j_sb_buffer);
        if (!buffer_uptodate(journal->j_sb_buffer)) {
                ext4_msg(sb, KERN_ERR, "I/O error on journal device");
index 06d79aa4fe51669f97b7e310f20d6fbddfa9f816..fd6389cf0f144f0b0942caef47c1b1a587e83ec7 100644 (file)
@@ -974,7 +974,7 @@ static int gfs2_block_truncate_page(struct address_space *mapping, loff_t from)
 
        if (!buffer_uptodate(bh)) {
                err = -EIO;
-               ll_rw_block(READ, 1, &bh);
+               ll_rw_block(REQ_OP_READ, 0, 1, &bh);
                wait_on_buffer(bh);
                /* Uhhuh. Read error. Complain and punt. */
                if (!buffer_uptodate(bh))
index 091483e0ca7620d6ee06c4c76f4159854778271a..b718447f7eb67189e06e59681f1239466bc8594d 100644 (file)
@@ -449,7 +449,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen)
        if (buffer_uptodate(first_bh))
                goto out;
        if (!buffer_locked(first_bh))
-               ll_rw_block(READ_SYNC | REQ_META, 1, &first_bh);
+               ll_rw_block(REQ_OP_READ, READ_SYNC | REQ_META, 1, &first_bh);
 
        dblock++;
        extlen--;
@@ -458,7 +458,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen)
                bh = gfs2_getbuf(gl, dblock, CREATE);
 
                if (!buffer_uptodate(bh) && !buffer_locked(bh))
-                       ll_rw_block(READA | REQ_META, 1, &bh);
+                       ll_rw_block(REQ_OP_READ, READA | REQ_META, 1, &bh);
                brelse(bh);
                dblock++;
                extlen--;
index ce7d69a2fdc03915faf2f27b26168b35bd7527a6..62a68234dfff05a009e5d91d810b103973f67f5e 100644 (file)
@@ -730,7 +730,7 @@ static int gfs2_write_buf_to_page(struct gfs2_inode *ip, unsigned long index,
                if (PageUptodate(page))
                        set_buffer_uptodate(bh);
                if (!buffer_uptodate(bh)) {
-                       ll_rw_block(READ | REQ_META, 1, &bh);
+                       ll_rw_block(REQ_OP_READ, REQ_META, 1, &bh);
                        wait_on_buffer(bh);
                        if (!buffer_uptodate(bh))
                                goto unlock_out;
index 2e4e834d1a9871377137a1735f7f28548b965304..2ce5b75ee9a5b7d3bc14d00d47464632e8d285a7 100644 (file)
@@ -81,7 +81,7 @@ static loff_t zisofs_uncompress_block(struct inode *inode, loff_t block_start,
        blocknum = block_start >> bufshift;
        memset(bhs, 0, (needblocks + 1) * sizeof(struct buffer_head *));
        haveblocks = isofs_get_blocks(inode, blocknum, bhs, needblocks);
-       ll_rw_block(READ, haveblocks, bhs);
+       ll_rw_block(REQ_OP_READ, 0, haveblocks, bhs);
 
        curbh = 0;
        curpage = 0;
index 2606de4fa66167477f3f64f101c73a30f15d791e..34bc99637d5ade2e965055da83072eabdf7f81b2 100644 (file)
@@ -1498,7 +1498,7 @@ static int journal_get_superblock(journal_t *journal)
 
        J_ASSERT(bh != NULL);
        if (!buffer_uptodate(bh)) {
-               ll_rw_block(READ, 1, &bh);
+               ll_rw_block(REQ_OP_READ, 0, 1, &bh);
                wait_on_buffer(bh);
                if (!buffer_uptodate(bh)) {
                        printk(KERN_ERR
index 805bc6bcd8abb0a6484ef1e808be98bbd51a6295..02dd3360cb20cb39eb37b13e0f8eb4627d6ad1a9 100644 (file)
@@ -104,7 +104,7 @@ static int do_readahead(journal_t *journal, unsigned int start)
                if (!buffer_uptodate(bh) && !buffer_locked(bh)) {
                        bufs[nbufs++] = bh;
                        if (nbufs == MAXBUF) {
-                               ll_rw_block(READ, nbufs, bufs);
+                               ll_rw_block(REQ_OP_READ, 0, nbufs, bufs);
                                journal_brelse_array(bufs, nbufs);
                                nbufs = 0;
                        }
@@ -113,7 +113,7 @@ static int do_readahead(journal_t *journal, unsigned int start)
        }
 
        if (nbufs)
-               ll_rw_block(READ, nbufs, bufs);
+               ll_rw_block(REQ_OP_READ, 0, nbufs, bufs);
        err = 0;
 
 failed:
index c034edf3ef38ed8b14b1054cf6e8753a0c77d063..e97a37179614e78427733046de6e837520603d18 100644 (file)
@@ -640,7 +640,7 @@ int ocfs2_map_page_blocks(struct page *page, u64 *p_blkno,
                           !buffer_new(bh) &&
                           ocfs2_should_read_blk(inode, page, block_start) &&
                           (block_start < from || block_end > to)) {
-                       ll_rw_block(READ, 1, &bh);
+                       ll_rw_block(REQ_OP_READ, 0, 1, &bh);
                        *wait_bh++=bh;
                }
 
index d7cae3327de5caab7c23b64c9e68460010b4317f..3971146228d3ee92c9e889a41ca35609c46003b3 100644 (file)
@@ -1819,7 +1819,7 @@ static int ocfs2_get_sector(struct super_block *sb,
        if (!buffer_dirty(*bh))
                clear_buffer_uptodate(*bh);
        unlock_buffer(*bh);
-       ll_rw_block(READ, 1, bh);
+       ll_rw_block(REQ_OP_READ, 0, 1, bh);
        wait_on_buffer(*bh);
        if (!buffer_uptodate(*bh)) {
                mlog_errno(-EIO);
index 6945e719bdab8a618095757704f5cbcfce6849a1..bc2dde2423c2eb3fdb464031d18c22e4586e81cb 100644 (file)
@@ -870,7 +870,7 @@ loop_next:
                 */
                if (buffer_dirty(bh) && unlikely(bh->b_page->mapping == NULL)) {
                        spin_unlock(lock);
-                       ll_rw_block(WRITE, 1, &bh);
+                       ll_rw_block(REQ_OP_WRITE, 0, 1, &bh);
                        spin_lock(lock);
                }
                put_bh(bh);
@@ -1057,7 +1057,7 @@ static int flush_commit_list(struct super_block *s,
                if (tbh) {
                        if (buffer_dirty(tbh)) {
                            depth = reiserfs_write_unlock_nested(s);
-                           ll_rw_block(WRITE, 1, &tbh);
+                           ll_rw_block(REQ_OP_WRITE, 0, 1, &tbh);
                            reiserfs_write_lock_nested(s, depth);
                        }
                        put_bh(tbh) ;
@@ -2244,7 +2244,7 @@ abort_replay:
                }
        }
        /* read in the log blocks, memcpy to the corresponding real block */
-       ll_rw_block(READ, get_desc_trans_len(desc), log_blocks);
+       ll_rw_block(REQ_OP_READ, 0, get_desc_trans_len(desc), log_blocks);
        for (i = 0; i < get_desc_trans_len(desc); i++) {
 
                wait_on_buffer(log_blocks[i]);
@@ -2346,7 +2346,7 @@ static struct buffer_head *reiserfs_breada(struct block_device *dev,
                } else
                        bhlist[j++] = bh;
        }
-       ll_rw_block(READ, j, bhlist);
+       ll_rw_block(REQ_OP_READ, 0, j, bhlist);
        for (i = 1; i < j; i++)
                brelse(bhlist[i]);
        bh = bhlist[0];
index 5feacd689241e25f346756ee2528b4b42b845d42..64b29b592d86e70eb98422db1baebb0d1ace13f6 100644 (file)
@@ -551,7 +551,7 @@ static int search_by_key_reada(struct super_block *s,
                if (!buffer_uptodate(bh[j])) {
                        if (depth == -1)
                                depth = reiserfs_write_unlock_nested(s);
-                       ll_rw_block(READA, 1, bh + j);
+                       ll_rw_block(REQ_OP_READ, READA, 1, bh + j);
                }
                brelse(bh[j]);
        }
@@ -660,7 +660,7 @@ int search_by_key(struct super_block *sb, const struct cpu_key *key,
                        if (!buffer_uptodate(bh) && depth == -1)
                                depth = reiserfs_write_unlock_nested(sb);
 
-                       ll_rw_block(READ, 1, &bh);
+                       ll_rw_block(REQ_OP_READ, 0, 1, &bh);
                        wait_on_buffer(bh);
 
                        if (depth != -1)
index b8f2d1e8c6453c373655be98c03c1118acd71f2c..9938a518c5ef3622b33e4d5912367b4968880038 100644 (file)
@@ -1661,7 +1661,7 @@ static int read_super_block(struct super_block *s, int offset)
 /* after journal replay, reread all bitmap and super blocks */
 static int reread_meta_blocks(struct super_block *s)
 {
-       ll_rw_block(READ, 1, &SB_BUFFER_WITH_SB(s));
+       ll_rw_block(REQ_OP_READ, 0, 1, &SB_BUFFER_WITH_SB(s));
        wait_on_buffer(SB_BUFFER_WITH_SB(s));
        if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) {
                reiserfs_warning(s, "reiserfs-2504", "error reading the super");
index 2c2618410d51b92113fe9a00173078abace498f5..ce62a380314f09e036c9468b73812c4fc872676f 100644 (file)
@@ -124,7 +124,7 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length,
                                goto block_release;
                        bytes += msblk->devblksize;
                }
-               ll_rw_block(READ, b, bh);
+               ll_rw_block(REQ_OP_READ, 0, b, bh);
        } else {
                /*
                 * Metadata block.
@@ -156,7 +156,7 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length,
                                goto block_release;
                        bytes += msblk->devblksize;
                }
-               ll_rw_block(READ, b - 1, bh + 1);
+               ll_rw_block(REQ_OP_READ, 0, b - 1, bh + 1);
        }
 
        for (i = 0; i < b; i++) {
index 4c5593abc553e6113a3c423a877f9565a73b8635..80c8a21daed917f445fa10aced32c602cd2b401e 100644 (file)
@@ -113,7 +113,7 @@ static int udf_readdir(struct file *file, struct dir_context *ctx)
                                        brelse(tmp);
                        }
                        if (num) {
-                               ll_rw_block(READA, num, bha);
+                               ll_rw_block(REQ_OP_READ, READA, num, bha);
                                for (i = 0; i < num; i++)
                                        brelse(bha[i]);
                        }
index c763fda257bf371ad04a5b4b5aff0a1269a9366e..71f3e0b5b8ab8be8eaecd91bb0d374f002b41b8a 100644 (file)
@@ -87,7 +87,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
                                        brelse(tmp);
                        }
                        if (num) {
-                               ll_rw_block(READA, num, bha);
+                               ll_rw_block(REQ_OP_READ, READA, num, bha);
                                for (i = 0; i < num; i++)
                                        brelse(bha[i]);
                        }
index f323aff740effceb669c04c42dfe53b2b326e8f1..55aa587bbc385f162e71536b35d5e826808f3a8b 100644 (file)
@@ -1199,7 +1199,7 @@ struct buffer_head *udf_bread(struct inode *inode, int block,
        if (buffer_uptodate(bh))
                return bh;
 
-       ll_rw_block(READ, 1, &bh);
+       ll_rw_block(REQ_OP_READ, 0, 1, &bh);
 
        wait_on_buffer(bh);
        if (buffer_uptodate(bh))
index 0447b949c7f5c65555603dced6de8cfac84eba4a..67e085d591d8398aaf07ab0102e602b70ca9ae8e 100644 (file)
@@ -292,7 +292,7 @@ static void ufs_change_blocknr(struct inode *inode, sector_t beg,
                        if (!buffer_mapped(bh))
                                        map_bh(bh, inode->i_sb, oldb + pos);
                        if (!buffer_uptodate(bh)) {
-                               ll_rw_block(READ, 1, &bh);
+                               ll_rw_block(REQ_OP_READ, 0, 1, &bh);
                                wait_on_buffer(bh);
                                if (!buffer_uptodate(bh)) {
                                        ufs_error(inode->i_sb, __func__,
index bc9a45d1e3afe2822cc5e2d57fbbb0eaa31703c3..d1dd29338ba0bfdbce24679fceddbcad01240b3d 100644 (file)
@@ -187,7 +187,7 @@ struct buffer_head *alloc_buffer_head(gfp_t gfp_flags);
 void free_buffer_head(struct buffer_head * bh);
 void unlock_buffer(struct buffer_head *bh);
 void __lock_buffer(struct buffer_head *bh);
-void ll_rw_block(int, int, struct buffer_head * bh[]);
+void ll_rw_block(int, int, int, struct buffer_head * bh[]);
 int sync_dirty_buffer(struct buffer_head *bh);
 int __sync_dirty_buffer(struct buffer_head *bh, int op_flags);
 void write_dirty_buffer(struct buffer_head *bh, int op_flags);