Use bio_release_pages and bio_set_pages_dirty instead of open coding them. Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- fs/direct-io.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/fs/direct-io.c b/fs/direct-io.c index fbe885d68035..62d0594a4622 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -537,7 +537,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; blk_status_t err = bio->bi_status; if (err) { @@ -550,17 +549,9 @@ static blk_status_t dio_bio_complete(struct dio *dio, struct bio *bio) if (dio->is_async && dio->op == REQ_OP_READ && dio->should_dirty) { bio_check_pages_dirty(bio); /* transfers ownership */ } else { - struct bvec_iter_all 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) && - dio->should_dirty) - set_page_dirty_lock(page); - put_page(page); - } - bio_put(bio); + if (dio->op == REQ_OP_READ && dio->should_dirty) + bio_set_pages_dirty(bio); + bio_release_pages(bio); } return err; } -- 2.20.1