Re: [PATCH v7 6/8] block: Make bio structs pin pages rather than ref'ing if appropriate

From: Christoph Hellwig
Date: Sat Jan 21 2023 - 08:07:55 EST


This really does three things:

1) add the BIO_PAGE_PINNED infrastructure
2) convert bio_iov_iter_get_pages to use iov_iter_extract_pages
3) convert bio_map_user_iov to use iov_iter_extract_pages

so it should be three pages, with the first one also containing
what is in your previous patch.

> @@ -1183,7 +1185,7 @@ void __bio_release_pages(struct bio *bio, bool mark_dirty)
> bio_for_each_segment_all(bvec, bio, iter_all) {
> if (mark_dirty && !PageCompound(bvec->bv_page))
> set_page_dirty_lock(bvec->bv_page);
> - put_page(bvec->bv_page);
> + bio_release_page(bio, bvec->bv_page);

This can be micro-optimized a bit by only doing the flags conversion
once.