linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* decruft bio.h
@ 2021-10-12 16:17 Christoph Hellwig
  2021-10-12 16:17 ` [PATCH 1/8] block: remove BIO_BUG_ON Christoph Hellwig
                   ` (8 more replies)
  0 siblings, 9 replies; 18+ messages in thread
From: Christoph Hellwig @ 2021-10-12 16:17 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block

Hi Jens,

this series moves various declarations that do not need to be
global out of bio.h.

Diffstat:
 block/bio.c            |  100 ++++++++++++++++++++++++++++---------------------
 block/blk-merge.c      |   31 +++++++++++++++
 block/blk-mq-sched.h   |    5 ++
 include/linux/bio.h    |   78 --------------------------------------
 include/linux/blk-mq.h |    6 ++
 5 files changed, 99 insertions(+), 121 deletions(-)

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

* [PATCH 1/8] block: remove BIO_BUG_ON
  2021-10-12 16:17 decruft bio.h Christoph Hellwig
@ 2021-10-12 16:17 ` Christoph Hellwig
  2021-10-13  4:19   ` Chaitanya Kulkarni
  2021-10-12 16:17 ` [PATCH 2/8] block: don't include <linux/ioprio.h> in <linux/bio.h> Christoph Hellwig
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2021-10-12 16:17 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block

BIO_DEBUG is always defined, so just switch the two instances to use
BUG_ON directly.

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

diff --git a/block/bio.c b/block/bio.c
index a6fb6a0b42955..35b875563c8ba 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -156,7 +156,7 @@ static void bio_put_slab(struct bio_set *bs)
 
 void bvec_free(mempool_t *pool, struct bio_vec *bv, unsigned short nr_vecs)
 {
-	BIO_BUG_ON(nr_vecs > BIO_MAX_VECS);
+	BUG_ON(nr_vecs > BIO_MAX_VECS);
 
 	if (nr_vecs == BIO_MAX_VECS)
 		mempool_free(bv, pool);
@@ -677,7 +677,7 @@ static void bio_alloc_cache_destroy(struct bio_set *bs)
 void bio_put(struct bio *bio)
 {
 	if (unlikely(bio_flagged(bio, BIO_REFFED))) {
-		BIO_BUG_ON(!atomic_read(&bio->__bi_cnt));
+		BUG_ON(!atomic_read(&bio->__bi_cnt));
 		if (!atomic_dec_and_test(&bio->__bi_cnt))
 			return;
 	}
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 00952e92eae1b..65a356fa71109 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -11,14 +11,6 @@
 #include <linux/blk_types.h>
 #include <linux/uio.h>
 
-#define BIO_DEBUG
-
-#ifdef BIO_DEBUG
-#define BIO_BUG_ON	BUG_ON
-#else
-#define BIO_BUG_ON
-#endif
-
 #define BIO_MAX_VECS		256U
 
 static inline unsigned int bio_max_segs(unsigned int nr_segs)
-- 
2.30.2


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

* [PATCH 2/8] block: don't include <linux/ioprio.h> in <linux/bio.h>
  2021-10-12 16:17 decruft bio.h Christoph Hellwig
  2021-10-12 16:17 ` [PATCH 1/8] block: remove BIO_BUG_ON Christoph Hellwig
@ 2021-10-12 16:17 ` Christoph Hellwig
  2021-10-13  4:19   ` Chaitanya Kulkarni
  2021-10-12 16:17 ` [PATCH 3/8] block: move bio_mergeable out of bio.h Christoph Hellwig
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2021-10-12 16:17 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block

bio.h doesn't need any of the definitions from ioprio.h.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/bio.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/bio.h b/include/linux/bio.h
index 65a356fa71109..ae94794d07c9d 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -6,7 +6,6 @@
 #define __LINUX_BIO_H
 
 #include <linux/mempool.h>
-#include <linux/ioprio.h>
 /* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */
 #include <linux/blk_types.h>
 #include <linux/uio.h>
-- 
2.30.2


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

* [PATCH 3/8] block: move bio_mergeable out of bio.h
  2021-10-12 16:17 decruft bio.h Christoph Hellwig
  2021-10-12 16:17 ` [PATCH 1/8] block: remove BIO_BUG_ON Christoph Hellwig
  2021-10-12 16:17 ` [PATCH 2/8] block: don't include <linux/ioprio.h> in <linux/bio.h> Christoph Hellwig
@ 2021-10-12 16:17 ` Christoph Hellwig
  2021-10-13  4:20   ` Chaitanya Kulkarni
  2021-10-12 16:18 ` [PATCH 4/8] block: fold bio_cur_bytes into blk_rq_cur_bytes Christoph Hellwig
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2021-10-12 16:17 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block

