Linux block layer
 help / color / mirror / Atom feed
* [PATCH] block: Make bio_iov_bvec_set() accept pointer to const iov_iter
@ 2024-12-02 11:57 John Garry
  2024-12-12  6:25 ` Christoph Hellwig
  2024-12-12 15:43 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: John Garry @ 2024-12-02 11:57 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, hch, John Garry

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>

diff --git a/block/bio.c b/block/bio.c
index 699a78c85c75..d5bdc31d88d3 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1171,7 +1171,7 @@ void __bio_release_pages(struct bio *bio, bool mark_dirty)
 }
 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);
 
diff --git a/block/blk-map.c b/block/blk-map.c
index b5fd1d857461..894009b2d881 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -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);
 	if (!bio)
 		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 */
 	ret = bio_split_rw_at(bio, lim, &nsegs, max_bytes);
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 60830a6a5939..7a1b3b1a8fed 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -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,
 			  size_t off);
 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);
 extern void bio_set_pages_dirty(struct bio *bio);
 extern void bio_check_pages_dirty(struct bio *bio);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] block: Make bio_iov_bvec_set() accept pointer to const iov_iter
  2024-12-02 11:57 [PATCH] block: Make bio_iov_bvec_set() accept pointer to const iov_iter John Garry
@ 2024-12-12  6:25 ` Christoph Hellwig
  2024-12-12 15:43 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2024-12-12  6:25 UTC (permalink / raw)
  To: John Garry; +Cc: axboe, linux-block, hch

On Mon, Dec 02, 2024 at 11:57:27AM +0000, John Garry wrote:
> 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().

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] block: Make bio_iov_bvec_set() accept pointer to const iov_iter
  2024-12-02 11:57 [PATCH] block: Make bio_iov_bvec_set() accept pointer to const iov_iter John Garry
  2024-12-12  6:25 ` Christoph Hellwig
@ 2024-12-12 15:43 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2024-12-12 15:43 UTC (permalink / raw)
  To: John Garry; +Cc: linux-block, hch


On Mon, 02 Dec 2024 11:57:27 +0000, John Garry wrote:
> 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().
> 
> 

Applied, thanks!

[1/1] block: Make bio_iov_bvec_set() accept pointer to const iov_iter
      commit: 2f4873f9b5f8a49113045ad91c021347486de323

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-12 15:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-02 11:57 [PATCH] block: Make bio_iov_bvec_set() accept pointer to const iov_iter John Garry
2024-12-12  6:25 ` Christoph Hellwig
2024-12-12 15:43 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox