linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] block: remove zero_fill_bio_iter
@ 2021-04-12 13:46 Christoph Hellwig
  2021-04-12 13:46 ` [PATCH 2/2] block: move bio_list_copy_data to pktcdvd Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Christoph Hellwig @ 2021-04-12 13:46 UTC (permalink / raw)
  To: axboe; +Cc: linux-block

zero_fill_bio_iter is only used to implement zero_fill_bio, so
remove the indirection.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/bio.c         | 6 +++---
 include/linux/bio.h | 7 +------
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/block/bio.c b/block/bio.c
index 26b7f721cda88b..0fecb80872c23f 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -493,20 +493,20 @@ struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned short nr_iovecs)
 }
 EXPORT_SYMBOL(bio_kmalloc);
 
-void zero_fill_bio_iter(struct bio *bio, struct bvec_iter start)
+void zero_fill_bio(struct bio *bio)
 {
 	unsigned long flags;
 	struct bio_vec bv;
 	struct bvec_iter iter;
 
-	__bio_for_each_segment(bv, bio, iter, start) {
+	bio_for_each_segment(bv, bio, iter) {
 		char *data = bvec_kmap_irq(&bv, &flags);
 		memset(data, 0, bv.bv_len);
 		flush_dcache_page(bv.bv_page);
 		bvec_kunmap_irq(data, &flags);
 	}
 }
-EXPORT_SYMBOL(zero_fill_bio_iter);
+EXPORT_SYMBOL(zero_fill_bio);
 
 /**
  * bio_truncate - truncate the bio to small size of @new_size
diff --git a/include/linux/bio.h b/include/linux/bio.h
index d0246c92a6e865..a8021d79d45d1f 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -485,14 +485,9 @@ extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter,
 extern void bio_copy_data(struct bio *dst, struct bio *src);
 extern void bio_list_copy_data(struct bio *dst, struct bio *src);
 extern void bio_free_pages(struct bio *bio);
-void zero_fill_bio_iter(struct bio *bio, struct bvec_iter iter);
 void bio_truncate(struct bio *bio, unsigned new_size);
 void guard_bio_eod(struct bio *bio);
-
-static inline void zero_fill_bio(struct bio *bio)
-{
-	zero_fill_bio_iter(bio, bio->bi_iter);
-}
+void zero_fill_bio(struct bio *bio);
 
 extern const char *bio_devname(struct bio *bio, char *buffer);
 
-- 
2.30.1


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

* [PATCH 2/2] block: move bio_list_copy_data to pktcdvd
  2021-04-12 13:46 [PATCH 1/2] block: remove zero_fill_bio_iter Christoph Hellwig
@ 2021-04-12 13:46 ` Christoph Hellwig
  2021-04-12 15:17   ` Johannes Thumshirn
  2021-04-12 13:51 ` [PATCH 1/2] block: remove zero_fill_bio_iter Johannes Thumshirn
  2021-04-12 15:20 ` Jens Axboe
  2 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2021-04-12 13:46 UTC (permalink / raw)
  To: axboe; +Cc: linux-block

bio_list_copy_data is only used by pktcdvd, so move it there.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/bio.c             | 37 -------------------------------------
 drivers/block/pktcdvd.c | 36 ++++++++++++++++++++++++++++++++++++
 include/linux/bio.h     |  1 -
 3 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/block/bio.c b/block/bio.c
index 0fecb80872c23f..303298996afeb4 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1221,43 +1221,6 @@ void bio_copy_data(struct bio *dst, struct bio *src)
 }
 EXPORT_SYMBOL(bio_copy_data);
 
-/**
- * bio_list_copy_data - copy contents of data buffers from one chain of bios to
- * another
- * @src: source bio list
- * @dst: destination bio list
- *
- * Stops when it reaches the end of either the @src list or @dst list - that is,
- * copies min(src->bi_size, dst->bi_size) bytes (or the equivalent for lists of
- * bios).
- */
-void bio_list_copy_data(struct bio *dst, struct bio *src)
-{
-	struct bvec_iter src_iter = src->bi_iter;
-	struct bvec_iter dst_iter = dst->bi_iter;
-
-	while (1) {
-		if (!src_iter.bi_size) {
-			src = src->bi_next;
-			if (!src)
-				break;
-
-			src_iter = src->bi_iter;
-		}
-
-		if (!dst_iter.bi_size) {
-			dst = dst->bi_next;
-			if (!dst)
-				break;
-
-			dst_iter = dst->bi_iter;
-		}
-
-		bio_copy_data_iter(dst, &dst_iter, src, &src_iter);
-	}
-}
-EXPORT_SYMBOL(bio_list_copy_data);
-
 void bio_free_pages(struct bio *bio)
 {
 	struct bio_vec *bvec;
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index fc4b0f1aa86dfb..bd35565851224f 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -1199,6 +1199,42 @@ static int pkt_handle_queue(struct pktcdvd_device *pd)
 	return 1;
 }
 
+/**
+ * bio_list_copy_data - copy contents of data buffers from one chain of bios to
+ * another
+ * @src: source bio list
+ * @dst: destination bio list
+ *
+ * Stops when it reaches the end of either the @src list or @dst list - that is,
+ * copies min(src->bi_size, dst->bi_size) bytes (or the equivalent for lists of
+ * bios).
+ */
+static void bio_list_copy_data(struct bio *dst, struct bio *src)
+{
+	struct bvec_iter src_iter = src->bi_iter;
+	struct bvec_iter dst_iter = dst->bi_iter;
+
+	while (1) {
+		if (!src_iter.bi_size) {
+			src = src->bi_next;
+			if (!src)
+				break;
+
+			src_iter = src->bi_iter;
+		}
+
+		if (!dst_iter.bi_size) {
+			dst = dst->bi_next;
+			if (!dst)
+				break;
+
+			dst_iter = dst->bi_iter;
+		}
+
+		bio_copy_data_iter(dst, &dst_iter, src, &src_iter);
+	}
+}
+
 /*
  * Assemble a bio to write one packet and queue the bio for processing
  * by the underlying block device.
diff --git a/include/linux/bio.h b/include/linux/bio.h
index a8021d79d45d1f..a0b4cfdf62a434 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -483,7 +483,6 @@ extern void bio_check_pages_dirty(struct bio *bio);
 extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter,
 			       struct bio *src, struct bvec_iter *src_iter);
 extern void bio_copy_data(struct bio *dst, struct bio *src);
-extern void bio_list_copy_data(struct bio *dst, struct bio *src);
 extern void bio_free_pages(struct bio *bio);
 void bio_truncate(struct bio *bio, unsigned new_size);
 void guard_bio_eod(struct bio *bio);
-- 
2.30.1


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

* Re: [PATCH 1/2] block: remove zero_fill_bio_iter
  2021-04-12 13:46 [PATCH 1/2] block: remove zero_fill_bio_iter Christoph Hellwig
  2021-04-12 13:46 ` [PATCH 2/2] block: move bio_list_copy_data to pktcdvd Christoph Hellwig
