block: move bio_get_{first,last}_bvec out of bio.h
authorChristoph Hellwig <hch@lst.de>
Tue, 12 Oct 2021 16:18:03 +0000 (18:18 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 18 Oct 2021 12:17:35 +0000 (06:17 -0600)
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>
Link: https://lore.kernel.org/r/20211012161804.991559-8-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-merge.c
include/linux/bio.h

index bf7aedaad8f8e188c644ecc503651e46638ba898..14ce19607cd8acf619248cc98392c8e30b0e5105 100644 (file)
 #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)
 {
index faa0a2fabaf088c1f575907e36def8bd18f6ad07..4c5106f2ed57ef9aa6a7cf0caa457b369ab840f3 100644 (file)
@@ -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));