block: Make bio_iov_bvec_set() accept pointer to const iov_iter

Make bio_iov_bvec_set() accept a pointer to const iov_iter, which means
that we can drop the undesirable casting to struct iov_iter pointer in
blk_rq_map_user_bvec().

Signed-off-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20241202115727.2320401-1-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
John Garry 2024-12-02 11:57:27 +00:00 committed by Jens Axboe
parent 790eb09e59
commit 2f4873f9b5
3 changed files with 3 additions and 3 deletions

View File

@ -1171,7 +1171,7 @@ void __bio_release_pages(struct bio *bio, bool mark_dirty)
} }
EXPORT_SYMBOL_GPL(__bio_release_pages); EXPORT_SYMBOL_GPL(__bio_release_pages);
void bio_iov_bvec_set(struct bio *bio, struct iov_iter *iter) void bio_iov_bvec_set(struct bio *bio, const struct iov_iter *iter)
{ {
WARN_ON_ONCE(bio->bi_max_vecs); WARN_ON_ONCE(bio->bi_max_vecs);

View File

@ -574,7 +574,7 @@ static int blk_rq_map_user_bvec(struct request *rq, const struct iov_iter *iter)
bio = blk_rq_map_bio_alloc(rq, 0, GFP_KERNEL); bio = blk_rq_map_bio_alloc(rq, 0, GFP_KERNEL);
if (!bio) if (!bio)
return -ENOMEM; return -ENOMEM;
bio_iov_bvec_set(bio, (struct iov_iter *)iter); bio_iov_bvec_set(bio, iter);
/* check that the data layout matches the hardware restrictions */ /* check that the data layout matches the hardware restrictions */
ret = bio_split_rw_at(bio, lim, &nsegs, max_bytes); ret = bio_split_rw_at(bio, lim, &nsegs, max_bytes);

View File

@ -423,7 +423,7 @@ void __bio_add_page(struct bio *bio, struct page *page,
void bio_add_folio_nofail(struct bio *bio, struct folio *folio, size_t len, void bio_add_folio_nofail(struct bio *bio, struct folio *folio, size_t len,
size_t off); size_t off);
int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter); int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter);
void bio_iov_bvec_set(struct bio *bio, struct iov_iter *iter); void bio_iov_bvec_set(struct bio *bio, const struct iov_iter *iter);
void __bio_release_pages(struct bio *bio, bool mark_dirty); void __bio_release_pages(struct bio *bio, bool mark_dirty);
extern void bio_set_pages_dirty(struct bio *bio); extern void bio_set_pages_dirty(struct bio *bio);
extern void bio_check_pages_dirty(struct bio *bio); extern void bio_check_pages_dirty(struct bio *bio);