block: convert to bio_first_bvec_all & bio_first_page_all
authorMing Lei <ming.lei@redhat.com>
Mon, 18 Dec 2017 12:22:04 +0000 (20:22 +0800)
committerJens Axboe <axboe@kernel.dk>
Sat, 6 Jan 2018 16:18:00 +0000 (09:18 -0700)
This patch converts to bio_first_bvec_all() & bio_first_page_all() for
retrieving the 1st bvec/page, and prepares for supporting multipage bvec.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/drbd/drbd_bitmap.c
drivers/block/zram/zram_drv.c
drivers/md/bcache/super.c
fs/btrfs/compression.c
fs/btrfs/inode.c
fs/f2fs/data.c
kernel/power/swap.c
mm/page_io.c

index bd97908c766f5c998e76f54662a270a17972d7d3..9f4e6f502b8460e88fb3a2fb1df2cac31f5edaf8 100644 (file)
@@ -953,7 +953,7 @@ static void drbd_bm_endio(struct bio *bio)
        struct drbd_bm_aio_ctx *ctx = bio->bi_private;
        struct drbd_device *device = ctx->device;
        struct drbd_bitmap *b = device->bitmap;
-       unsigned int idx = bm_page_to_idx(bio->bi_io_vec[0].bv_page);
+       unsigned int idx = bm_page_to_idx(bio_first_page_all(bio));
 
        if ((ctx->flags & BM_AIO_COPY_PAGES) == 0 &&
            !bm_test_page_unchanged(b->bm_pages[idx]))
index d70eba30003a57e95ab782475827fba18a6f65e8..0afa6c8c3857418c72f754fc817da8d61af09670 100644 (file)
@@ -430,7 +430,7 @@ static void put_entry_bdev(struct zram *zram, unsigned long entry)
 
 static void zram_page_end_io(struct bio *bio)
 {
-       struct page *page = bio->bi_io_vec[0].bv_page;
+       struct page *page = bio_first_page_all(bio);
 
        page_endio(page, op_is_write(bio_op(bio)),
                        blk_status_to_errno(bio->bi_status));
index b4d28928dec59ac0fa5c531abe8ca3339d82c34b..8399fe0651f22310281da125f58ac3ba122b90e0 100644 (file)
@@ -211,7 +211,7 @@ static void write_bdev_super_endio(struct bio *bio)
 
 static void __write_super(struct cache_sb *sb, struct bio *bio)
 {
-       struct cache_sb *out = page_address(bio->bi_io_vec[0].bv_page);
+       struct cache_sb *out = page_address(bio_first_page_all(bio));
        unsigned i;
 
        bio->bi_iter.bi_sector  = SB_SECTOR;
@@ -1166,7 +1166,7 @@ static void register_bdev(struct cache_sb *sb, struct page *sb_page,
        dc->bdev->bd_holder = dc;
 
        bio_init(&dc->sb_bio, dc->sb_bio.bi_inline_vecs, 1);
-       dc->sb_bio.bi_io_vec[0].bv_page = sb_page;
+       bio_first_bvec_all(&dc->sb_bio)->bv_page = sb_page;
        get_page(sb_page);
 
        if (cached_dev_init(dc, sb->block_size << 9))
@@ -1810,7 +1810,7 @@ void bch_cache_release(struct kobject *kobj)
                free_fifo(&ca->free[i]);
 
        if (ca->sb_bio.bi_inline_vecs[0].bv_page)
-               put_page(ca->sb_bio.bi_io_vec[0].bv_page);
+               put_page(bio_first_page_all(&ca->sb_bio));
 
        if (!IS_ERR_OR_NULL(ca->bdev))
                blkdev_put(ca->bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
@@ -1864,7 +1864,7 @@ static int register_cache(struct cache_sb *sb, struct page *sb_page,
        ca->bdev->bd_holder = ca;
 
        bio_init(&ca->sb_bio, ca->sb_bio.bi_inline_vecs, 1);
-       ca->sb_bio.bi_io_vec[0].bv_page = sb_page;
+       bio_first_bvec_all(&ca->sb_bio)->bv_page = sb_page;
        get_page(sb_page);
 
        if (blk_queue_discard(bdev_get_queue(ca->bdev)))
index 5982c8a71f02fde26b84fc54067dd075a993f8e6..38a6b091bc25c35e7956bd6022cd423a3eebde29 100644 (file)
@@ -563,7 +563,7 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
        /* we need the actual starting offset of this extent in the file */
        read_lock(&em_tree->lock);
        em = lookup_extent_mapping(em_tree,
-                                  page_offset(bio->bi_io_vec->bv_page),
+                                  page_offset(bio_first_page_all(bio)),
                                   PAGE_SIZE);
        read_unlock(&em_tree->lock);
        if (!em)
index e1a7f3cb5be940561af3ec855b6657c3fce7c850..4d5cb6e93c802dd7042e6ec6205abb516bedd392 100644 (file)
@@ -8074,7 +8074,7 @@ static void btrfs_retry_endio_nocsum(struct bio *bio)
        ASSERT(bio->bi_vcnt == 1);
        io_tree = &BTRFS_I(inode)->io_tree;
        failure_tree = &BTRFS_I(inode)->io_failure_tree;
-       ASSERT(bio->bi_io_vec->bv_len == btrfs_inode_sectorsize(inode));
+       ASSERT(bio_first_bvec_all(bio)->bv_len == btrfs_inode_sectorsize(inode));
 
        done->uptodate = 1;
        ASSERT(!bio_flagged(bio, BIO_CLONED));
@@ -8164,7 +8164,7 @@ static void btrfs_retry_endio(struct bio *bio)
        uptodate = 1;
 
        ASSERT(bio->bi_vcnt == 1);
-       ASSERT(bio->bi_io_vec->bv_len == btrfs_inode_sectorsize(done->inode));
+       ASSERT(bio_first_bvec_all(bio)->bv_len == btrfs_inode_sectorsize(done->inode));
 
        io_tree = &BTRFS_I(inode)->io_tree;
        failure_tree = &BTRFS_I(inode)->io_failure_tree;
index 516fa0d3ff9c944c9d2c49d93dde87b8f1ea8be0..455f086cce3dba0db35ff24860996d7cb44ff8cb 100644 (file)
@@ -56,7 +56,7 @@ static void f2fs_read_end_io(struct bio *bio)
        int i;
 
 #ifdef CONFIG_F2FS_FAULT_INJECTION
-       if (time_to_inject(F2FS_P_SB(bio->bi_io_vec->bv_page), FAULT_IO)) {
+       if (time_to_inject(F2FS_P_SB(bio_first_page_all(bio)), FAULT_IO)) {
                f2fs_show_injection_info(FAULT_IO);
                bio->bi_status = BLK_STS_IOERR;
        }
index 293ead59ecccbab5c3013be15d5f4cbfbef2315f..96c736313faab8e536257fc191a800753166a7c2 100644 (file)
@@ -240,7 +240,7 @@ static void hib_init_batch(struct hib_bio_batch *hb)
 static void hib_end_io(struct bio *bio)
 {
        struct hib_bio_batch *hb = bio->bi_private;
-       struct page *page = bio->bi_io_vec[0].bv_page;
+       struct page *page = bio_first_page_all(bio);
 
        if (bio->bi_status) {
                pr_alert("Read-error on swap-device (%u:%u:%Lu)\n",
index e93f1a4cacd7cc52be1dda4d2c380f3246a630b3..b41cf96445856e480f872b33b81855b86551488c 100644 (file)
@@ -50,7 +50,7 @@ static struct bio *get_swap_bio(gfp_t gfp_flags,
 
 void end_swap_bio_write(struct bio *bio)
 {
-       struct page *page = bio->bi_io_vec[0].bv_page;
+       struct page *page = bio_first_page_all(bio);
 
        if (bio->bi_status) {
                SetPageError(page);
@@ -122,7 +122,7 @@ static void swap_slot_free_notify(struct page *page)
 
 static void end_swap_bio_read(struct bio *bio)
 {
-       struct page *page = bio->bi_io_vec[0].bv_page;
+       struct page *page = bio_first_page_all(bio);
        struct task_struct *waiter = bio->bi_private;
 
        if (bio->bi_status) {