block: remove the i argument to bio_for_each_segment_all
authorChristoph Hellwig <hch@lst.de>
Thu, 25 Apr 2019 07:03:00 +0000 (09:03 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 30 Apr 2019 15:26:13 +0000 (09:26 -0600)
We only have two callers that need the integer loop iterator, and they
can easily maintain it themselves.

Suggested-by: Matthew Wilcox <willy@infradead.org>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: David Sterba <dsterba@suse.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Coly Li <colyli@suse.de>
Reviewed-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
24 files changed:
block/bio.c
block/bounce.c
drivers/md/bcache/btree.c
drivers/md/dm-crypt.c
drivers/md/raid1.c
drivers/staging/erofs/data.c
drivers/staging/erofs/unzip_vle.c
fs/block_dev.c
fs/btrfs/compression.c
fs/btrfs/disk-io.c
fs/btrfs/extent_io.c
fs/btrfs/inode.c
fs/btrfs/raid56.c
fs/crypto/bio.c
fs/direct-io.c
fs/ext4/page-io.c
fs/ext4/readpage.c
fs/f2fs/data.c
fs/gfs2/lops.c
fs/gfs2/meta_io.c
fs/iomap.c
fs/mpage.c
fs/xfs/xfs_aops.c
include/linux/bio.h

index 662d45752ec53505a787cff4e9e97d2bf0a808dc..9ad0d00cdc9b8f52d9432fafb1bddf11dc075cb6 100644 (file)
@@ -874,9 +874,8 @@ static void bio_get_pages(struct bio *bio)
 {
        struct bvec_iter_all iter_all;
        struct bio_vec *bvec;
-       int i;
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all)
+       bio_for_each_segment_all(bvec, bio, iter_all)
                get_page(bvec->bv_page);
 }
 
@@ -884,9 +883,8 @@ static void bio_release_pages(struct bio *bio)
 {
        struct bvec_iter_all iter_all;
        struct bio_vec *bvec;
-       int i;
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all)
+       bio_for_each_segment_all(bvec, bio, iter_all)
                put_page(bvec->bv_page);
 }
 