bio_mergeable is only needed by I/O schedulers, so move it to
blk-mq-sched.h.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-mq-sched.h | 5 +++++
 include/linux/bio.h  | 8 --------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/block/blk-mq-sched.h b/block/blk-mq-sched.h
index e4d367e0b2a30..a38d593a5e7a9 100644
--- a/block/blk-mq-sched.h
+++ b/block/blk-mq-sched.h
@@ -31,6 +31,11 @@ int blk_mq_init_sched(struct request_queue *q, struct elevator_type *e);
 void blk_mq_exit_sched(struct request_queue *q, struct elevator_queue *e);
 void blk_mq_sched_free_rqs(struct request_queue *q);
 
+static inline bool bio_mergeable(struct bio *bio)
+{
+	return !(bio->bi_opf & REQ_NOMERGE_FLAGS);
+}
+
 static inline bool
 blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio,
 		unsigned int nr_segs)
diff --git a/include/linux/bio.h b/include/linux/bio.h
index ae94794d07c9d..ec255f2829948 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -69,14 +69,6 @@ static inline bool bio_no_advance_iter(const struct bio *bio)
 	       bio_op(bio) == REQ_OP_WRITE_ZEROES;
 }
 
-static inline bool bio_mergeable(struct bio *bio)
-{
-	if (bio->bi_opf & REQ_NOMERGE_FLAGS)
-		return false;
-
-	return true;
-}
-
 static inline unsigned int bio_cur_bytes(struct bio *bio)
 {
 	if (bio_has_data(bio))
-- 
2.30.2


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

* [PATCH 4/8] block: fold bio_cur_bytes into blk_rq_cur_bytes
  2021-10-12 16:17 decruft bio.h Christoph Hellwig
                   ` (2 preceding siblings ...)
  2021-10-12 16:17 ` [PATCH 3/8] block: move bio_mergeable out of bio.h Christoph Hellwig
@ 2021-10-12 16:18 ` Christoph Hellwig
  2021-10-13  4:20   ` Chaitanya Kulkarni
  2021-10-12 16:18 ` [PATCH 5/8] block: move bio_full out of bio.h Christoph Hellwig
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2021-10-12 16:18 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block

Fold bio_cur_bytes into the only caller.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/bio.h    | 8 --------
 include/linux/blk-mq.h | 6 +++++-
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/include/linux/bio.h b/include/linux/bio.h
index ec255f2829948..cffd5eba401ed 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -69,14 +69,6 @@ static inline bool bio_no_advance_iter(const struct bio *bio)
 	       bio_op(bio) == REQ_OP_WRITE_ZEROES;
 }
 
-static inline unsigned int bio_cur_bytes(struct bio *bio)
-{
-	if (bio_has_data(bio))
-		return bio_iovec(bio).bv_len;
-	else /* dataless requests such as discard */
-		return bio->bi_iter.bi_size;
-}
-
 static inline void *bio_data(struct bio *bio)
 {
 	if (bio_has_data(bio))
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 0e941f2175784..2219e92771186 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -927,7 +927,11 @@ static inline unsigned int blk_rq_bytes(const struct request *rq)
 
 static inline int blk_rq_cur_bytes(const struct request *rq)
 {
-	return rq->bio ? bio_cur_bytes(rq->bio) : 0;
+	if (!rq->bio)
+		return 0;
+	if (!bio_has_data(rq->bio))	/* dataless requests such as discard */
+		return rq->bio->bi_iter.bi_size;
+	return bio_iovec(rq->bio).bv_len;
 }
 
 unsigned int blk_rq_err_bytes(const struct request *rq);
-- 
2.30.2


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

* [PATCH 5/8] block: move bio_full out of bio.h
  2021-10-12 16:17 decruft bio.h Christoph Hellwig
                   ` (3 preceding siblings ...)
  2021-10-12 16:18 ` [PATCH 4/8] block: fold bio_cur_bytes into blk_rq_cur_bytes Christoph Hellwig
@ 2021-10-12 16:18 ` Christoph Hellwig
  2021-10-13  4:20   ` Chaitanya Kulkarni
  2021-10-12 16:18 ` [PATCH 6/8] block: mark __bio_try_merge_page static Christoph Hellwig
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2021-10-12 16:18 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block

bio_full is only used in bio.c, so move it there.

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

diff --git a/block/bio.c b/block/bio.c
index 35b875563c8ba..7e2899071de26 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -772,6 +772,23 @@ const char *bio_devname(struct bio *bio, char *buf)
 }
 EXPORT_SYMBOL(bio_devname);
 
