diff --git a/block/bio.c b/block/bio.c index f8e6a52a6db066..6f34a71eab4a2b 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1661,16 +1661,16 @@ static void bio_dirty_fn(struct work_struct *work) void bio_check_pages_dirty(struct bio *bio) { - struct bio_vec *bvec; + struct bio_vec bvec; + struct bvec_iter iter; int nr_clean_pages = 0; - int i; - bio_for_each_segment_all(bvec, bio, i) { - struct page *page = bvec->bv_page; + bio_for_each_page_all(bvec, bio, iter) { + struct page *page = bvec.bv_page; if (PageDirty(page) || PageCompound(page)) { page_cache_release(page); - bvec->bv_page = NULL; + bvec.bv_page = NULL; } else { nr_clean_pages++; } diff --git a/fs/direct-io.c b/fs/direct-io.c index e181b6b2e297fb..3d53d7d485f964 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -457,8 +457,8 @@ static struct bio *dio_await_one(struct dio *dio) static int dio_bio_complete(struct dio *dio, struct bio *bio) { const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); - struct bio_vec *bvec; - unsigned i; + struct bio_vec bvec; + struct bvec_iter iter; if (!uptodate) dio->io_error = -EIO; @@ -466,8 +466,8 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio) if (dio->is_async && dio->rw == READ) { bio_check_pages_dirty(bio); /* transfers ownership */ } else { - bio_for_each_segment_all(bvec, bio, i) { - struct page *page = bvec->bv_page; + bio_for_each_page_all(bvec, bio, iter) { + struct page *page = bvec.bv_page; if (dio->rw == READ && !PageCompound(page)) set_page_dirty_lock(page);