@@ -1166,11 +1164,10 @@ static struct bio_map_data *bio_alloc_map_data(struct iov_iter *data,
  */
 static int bio_copy_from_iter(struct bio *bio, struct iov_iter *iter)
 {
-       int i;
        struct bio_vec *bvec;
        struct bvec_iter_all iter_all;
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                ssize_t ret;
 
                ret = copy_page_from_iter(bvec->bv_page,
@@ -1198,11 +1195,10 @@ static int bio_copy_from_iter(struct bio *bio, struct iov_iter *iter)
  */
 static int bio_copy_to_iter(struct bio *bio, struct iov_iter iter)
 {
-       int i;
        struct bio_vec *bvec;
        struct bvec_iter_all iter_all;
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                ssize_t ret;
 
                ret = copy_page_to_iter(bvec->bv_page,
@@ -1223,10 +1219,9 @@ static int bio_copy_to_iter(struct bio *bio, struct iov_iter iter)
 void bio_free_pages(struct bio *bio)
 {
        struct bio_vec *bvec;
-       int i;
        struct bvec_iter_all iter_all;
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all)
+       bio_for_each_segment_all(bvec, bio, iter_all)
                __free_page(bvec->bv_page);
 }
 EXPORT_SYMBOL(bio_free_pages);
@@ -1464,7 +1459,7 @@ struct bio *bio_map_user_iov(struct request_queue *q,
        return bio;
 
  out_unmap:
-       bio_for_each_segment_all(bvec, bio, j, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                put_page(bvec->bv_page);
        }
        bio_put(bio);
@@ -1474,13 +1469,12 @@ struct bio *bio_map_user_iov(struct request_queue *q,
 static void __bio_unmap_user(struct bio *bio)
 {
        struct bio_vec *bvec;
-       int i;
        struct bvec_iter_all iter_all;
 
        /*
         * make sure we dirty pages we wrote to
         */
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                if (bio_data_dir(bio) == READ)
                        set_page_dirty_lock(bvec->bv_page);
 
@@ -1571,10 +1565,9 @@ static void bio_copy_kern_endio_read(struct bio *bio)
 {
        char *p = bio->bi_private;
        struct bio_vec *bvec;
-       int i;
        struct bvec_iter_all iter_all;
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                memcpy(p, page_address(bvec->bv_page), bvec->bv_len);
                p += bvec->bv_len;
        }
@@ -1682,10 +1675,9 @@ cleanup:
 void bio_set_pages_dirty(struct bio *bio)
 {
        struct bio_vec *bvec;
-       int i;
        struct bvec_iter_all iter_all;
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                if (!PageCompound(bvec->bv_page))
                        set_page_dirty_lock(bvec->bv_page);
        }
@@ -1734,10 +1726,9 @@ void bio_check_pages_dirty(struct bio *bio)
 {
        struct bio_vec *bvec;
        unsigned long flags;
-       int i;
        struct bvec_iter_all iter_all;
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                if (!PageDirty(bvec->bv_page) && !PageCompound(bvec->bv_page))
                        goto defer;
        }
index 47eb7e936e22715cea56e9ec6d0c7cd84f8b35ee..f8ed677a1bf7ed3aed23f3edbd68dc2d61cf8e7c 100644 (file)
@@ -163,14 +163,13 @@ static void bounce_end_io(struct bio *bio, mempool_t *pool)
 {
        struct bio *bio_orig = bio->bi_private;
        struct bio_vec *bvec, orig_vec;
-       int i;
        struct bvec_iter orig_iter = bio_orig->bi_iter;
        struct bvec_iter_all iter_all;
 
        /*
         * free up bounce indirect pages used
         */
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                orig_vec = bio_iter_iovec(bio_orig, orig_iter);
                if (bvec->bv_page != orig_vec.bv_page) {
                        dec_zone_page_state(bvec->bv_page, NR_BOUNCE);
index 3a9f8ed437de8fab959f3b4c9645da3028b2d055..773f5fdad25fb4db72a132fa161dba76fde52129 100644 (file)
@@ -429,12 +429,11 @@ static void do_btree_node_write(struct btree *b)
                       bset_sector_offset(&b->keys, i));
 
        if (!bch_bio_alloc_pages(b->bio, __GFP_NOWARN|GFP_NOWAIT)) {
-               int j;
                struct bio_vec *bv;
                void *addr = (void *) ((unsigned long) i & ~(PAGE_SIZE - 1));
                struct bvec_iter_all iter_all;
 
-               bio_for_each_segment_all(bv, b->bio, j, iter_all) {
+               bio_for_each_segment_all(bv, b->bio, iter_all) {
                        memcpy(page_address(bv->bv_page), addr, PAGE_SIZE);
                        addr += PAGE_SIZE;
                }
index dd6565798778055f3a519c12a716f417631f8f9d..cca68546945bb6207163ac8f365f24360289abdf 100644 (file)
@@ -1445,11 +1445,10 @@ out:
 
 static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone)
 {
-       unsigned int i;
        struct bio_vec *bv;
        struct bvec_iter_all iter_all;
 
-       bio_for_each_segment_all(bv, clone, i, iter_all) {
+       bio_for_each_segment_all(bv, clone, iter_all) {
                BUG_ON(!bv->bv_page);
                mempool_free(bv->bv_page, &cc->page_pool);
        }
index fdf451aac369041c6fccccfca4da74d121862025..0c8a098d220e199e6966ea8d255fa334f155c956 100644 (file)
@@ -2110,7 +2110,7 @@ static void process_checks(struct r1bio *r1_bio)
                }
        r1_bio->read_disk = primary;
        for (i = 0; i < conf->raid_disks * 2; i++) {
-               int j;
+               int j = 0;
                struct bio *pbio = r1_bio->bios[primary];
                struct bio *sbio = r1_bio->bios[i];
                blk_status_t status = sbio->bi_status;
@@ -2125,8 +2125,8 @@ static void process_checks(struct r1bio *r1_bio)
                /* Now we can 'fixup' the error value */
                sbio->bi_status = 0;
 
-               bio_for_each_segment_all(bi, sbio, j, iter_all)
-                       page_len[j] = bi->bv_len;
+               bio_for_each_segment_all(bi, sbio, iter_all)
+                       page_len[j++] = bi->bv_len;
 
                if (!status) {
                        for (j = vcnt; j-- ; ) {
index 81af768e7248e514699541552e2eb2cd99e1bc5e..9f04d7466c555b9e29ef24a21e27cb84472ba8dd 100644 (file)
 
 static inline void read_endio(struct bio *bio)
 {
-       int i;
        struct bio_vec *bvec;
        const blk_status_t err = bio->bi_status;
        struct bvec_iter_all iter_all;
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                struct page *page = bvec->bv_page;
 
                /* page is already locked */
index 31eef839577436709b1a5261507aff59bcf821d7..59b9f37d5c00704baf67b9525805ed739c18f6f4 100644 (file)
@@ -844,14 +844,13 @@ static void z_erofs_vle_unzip_kickoff(void *ptr, int bios)
 static inline void z_erofs_vle_read_endio(struct bio *bio)
 {
        const blk_status_t err = bio->bi_status;
-       unsigned int i;
        struct bio_vec *bvec;
 #ifdef EROFS_FS_HAS_MANAGED_CACHE
        struct address_space *mc = NULL;
 #endif
        struct bvec_iter_all iter_all;
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                struct page *page = bvec->bv_page;
                bool cachemngd = false;
 
index 24615c76c1d0e20739db509d3ddde0e111994e2b..8abc6570d29f27087e0a842529a47787c6d72f90 100644 (file)
@@ -210,7 +210,6 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
        struct bio bio;
        ssize_t ret;
        blk_qc_t qc;
-       int i;
        struct bvec_iter_all iter_all;
 
        if ((pos | iov_iter_alignment(iter)) &
@@ -261,7 +260,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
        }
        __set_current_state(TASK_RUNNING);
 
-       bio_for_each_segment_all(bvec, &bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, &bio, iter_all) {
                if (should_dirty && !PageCompound(bvec->bv_page))
                        set_page_dirty_lock(bvec->bv_page);
                put_page(bvec->bv_page);
@@ -339,9 +338,8 @@ static void blkdev_bio_end_io(struct bio *bio)
                if (!bio_flagged(bio, BIO_NO_PAGE_REF)) {
                        struct bvec_iter_all iter_all;
                        struct bio_vec *bvec;
-                       int i;
 
-                       bio_for_each_segment_all(bvec, bio, i, iter_all)
+                       bio_for_each_segment_all(bvec, bio, iter_all)
                                put_page(bvec->bv_page);
                }
                bio_put(bio);
index 4f2a8ae0aa421f35fc5fc5ea97e598273ffc10ba..6313dc65209e91e920ca35224ea766e7e398bd2f 100644 (file)
@@ -160,7 +160,6 @@ csum_failed:
        if (cb->errors) {
                bio_io_error(cb->orig_bio);
        } else {
-               int i;
                struct bio_vec *bvec;
                struct bvec_iter_all iter_all;
 
@@ -169,7 +168,7 @@ csum_failed:
                 * checked so the end_io handlers know about it
                 */
                ASSERT(!bio_flagged(bio, BIO_CLONED));
-               bio_for_each_segment_all(bvec, cb->orig_bio, i, iter_all)
+               bio_for_each_segment_all(bvec, cb->orig_bio, iter_all)
                        SetPageChecked(bvec->bv_page);
 
                bio_endio(cb->orig_bio);
index 6fe9197f6ee44c54a726435da5a83ac4a7490ac1..c333e79408fffa51f12ef511274d7eef0946ed1a 100644 (file)
@@ -832,11 +832,11 @@ static blk_status_t btree_csum_one_bio(struct bio *bio)
 {
        struct bio_vec *bvec;
        struct btrfs_root *root;
-       int i, ret = 0;
+       int ret = 0;
        struct bvec_iter_all iter_all;
 
        ASSERT(!bio_flagged(bio, BIO_CLONED));
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                root = BTRFS_I(bvec->bv_page->mapping->host)->root;
                ret = csum_dirty_buffer(root->fs_info, bvec->bv_page);
                if (ret)
index ca8b8e785cf3a17f963449058210d1f0ff4cfd0d..c85505c36fa6e91ffddf9c158dfd6e50992444c9 100644 (file)
@@ -2451,11 +2451,10 @@ static void end_bio_extent_writepage(struct bio *bio)
        struct bio_vec *bvec;
        u64 start;
        u64 end;
-       int i;
        struct bvec_iter_all iter_all;
 
        ASSERT(!bio_flagged(bio, BIO_CLONED));
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                struct page *page = bvec->bv_page;
                struct inode *inode = page->mapping->host;
                struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
@@ -2523,11 +2522,10 @@ static void end_bio_extent_readpage(struct bio *bio)
        u64 extent_len = 0;
        int mirror;
        int ret;
-       int i;
        struct bvec_iter_all iter_all;
 
        ASSERT(!bio_flagged(bio, BIO_CLONED));
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                struct page *page = bvec->bv_page;
                struct inode *inode = page->mapping->host;
                struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
@@ -3643,11 +3641,11 @@ static void end_bio_extent_buffer_writepage(struct bio *bio)
 {
        struct bio_vec *bvec;
        struct extent_buffer *eb;
-       int i, done;
+       int done;
        struct bvec_iter_all iter_all;
 
        ASSERT(!bio_flagged(bio, BIO_CLONED));
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                struct page *page = bvec->bv_page;
 
                eb = (struct extent_buffer *)page->private;
index 82fdda8ff5ab82b5298c4b72859e697d8bd1a3d5..10a8d08d3d293a39602afbac42a493f28dd7813b 100644 (file)
@@ -7828,7 +7828,6 @@ static void btrfs_retry_endio_nocsum(struct bio *bio)
        struct inode *inode = done->inode;
        struct bio_vec *bvec;
        struct extent_io_tree *io_tree, *failure_tree;
-       int i;
        struct bvec_iter_all iter_all;
 
        if (bio->bi_status)
@@ -7841,7 +7840,7 @@ static void btrfs_retry_endio_nocsum(struct bio *bio)
 
        done->uptodate = 1;
        ASSERT(!bio_flagged(bio, BIO_CLONED));
-       bio_for_each_segment_all(bvec, bio, i, iter_all)
+       bio_for_each_segment_all(bvec, bio, iter_all)
                clean_io_failure(BTRFS_I(inode)->root->fs_info, failure_tree,
                                 io_tree, done->start, bvec->bv_page,
                                 btrfs_ino(BTRFS_I(inode)), 0);
@@ -7919,7 +7918,7 @@ static void btrfs_retry_endio(struct bio *bio)
        struct bio_vec *bvec;
        int uptodate;
        int ret;
-       int i;
+       int i = 0;
        struct bvec_iter_all iter_all;
 
        if (bio->bi_status)
@@ -7934,7 +7933,7 @@ static void btrfs_retry_endio(struct bio *bio)
        failure_tree = &BTRFS_I(inode)->io_failure_tree;
 
        ASSERT(!bio_flagged(bio, BIO_CLONED));
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                ret = __readpage_endio_check(inode, io_bio, i, bvec->bv_page,
                                             bvec->bv_offset, done->start,
                                             bvec->bv_len);
@@ -7946,6 +7945,7 @@ static void btrfs_retry_endio(struct bio *bio)
                                         bvec->bv_offset);
                else
                        uptodate = 0;
+               i++;
        }
 
        done->uptodate = uptodate;
index 67a6f7d4740230aaa24b1ecad5e91ec5b94b5f70..f3d0576dd327c4850acdb280455e338295d8df63 100644 (file)
@@ -1442,12 +1442,11 @@ static int fail_bio_stripe(struct btrfs_raid_bio *rbio,
 static void set_bio_pages_uptodate(struct bio *bio)
 {
        struct bio_vec *bvec;
-       int i;
        struct bvec_iter_all iter_all;
 
        ASSERT(!bio_flagged(bio, BIO_CLONED));
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all)
+       bio_for_each_segment_all(bvec, bio, iter_all)
                SetPageUptodate(bvec->bv_page);
 }
 
index 5759bcd018cd3402686266afbd0a8d37fb2817f8..8f3a8bc15d984968dad6ca7176bbca58e41ba2ee 100644 (file)
 static void __fscrypt_decrypt_bio(struct bio *bio, bool done)
 {
        struct bio_vec *bv;
-       int i;
        struct bvec_iter_all iter_all;
 
-       bio_for_each_segment_all(bv, bio, i, iter_all) {
+       bio_for_each_segment_all(bv, bio, iter_all) {
                struct page *page = bv->bv_page;
                int ret = fscrypt_decrypt_page(page->mapping->host, page,
                                PAGE_SIZE, 0, page->index);
index 9bb015bc4a83676be822ca5bf46462ed8dafb047..fbe885d68035e6b1a2410cab66f098915c1ee9c4 100644 (file)
@@ -538,7 +538,6 @@ static struct bio *dio_await_one(struct dio *dio)
 static blk_status_t dio_bio_complete(struct dio *dio, struct bio *bio)
 {
        struct bio_vec *bvec;
-       unsigned i;
        blk_status_t err = bio->bi_status;
 
        if (err) {
@@ -553,7 +552,7 @@ static blk_status_t dio_bio_complete(struct dio *dio, struct bio *bio)
        } else {
                struct bvec_iter_all iter_all;
 
-               bio_for_each_segment_all(bvec, bio, i, iter_all) {
+               bio_for_each_segment_all(bvec, bio, iter_all) {
                        struct page *page = bvec->bv_page;
 
                        if (dio->op == REQ_OP_READ && !PageCompound(page) &&
index 3e9298e6a705a00b80475fdaf173f58a1177ea85..4690618a92e93f133ba3c176b4757a9976805b32 100644 (file)
@@ -61,11 +61,10 @@ static void buffer_io_error(struct buffer_head *bh)
 
 static void ext4_finish_bio(struct bio *bio)
 {
-       int i;
        struct bio_vec *bvec;
        struct bvec_iter_all iter_all;
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                struct page *page = bvec->bv_page;
 #ifdef CONFIG_FS_ENCRYPTION
                struct page *data_page = NULL;
index 3adadf4618253c69fe5fcd50ffb3628027a079f9..3629a74b7f947bd68ac695456df877f95882b732 100644 (file)
@@ -71,7 +71,6 @@ static inline bool ext4_bio_encrypted(struct bio *bio)
 static void mpage_end_io(struct bio *bio)
 {
        struct bio_vec *bv;
-       int i;
        struct bvec_iter_all iter_all;
 
        if (ext4_bio_encrypted(bio)) {
@@ -82,7 +81,7 @@ static void mpage_end_io(struct bio *bio)
                        return;
                }
        }
-       bio_for_each_segment_all(bv, bio, i, iter_all) {
+       bio_for_each_segment_all(bv, bio, iter_all) {
                struct page *page = bv->bv_page;
 
                if (!bio->bi_status) {
index 9727944139f210b767b9ca280751f7acb3810dfd..64040e99843942a5f083bddd671556974795284d 100644 (file)
@@ -86,10 +86,9 @@ static void __read_end_io(struct bio *bio)
 {
        struct page *page;
        struct bio_vec *bv;
-       int i;
        struct bvec_iter_all iter_all;
 
-       bio_for_each_segment_all(bv, bio, i, iter_all) {
+       bio_for_each_segment_all(bv, bio, iter_all) {
                page = bv->bv_page;
 
                /* PG_error was set if any post_read step failed */
@@ -164,7 +163,6 @@ static void f2fs_write_end_io(struct bio *bio)
 {
        struct f2fs_sb_info *sbi = bio->bi_private;
        struct bio_vec *bvec;
-       int i;
        struct bvec_iter_all iter_all;
 
        if (time_to_inject(sbi, FAULT_WRITE_IO)) {
@@ -172,7 +170,7 @@ static void f2fs_write_end_io(struct bio *bio)
                bio->bi_status = BLK_STS_IOERR;
        }
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                struct page *page = bvec->bv_page;
                enum count_type type = WB_DATA_TYPE(page);
 
@@ -349,7 +347,6 @@ static bool __has_merged_page(struct f2fs_bio_info *io, struct inode *inode,
 {
        struct bio_vec *bvec;
        struct page *target;
-       int i;
        struct bvec_iter_all iter_all;
 
        if (!io->bio)
@@ -358,7 +355,7 @@ static bool __has_merged_page(struct f2fs_bio_info *io, struct inode *inode,
        if (!inode && !page && !ino)
                return true;
 
-       bio_for_each_segment_all(bvec, io->bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, io->bio, iter_all) {
 
                if (bvec->bv_page->mapping)
                        target = bvec->bv_page;
index 8722c60b11feb478fe4dbf560f8afcdcda4e2dac..6f09b5e3dd6e4ec344c07f87297344bad8233c13 100644 (file)
@@ -207,7 +207,6 @@ static void gfs2_end_log_write(struct bio *bio)
        struct gfs2_sbd *sdp = bio->bi_private;
        struct bio_vec *bvec;
        struct page *page;
-       int i;
        struct bvec_iter_all iter_all;
 
        if (bio->bi_status) {
@@ -216,7 +215,7 @@ static void gfs2_end_log_write(struct bio *bio)
                wake_up(&sdp->sd_logd_waitq);
        }
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                page = bvec->bv_page;
                if (page_has_buffers(page))
                        gfs2_end_log_write_bh(sdp, bvec, bio->bi_status);
index 3201342404a7785b5dc16429d7b2abe37e30b905..ff86e1d4f8ffa619d20829a2407b83a33ca45795 100644 (file)
@@ -189,10 +189,9 @@ struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno)
 static void gfs2_meta_read_endio(struct bio *bio)
 {
        struct bio_vec *bvec;
-       int i;
        struct bvec_iter_all iter_all;
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all) {
+       bio_for_each_segment_all(bvec, bio, iter_all) {
                struct page *page = bvec->bv_page;
                struct buffer_head *bh = page_buffers(page);
                unsigned int len = bvec->bv_len;
index abdd18e404f8cdd4f85d4e014af1d4a5edf8bbd2..12a656271076fea5fff03a0f6a5a7104d6f56499 100644 (file)
@@ -273,10 +273,9 @@ iomap_read_end_io(struct bio *bio)
 {
        int error = blk_status_to_errno(bio->bi_status);
        struct bio_vec *bvec;
-       int i;
        struct bvec_iter_all iter_all;
 
-       bio_for_each_segment_all(bvec, bio, i, iter_all)
+       bio_for_each_segment_all(bvec, bio, iter_all)
                iomap_read_page_end_io(bvec, error);
        bio_put(bio);
 }
@@ -1592,9 +1591,8 @@ static void iomap_dio_bio_end_io(struct bio *bio)
                if (!bio_flagged(bio, BIO_NO_PAGE_REF)) {
                        struct bvec_iter_all iter_all;
                        struct bio_vec *bvec;
-                       int i;
 
-                       bio_for_each_segment_all(bvec, bio, i, iter_all)
+                       bio_for_each_segment_all(bvec, bio, iter_all)
                                put_page(bvec->bv_page);
                }
                bio_put(bio);
index 3f19da75178be4eba8d68f2537a10bbc5e63f175..436a85260394d283e17242cb9b501ab7c64f0b1c 100644 (file)
 static void mpage_end_io(struct bio *bio)
 {
        struct bio_vec *bv;
-       int i;
        struct bvec_iter_all iter_all;
 
-       bio_for_each_segment_all(bv, bio, i, iter_all) {
+       bio_for_each_segment_all(bv, bio, iter_all) {
                struct page *page = bv->bv_page;
                page_endio(page, bio_op(bio),
                           blk_status_to_errno(bio->bi_status));
index 3619e9e8d359e839b8ac88b633a52eedff360301..47941bbaac02a5e1dee944822df327f378fef579 100644 (file)
@@ -98,7 +98,6 @@ xfs_destroy_ioend(
 
        for (bio = &ioend->io_inline_bio; bio; bio = next) {
                struct bio_vec  *bvec;
-               int             i;
                struct bvec_iter_all iter_all;
 
                /*
@@ -111,7 +110,7 @@ xfs_destroy_ioend(
                        next = bio->bi_private;
 
                /* walk each page on bio, ending page IO on them */
-               bio_for_each_segment_all(bvec, bio, i, iter_all)
+               bio_for_each_segment_all(bvec, bio, iter_all)
                        xfs_finish_page_writeback(inode, bvec, error);
                bio_put(bio);
        }
index 9577ad8f6e2824c74f6551b9f7d2f7002e11c8d1..186b2723c61b12c93c98ca15e75d1000366572f8 100644 (file)
@@ -134,9 +134,8 @@ static inline bool bio_next_segment(const struct bio *bio,
  * drivers should _never_ use the all version - the bio may have been split
  * before it got to the driver and the driver won't own all of it
  */
-#define bio_for_each_segment_all(bvl, bio, i, iter)                    \
-       for (i = 0, bvl = bvec_init_iter_all(&iter);                    \
-            bio_next_segment((bio), &iter); i++)
+#define bio_for_each_segment_all(bvl, bio, iter) \
+       for (bvl = bvec_init_iter_all(&iter); bio_next_segment((bio), &iter); )
 
 static inline void bio_advance_iter(struct bio *bio, struct bvec_iter *iter,
                                    unsigned bytes)