mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-11-30 21:44:06 +08:00
block: Replace BIO_NO_PAGE_REF with BIO_PAGE_REFFED with inverted logic
Replace BIO_NO_PAGE_REF with a BIO_PAGE_REFFED flag that has the inverted meaning is only set when a page reference has been acquired that needs to be released by bio_release_pages(). Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: John Hubbard <jhubbard@nvidia.com> cc: Al Viro <viro@zeniv.linux.org.uk> cc: Jens Axboe <axboe@kernel.dk> cc: Jan Kara <jack@suse.cz> cc: Matthew Wilcox <willy@infradead.org> cc: Logan Gunthorpe <logang@deltatee.com> cc: linux-block@vger.kernel.org Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20230522205744.2825689-4-dhowells@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
09e8c25341
commit
e51bab4e20
@ -1191,7 +1191,6 @@ void bio_iov_bvec_set(struct bio *bio, struct iov_iter *iter)
|
||||
bio->bi_io_vec = (struct bio_vec *)iter->bvec;
|
||||
bio->bi_iter.bi_bvec_done = iter->iov_offset;
|
||||
bio->bi_iter.bi_size = size;
|
||||
bio_set_flag(bio, BIO_NO_PAGE_REF);
|
||||
bio_set_flag(bio, BIO_CLONED);
|
||||
}
|
||||
|
||||
@ -1336,6 +1335,7 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bio_set_flag(bio, BIO_PAGE_REFFED);
|
||||
do {
|
||||
ret = __bio_iov_iter_get_pages(bio, iter);
|
||||
} while (!ret && iov_iter_count(iter) && !bio_full(bio, 0));
|
||||
|
@ -282,6 +282,7 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter,
|
||||
if (blk_queue_pci_p2pdma(rq->q))
|
||||
extraction_flags |= ITER_ALLOW_P2PDMA;
|
||||
|
||||
bio_set_flag(bio, BIO_PAGE_REFFED);
|
||||
while (iov_iter_count(iter)) {
|
||||
struct page **pages, *stack_pages[UIO_FASTIOV];
|
||||
ssize_t bytes;
|
||||
|
@ -402,6 +402,8 @@ dio_bio_alloc(struct dio *dio, struct dio_submit *sdio,
|
||||
bio->bi_end_io = dio_bio_end_aio;
|
||||
else
|
||||
bio->bi_end_io = dio_bio_end_io;
|
||||
/* for now require references for all pages */
|
||||
bio_set_flag(bio, BIO_PAGE_REFFED);
|
||||
sdio->bio = bio;
|
||||
sdio->logical_offset_in_bio = sdio->cur_page_fs_offset;
|
||||
}
|
||||
|
@ -203,7 +203,6 @@ static void iomap_dio_zero(const struct iomap_iter *iter, struct iomap_dio *dio,
|
||||
bio->bi_private = dio;
|
||||
bio->bi_end_io = iomap_dio_bio_end_io;
|
||||
|
||||
bio_set_flag(bio, BIO_NO_PAGE_REF);
|
||||
__bio_add_page(bio, page, len, 0);
|
||||
iomap_dio_submit_bio(iter, dio, bio, pos);
|
||||
}
|
||||
|
@ -488,7 +488,7 @@ void zero_fill_bio(struct bio *bio);
|
||||
|
||||
static inline void bio_release_pages(struct bio *bio, bool mark_dirty)
|
||||
{
|
||||
if (!bio_flagged(bio, BIO_NO_PAGE_REF))
|
||||
if (bio_flagged(bio, BIO_PAGE_REFFED))
|
||||
__bio_release_pages(bio, mark_dirty);
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ struct bio {
|
||||
* bio flags
|
||||
*/
|
||||
enum {
|
||||
BIO_NO_PAGE_REF, /* don't put release vec pages */
|
||||
BIO_PAGE_REFFED, /* put pages in bio_release_pages() */
|
||||
BIO_CLONED, /* doesn't own data */
|
||||
BIO_BOUNCED, /* bio is a bounce bio */
|
||||
BIO_QUIET, /* Make BIO Quiet */
|
||||
|
Loading…
Reference in New Issue
Block a user