+/**
+ * bio_full - check if the bio is full
+ * @bio:	bio to check
+ * @len:	length of one segment to be added
+ *
+ * Return true if @bio is full and one segment with @len bytes can't be
+ * added to the bio, otherwise return false
+ */
+static inline bool bio_full(struct bio *bio, unsigned len)
+{
+	if (bio->bi_vcnt >= bio->bi_max_vecs)
+		return true;
+	if (bio->bi_iter.bi_size > UINT_MAX - len)
+		return true;
+	return false;
+}
+
 static inline bool page_is_mergeable(const struct bio_vec *bv,
 		struct page *page, unsigned int len, unsigned int off,
 		bool *same_page)
diff --git a/include/linux/bio.h b/include/linux/bio.h
index cffd5eba401ed..2ffc7c768091c 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -77,25 +77,6 @@ static inline void *bio_data(struct bio *bio)
 	return NULL;
 }
 
-/**
- * bio_full - check if the bio is full
- * @bio:	bio to check
- * @len:	length of one segment to be added
- *
- * Return true if @bio is full and one segment with @len bytes can't be
- * added to the bio, otherwise return false
- */
-static inline bool bio_full(struct bio *bio, unsigned len)
-{
-	if (bio->bi_vcnt >= bio->bi_max_vecs)
-		return true;
-
-	if (bio->bi_iter.bi_size > UINT_MAX - len)
-		return true;
-
-	return false;
-}
-
 static inline bool bio_next_segment(const struct bio *bio,
 				    struct bvec_iter_all *iter)
 {
-- 
2.30.2


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

* [PATCH 6/8] block: mark __bio_try_merge_page static
  2021-10-12 16:17 decruft bio.h Christoph Hellwig
                   ` (4 preceding siblings ...)
  2021-10-12 16:18 ` [PATCH 5/8] block: move bio_full out of bio.h Christoph Hellwig
@ 2021-10-12 16:18 ` Christoph Hellwig
  2021-10-13  4:21   ` Chaitanya Kulkarni
  2021-10-12 16:18 ` [PATCH 7/8] block: move bio_get_{first,last}_bvec out of bio.h Christoph Hellwig
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2021-10-12 16:18 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block

Mark __bio_try_merge_page static and move it up a bit to avoid the need
for a forward declaration.

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

diff --git a/block/bio.c b/block/bio.c
index 7e2899071de26..c89e402356a59 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -808,6 +808,44 @@ static inline bool page_is_mergeable(const struct bio_vec *bv,
 	return (bv->bv_page + bv_end / PAGE_SIZE) == (page + off / PAGE_SIZE);
 }
 
+/**
+ * __bio_try_merge_page - try appending data to an existing bvec.
+ * @bio: destination bio
+ * @page: start page to add
+ * @len: length of the data to add
+ * @off: offset of the data relative to @page
+ * @same_page: return if the segment has been merged inside the same page
+ *
+ * Try to add the data at @page + @off to the last bvec of @bio.  This is a
+ * useful optimisation for file systems with a block size smaller than the
+ * page size.
+ *
+ * Warn if (@len, @off) crosses pages in case that @same_page is true.
+ *
+ * Return %true on success or %false on failure.
+ */
+static bool __bio_try_merge_page(struct bio *bio, struct page *page,
+		unsigned int len, unsigned int off, bool *same_page)
+{
+	if (WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)))
+		return false;
+
+	if (bio->bi_vcnt > 0) {
+		struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1];
+
+		if (page_is_mergeable(bv, page, len, off, same_page)) {
+			if (bio->bi_iter.bi_size > UINT_MAX - len) {
+				*same_page = false;
+				return false;
+			}
+			bv->bv_len += len;
+			bio->bi_iter.bi_size += len;
+			return true;
+		}
+	}
+	return false;
+}
+
 /*
  * Try to merge a page into a segment, while obeying the hardware segment
  * size limit.  This is not for normal read/write bios, but for passthrough
@@ -939,45 +977,6 @@ int bio_add_zone_append_page(struct bio *bio, struct page *page,
 }
 EXPORT_SYMBOL_GPL(bio_add_zone_append_page);
 
-/**
- * __bio_try_merge_page - try appending data to an existing bvec.
- * @bio: destination bio
- * @page: start page to add
- * @len: length of the data to add
- * @off: offset of the data relative to @page
- * @same_page: return if the segment has been merged inside the same page
- *
- * Try to add the data at @page + @off to the last bvec of @bio.  This is a
- * useful optimisation for file systems with a block size smaller than the
- * page size.
- *
- * Warn if (@len, @off) crosses pages in case that @same_page is true.
- *
- * Return %true on success or %false on failure.
- */
-bool __bio_try_merge_page(struct bio *bio, struct page *page,
-		unsigned int len, unsigned int off, bool *same_page)
-{
-	if (WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)))
-		return false;
-
-	if (bio->bi_vcnt > 0) {
-		struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1];
-
-		if (page_is_mergeable(bv, page, len, off, same_page)) {
-			if (bio->bi_iter.bi_size > UINT_MAX - len) {
-				*same_page = false;
-				return false;
-			}
-			bv->bv_len += len;
-			bio->bi_iter.bi_size += len;
-			return true;
-		}
-	}
-	return false;
-}
-EXPORT_SYMBOL_GPL(__bio_try_merge_page);
-
 /**
  * __bio_add_page - add page(s) to a bio in a new segment
  * @bio: destination bio
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 2ffc7c768091c..faa0a2fabaf08 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -425,8 +425,6 @@ extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *,
 			   unsigned int, unsigned int);
 int bio_add_zone_append_page(struct bio *bio, struct page *page,
 			     unsigned int len, unsigned int offset);
-bool __bio_try_merge_page(struct bio *bio, struct page *page,
-		unsigned int len, unsigned int off, bool *same_page);
 void __bio_add_page(struct bio *bio, struct page *page,
 		unsigned int len, unsigned int off);
 int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter);
-- 
2.30.2


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

* [PATCH 7/8] block: move bio_get_{first,last}_bvec out of bio.h
  2021-10-12 16:17 decruft bio.h Christoph Hellwig
                   ` (5 preceding siblings ...)
  2021-10-12 16:18 ` [PATCH 6/8] block: mark __bio_try_merge_page static Christoph Hellwig
@ 2021-10-12 16:18 ` Christoph Hellwig
  2021-10-13  4:21   ` Chaitanya Kulkarni
  2021-10-12 16:18 ` [PATCH 8/8] block: mark bio_truncate static Christoph Hellwig
  2021-10-12 19:47 ` decruft bio.h Jens Axboe
  8 siblings, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2021-10-12 16:18 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block

bio_get_first_bvec and bio_get_last_bvec are only used in blk-merge.c,
so move them there.

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

diff --git a/block/blk-merge.c b/block/blk-merge.c
index bf7aedaad8f8e..14ce19607cd8a 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -15,6 +15,37 @@
 #include "blk-rq-qos.h"
 #include "blk-throttle.h"
 
+static inline void bio_get_first_bvec(struct bio *bio, struct bio_vec *bv)
+{
+	*bv = mp_bvec_iter_bvec(bio->bi_io_vec, bio->bi_iter);
+}
+
+static inline void bio_get_last_bvec(struct bio *bio, struct bio_vec *bv)
+{
+	struct bvec_iter iter = bio->bi_iter;
+	int idx;
+
+	bio_get_first_bvec(bio, bv);
+	if (bv->bv_len == bio->bi_iter.bi_size)
+		return;		/* this bio only has a single bvec */
+
+	bio_advance_iter(bio, &iter, iter.bi_size);
+
+	if (!iter.bi_bvec_done)
+		idx = iter.bi_idx - 1;
+	else	/* in the middle of bvec */
+		idx = iter.bi_idx;
+
+	*bv = bio->bi_io_vec[idx];
+
+	/*
+	 * iter.bi_bvec_done records actual length of the last bvec
+	 * if this bio ends in the middle of one io vector
+	 */
+	if (iter.bi_bvec_done)
+		bv->bv_len = iter.bi_bvec_done;
+}
+
 static inline bool bio_will_gap(struct request_queue *q,
 		struct request *prev_rq, struct bio *prev, struct bio *next)
 {
diff --git a/include/linux/bio.h b/include/linux/bio.h
index faa0a2fabaf08..4c5106f2ed57e 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -221,37 +221,6 @@ static inline void bio_clear_flag(struct bio *bio, unsigned int bit)
 	bio->bi_flags &= ~(1U << bit);
 }
 
-static inline void bio_get_first_bvec(struct bio *bio, struct bio_vec *bv)
-{
-	*bv = mp_bvec_iter_bvec(bio->bi_io_vec, bio->bi_iter);
-}
-
-static inline void bio_get_last_bvec(struct bio *bio, struct bio_vec *bv)
-{
-	struct bvec_iter iter = bio->bi_iter;
-	int idx;
-
-	bio_get_first_bvec(bio, bv);
-	if (bv->bv_len == bio->bi_iter.bi_size)
-		return;		/* this bio only has a single bvec */
-
-	bio_advance_iter(bio, &iter, iter.bi_size);
-
-	if (!iter.bi_bvec_done)
-		idx = iter.bi_idx - 1;
-	else	/* in the middle of bvec */
-		idx = iter.bi_idx;
-
-	*bv = bio->bi_io_vec[idx];
-
-	/*
-	 * iter.bi_bvec_done records actual length of the last bvec
-	 * if this bio ends in the middle of one io vector
-	 */
-	if (iter.bi_bvec_done)
-		bv->bv_len = iter.bi_bvec_done;
-}
-
 static inline struct bio_vec *bio_first_bvec_all(struct bio *bio)
 {
 	WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED));
-- 
2.30.2


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

* [PATCH 8/8] block: mark bio_truncate static
  2021-10-12 16:17 decruft bio.h Christoph Hellwig
                   ` (6 preceding siblings ...)
  2021-10-12 16:18 ` [PATCH 7/8] block: move bio_get_{first,last}_bvec out of bio.h Christoph Hellwig
@ 2021-10-12 16:18 ` Christoph Hellwig
  2021-10-13  4:22   ` Chaitanya Kulkarni
  2021-10-12 19:47 ` decruft bio.h Jens Axboe
  8 siblings, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2021-10-12 16:18 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block

bio_truncate is only used in bio.c, so mark it static.

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

diff --git a/block/bio.c b/block/bio.c
index c89e402356a59..d5120451c36a3 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -546,7 +546,7 @@ EXPORT_SYMBOL(zero_fill_bio);
  *   REQ_OP_READ, zero the truncated part. This function should only
  *   be used for handling corner cases, such as bio eod.
  */
-void bio_truncate(struct bio *bio, unsigned new_size)
+static void bio_truncate(struct bio *bio, unsigned new_size)
 {
 	struct bio_vec bv;
 	struct bvec_iter iter;
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 4c5106f2ed57e..d8d27742a75f9 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -405,7 +405,6 @@ 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_free_pages(struct bio *bio);
-void bio_truncate(struct bio *bio, unsigned new_size);
 void guard_bio_eod(struct bio *bio);
 void zero_fill_bio(struct bio *bio);
 
-- 
2.30.2


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

* Re: decruft bio.h
  2021-10-12 16:17 decruft bio.h Christoph Hellwig
                   ` (7 preceding siblings ...)
  2021-10-12 16:18 ` [PATCH 8/8] block: mark bio_truncate static Christoph Hellwig
@ 2021-10-12 19:47 ` Jens Axboe
  8 siblings, 0 replies; 18+ messages in thread
From: Jens Axboe @ 2021-10-12 19:47 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Jens Axboe, linux-block

On Tue, 12 Oct 2021 18:17:56 +0200, Christoph Hellwig wrote:
> this series moves various declarations that do not need to be
> global out of bio.h.
> 
> Diffstat:
>  block/bio.c            |  100 ++++++++++++++++++++++++++++---------------------
>  block/blk-merge.c      |   31 +++++++++++++++
>  block/blk-mq-sched.h   |    5 ++
>  include/linux/bio.h    |   78 --------------------------------------
>  include/linux/blk-mq.h |    6 ++
>  5 files changed, 99 insertions(+), 121 deletions(-)
> 
> [...]

Applied, thanks!

[1/8] block: remove BIO_BUG_ON
      commit: 50c1c0fdacf093dca591e36db62ffa5b68db2ba5
[2/8] block: don't include <linux/ioprio.h> in <linux/bio.h>
      commit: 572f1bca6dfd38d5bf27bb617cffbd4788adaa16
[3/8] block: move bio_mergeable out of bio.h
      commit: 272ff6fb565b310b436f3348c482f6feaeee4915
[4/8] block: fold bio_cur_bytes into blk_rq_cur_bytes
      commit: 5eb9cd2ccdf779f83870370c815630a32b7df77d
[5/8] block: move bio_full out of bio.h
      commit: 8dc8d6c0124882a931b7f00400c546de36ba888f
[6/8] block: mark __bio_try_merge_page static
      commit: 3184916715244d9382c18102e509b995d9ddd2a0
[7/8] block: move bio_get_{first,last}_bvec out of bio.h
      commit: ca52cd788dc82151876484255580bbf5e09781ed
[8/8] block: mark bio_truncate static
      commit: 55b8648b7650e7b1d2eae81521c642f80f3fd152

Best regards,
-- 
Jens Axboe



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

* Re: [PATCH 1/8] block: remove BIO_BUG_ON
  2021-10-12 16:17 ` [PATCH 1/8] block: remove BIO_BUG_ON Christoph Hellwig
@ 2021-10-13  4:19   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 18+ messages in thread
From: Chaitanya Kulkarni @ 2021-10-13  4:19 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe; +Cc: linux-block

On 10/12/2021 9:17 AM, Christoph Hellwig wrote:
> BIO_DEBUG is always defined, so just switch the two instances to use
> BUG_ON directly.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>


Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>



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

* Re: [PATCH 2/8] block: don't include <linux/ioprio.h> in <linux/bio.h>
  2021-10-12 16:17 ` [PATCH 2/8] block: don't include <linux/ioprio.h> in <linux/bio.h> Christoph Hellwig
@ 2021-10-13  4:19   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 18+ messages in thread
From: Chaitanya Kulkarni @ 2021-10-13  4:19 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe; +Cc: linux-block

On 10/12/2021 9:17 AM, Christoph Hellwig wrote:
> bio.h doesn't need any of the definitions from ioprio.h.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---


Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>



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

* Re: [PATCH 3/8] block: move bio_mergeable out of bio.h
  2021-10-12 16:17 ` [PATCH 3/8] block: move bio_mergeable out of bio.h Christoph Hellwig
@ 2021-10-13  4:20   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 18+ messages in thread
From: Chaitanya Kulkarni @ 2021-10-13  4:20 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe; +Cc: linux-block

On 10/12/2021 9:17 AM, Christoph Hellwig wrote:
> bio_mergeable is only needed by I/O schedulers, so move it to
> blk-mq-sched.h.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---


Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>



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

* Re: [PATCH 4/8] block: fold bio_cur_bytes into blk_rq_cur_bytes
  2021-10-12 16:18 ` [PATCH 4/8] block: fold bio_cur_bytes into blk_rq_cur_bytes Christoph Hellwig
@ 2021-10-13  4:20   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 18+ messages in thread
From: Chaitanya Kulkarni @ 2021-10-13  4:20 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe; +Cc: linux-block

On 10/12/2021 9:18 AM, Christoph Hellwig wrote:
> Fold bio_cur_bytes into the only caller.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>




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

* Re: [PATCH 5/8] block: move bio_full out of bio.h
  2021-10-12 16:18 ` [PATCH 5/8] block: move bio_full out of bio.h Christoph Hellwig
@ 2021-10-13  4:20   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 18+ messages in thread
From: Chaitanya Kulkarni @ 2021-10-13  4:20 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe; +Cc: linux-block

On 10/12/2021 9:18 AM, Christoph Hellwig wrote:
> bio_full is only used in bio.c, so move it there.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---


Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>



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

* Re: [PATCH 6/8] block: mark __bio_try_merge_page static
  2021-10-12 16:18 ` [PATCH 6/8] block: mark __bio_try_merge_page static Christoph Hellwig
@ 2021-10-13  4:21   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 18+ messages in thread
From: Chaitanya Kulkarni @ 2021-10-13  4:21 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe; +Cc: linux-block

On 10/12/2021 9:18 AM, Christoph Hellwig wrote:
> Mark __bio_try_merge_page static and move it up a bit to avoid the need
> for a forward declaration.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>



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

* Re: [PATCH 7/8] block: move bio_get_{first,last}_bvec out of bio.h
  2021-10-12 16:18 ` [PATCH 7/8] block: move bio_get_{first,last}_bvec out of bio.h Christoph Hellwig
@ 2021-10-13  4:21   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 18+ messages in thread
From: Chaitanya Kulkarni @ 2021-10-13  4:21 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe; +Cc: linux-block

On 10/12/2021 9:18 AM, Christoph Hellwig wrote:
> bio_get_first_bvec and bio_get_last_bvec are only used in blk-merge.c,
> so move them there.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>


Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>



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

* Re: [PATCH 8/8] block: mark bio_truncate static
  2021-10-12 16:18 ` [PATCH 8/8] block: mark bio_truncate static Christoph Hellwig
@ 2021-10-13  4:22   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 18+ messages in thread
From: Chaitanya Kulkarni @ 2021-10-13  4:22 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe; +Cc: linux-block

On 10/12/2021 9:18 AM, Christoph Hellwig wrote:
> bio_truncate is only used in bio.c, so mark it static.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>


Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>



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

end of thread, other threads:[~2021-10-13  4:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12 16:17 decruft bio.h Christoph Hellwig
2021-10-12 16:17 ` [PATCH 1/8] block: remove BIO_BUG_ON Christoph Hellwig
2021-10-13  4:19   ` Chaitanya Kulkarni
2021-10-12 16:17 ` [PATCH 2/8] block: don't include <linux/ioprio.h> in <linux/bio.h> Christoph Hellwig
2021-10-13  4:19   ` Chaitanya Kulkarni
2021-10-12 16:17 ` [PATCH 3/8] block: move bio_mergeable out of bio.h Christoph Hellwig
2021-10-13  4:20   ` Chaitanya Kulkarni
2021-10-12 16:18 ` [PATCH 4/8] block: fold bio_cur_bytes into blk_rq_cur_bytes Christoph Hellwig
2021-10-13  4:20   ` Chaitanya Kulkarni
2021-10-12 16:18 ` [PATCH 5/8] block: move bio_full out of bio.h Christoph Hellwig
2021-10-13  4:20   ` Chaitanya Kulkarni
2021-10-12 16:18 ` [PATCH 6/8] block: mark __bio_try_merge_page static Christoph Hellwig
2021-10-13  4:21   ` Chaitanya Kulkarni
2021-10-12 16:18 ` [PATCH 7/8] block: move bio_get_{first,last}_bvec out of bio.h Christoph Hellwig
2021-10-13  4:21   ` Chaitanya Kulkarni
2021-10-12 16:18 ` [PATCH 8/8] block: mark bio_truncate static Christoph Hellwig
2021-10-13  4:22   ` Chaitanya Kulkarni
2021-10-12 19:47 ` decruft bio.h 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).