@ 2021-04-12 13:51 ` Johannes Thumshirn
  2021-04-12 15:20 ` Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2021-04-12 13:51 UTC (permalink / raw)
  To: Christoph Hellwig, axboe; +Cc: linux-block

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 2/2] block: move bio_list_copy_data to pktcdvd
  2021-04-12 13:46 ` [PATCH 2/2] block: move bio_list_copy_data to pktcdvd Christoph Hellwig
@ 2021-04-12 15:17   ` Johannes Thumshirn
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2021-04-12 15:17 UTC (permalink / raw)
  To: Christoph Hellwig, axboe; +Cc: linux-block

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH 1/2] block: remove zero_fill_bio_iter
  2021-04-12 13:46 [PATCH 1/2] block: remove zero_fill_bio_iter Christoph Hellwig
  2021-04-12 13:46 ` [PATCH 2/2] block: move bio_list_copy_data to pktcdvd Christoph Hellwig
  2021-04-12 13:51 ` [PATCH 1/2] block: remove zero_fill_bio_iter Johannes Thumshirn
@ 2021-04-12 15:20 ` Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2021-04-12 15:20 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-block

On 4/12/21 7:46 AM, Christoph Hellwig wrote:
> zero_fill_bio_iter is only used to implement zero_fill_bio, so
> remove the indirection.

Applied 1-2, thanks.

-- 
Jens Axboe


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

end of thread, other threads:[~2021-04-12 15:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 13:46 [PATCH 1/2] block: remove zero_fill_bio_iter Christoph Hellwig
2021-04-12 13:46 ` [PATCH 2/2] block: move bio_list_copy_data to pktcdvd Christoph Hellwig
2021-04-12 15:17   ` Johannes Thumshirn
2021-04-12 13:51 ` [PATCH 1/2] block: remove zero_fill_bio_iter Johannes Thumshirn
2021-04-12 15:20 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).