remove dead code and export
Hi Jens,
this series removes some minor dead code and dead exports in the block code.
Diffstat:
block/bio.c | 44 ++++++++++++++++++-------------------------- block/blk-core.c | 2 -- block/blk.h | 2 ++ include/linux/bio.h | 9 +-------- include/linux/blkdev.h | 1 - 5 files changed, 21 insertions(+), 37 deletions(-)
PATCH 1/5 block: remove zero_fill_bio_iter
Only used to implement zero_fill_bio, so directly implement that.
Signed-off-by Christoph Hellwig <[email protected]>
--- block/bio.c | 6 +++--- include/linux/bio.h | 7 +------ 2 files changed, 4 insertions(+), 9 deletions(-)
block/bio.c +3 -3
@@ -635,15 +635,15 @@ struct bio *bio_kmalloc(unsigned short nr_vecs, gfp_t gfp_mask) }EXPORT_SYMBOL (bio_kmalloc); -void zero_fill_bio_iter (struct bio *bio,struct bvec_iter start) +void zero_fill_bio (struct bio *bio) {struct bio_vec bv;struct bvec_iter iter; -__bio_for_each_segment (bv, bio, iter, start) +bio_for_each_segment (bv, bio, iter)memzero_bvec (&bv); } -EXPORT_SYMBOL (zero_fill_bio_iter); +EXPORT_SYMBOL (zero_fill_bio);/** * bio_truncate - truncate the bio to small size of @new_size
include/linux/bio.h +1 -6
@@ -482,13 +482,8 @@ 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 zero_fill_bio (struct bio *bio);void guard_bio_eod (struct bio *bio); -void zero_fill_bio_iter (struct bio *bio,struct bvec_iter iter); - -static inline void zero_fill_bio (struct bio *bio) -{ -zero_fill_bio_iter (bio, bio->bi_iter); -}static inline void bio_release_pages (struct bio *bio,bool mark_dirty) {
Signature · 1 line
2.53.0
PATCH 2/5 block: remove bio_copy_data_iter
In reply to Christoph HellwigOnly used by bio_copy_data, so implement that directly.
Signed-off-by Christoph Hellwig <[email protected]>
--- block/bio.c | 36 +++++++++++++++--------------------- include/linux/bio.h | 2 -- 2 files changed, 15 insertions(+), 23 deletions(-)
block/bio.c +15 -21
@@ -1575,26 +1575,6 @@ void __bio_advance(struct bio *bio, unsigned bytes) }EXPORT_SYMBOL (__bio_advance); -void bio_copy_data_iter (struct bio *dst,struct bvec_iter *dst_iter, -struct bio *src,struct bvec_iter *src_iter) -{ -while (src_iter->bi_size && dst_iter->bi_size) { -struct bio_vec src_bv =bio_iter_iovec (src, *src_iter); -struct bio_vec dst_bv =bio_iter_iovec (dst, *dst_iter); -unsigned int bytes =min (src_bv.bv_len, dst_bv.bv_len); -void *src_buf =bvec_kmap_local (&src_bv); -void *dst_buf =bvec_kmap_local (&dst_bv); - -memcpy (dst_buf, src_buf, bytes); - -kunmap_local (dst_buf); -kunmap_local (src_buf); - -bio_advance_iter_single (src, src_iter, bytes); -bio_advance_iter_single (dst, dst_iter, bytes); - } -} -EXPORT_SYMBOL (bio_copy_data_iter);/** * bio_copy_data - copy contents of data buffers from one bio to another
@@ -1609,7 +1589,21 @@ void bio_copy_data(struct bio *dst, struct bio *src)struct bvec_iter src_iter = src->bi_iter;struct bvec_iter dst_iter = dst->bi_iter; -bio_copy_data_iter (dst, &dst_iter, src, &src_iter); +while (src_iter.bi_size && dst_iter.bi_size) { +struct bio_vec src_bv =bio_iter_iovec (src, src_iter); +struct bio_vec dst_bv =bio_iter_iovec (dst, dst_iter); +unsigned int bytes =min (src_bv.bv_len, dst_bv.bv_len); +void *src_buf =bvec_kmap_local (&src_bv); +void *dst_buf =bvec_kmap_local (&dst_bv); + +memcpy (dst_buf, src_buf, bytes); + +kunmap_local (dst_buf); +kunmap_local (src_buf); + +bio_advance_iter_single (src, &src_iter, bytes); +bio_advance_iter_single (dst, &dst_iter, bytes); + } }EXPORT_SYMBOL (bio_copy_data);
include/linux/bio.h +0 -2
@@ -478,8 +478,6 @@ extern void bio_check_pages_dirty(struct bio *bio);int bio_iov_iter_bounce (struct bio *bio,struct iov_iter *iter,size_t maxlen);void bio_iov_iter_unbounce (struct bio *bio,bool is_error,bool mark_dirty); -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 zero_fill_bio (struct bio *bio);
Signature · 1 line
2.53.0
PATCH 3/5 block: unexport blk_io_schedule
In reply to Christoph HellwigOnly used in built-in code.
Signed-off-by Christoph Hellwig <[email protected]>
--- block/blk-core.c | 1 - 1 file changed, 1 deletion(-)
block/blk-core.c +0 -1
@@ -1270,7 +1270,6 @@ void blk_io_schedule(void)else io_schedule (); } -EXPORT_SYMBOL_GPL (blk_io_schedule);int __init blk_dev_init (void ) {
Signature · 1 line
2.53.0
PATCH 4/5 block: unexport blk_status_to_str
In reply to Christoph HellwigOnly used in core block code, so unexport and move the prototype to blk.h.
Signed-off-by Christoph Hellwig <[email protected]>
--- block/blk-core.c | 1 - block/blk.h | 2 ++ include/linux/blkdev.h | 1 - 3 files changed, 2 insertions(+), 2 deletions(-)
block/blk-core.c +0 -1
@@ -197,7 +197,6 @@ const char *blk_status_to_str(blk_status_t status)return "<null>" ;return blk_errors[idx].name; } -EXPORT_SYMBOL_GPL (blk_status_to_str);/** * blk_sync_queue - cancel any pending callbacks on a queue
block/blk.h +2 -0
@@ -49,6 +49,8 @@ struct blk_flush_queue *blk_alloc_flush_queue(int node, int cmd_size, gfp_t flags);void blk_free_flush_queue (struct blk_flush_queue *q); +const char *blk_status_to_str (blk_status_t status); +bool __blk_mq_unfreeze_queue (struct request_queue *q,bool force_atomic);bool blk_queue_start_drain (struct request_queue *q); bool __blk_freeze_queue_start(struct request_queue *q,
include/linux/blkdev.h +0 -1
@@ -1040,7 +1040,6 @@ extern const char *blk_op_str(enum req_op op);int blk_status_to_errno (blk_status_t status);blk_status_t errno_to_blk_status (int errno); -const char *blk_status_to_str (blk_status_t status);/* only poll the hardware once, don't continue until a completion was found */ #define BLK_POLL_ONESHOT (1 << 0)
Signature · 1 line
2.53.0
PATCH 5/5 block: unexport bio_{set,check}_pages_dirty
In reply to Christoph HellwigOnly used in built-in code.
Signed-off-by Christoph Hellwig <[email protected]>
--- block/bio.c | 2 -- 1 file changed, 2 deletions(-)
block/bio.c +0 -2
@@ -1650,7 +1650,6 @@ void bio_set_pages_dirty(struct bio *bio)folio_unlock (fi.folio); } } -EXPORT_SYMBOL_GPL (bio_set_pages_dirty);/* * bio_check_pages_dirty() will check that all the BIO's pages are still dirty.
@@ -1709,7 +1708,6 @@ void bio_check_pages_dirty(struct bio *bio)spin_unlock_irqrestore (&bio_dirty_lock, flags);schedule_work (&bio_dirty_work); } -EXPORT_SYMBOL_GPL (bio_check_pages_dirty);static inline bool bio_remaining_done (struct bio *bio) {
Signature · 1 line
2.53.0
Quoted 11 lines · Christoph Hellwig
this series removes some minor dead code and dead exports in the block code.
Diffstat:
block/bio.c | 44 ++++++++++++++++++-------------------------- block/blk-core.c | 2 -- block/blk.h | 2 ++ include/linux/bio.h | 9 +-------- include/linux/blkdev.h | 1 - 5 files changed, 21 insertions(+), 37 deletions(-)[...]
Applied, thanks!
[1/5] block: remove zero_fill_bio_iter
commit: 64cf531f9900c011afe97a28c8ef464d551cec1b
[2/5] block: remove bio_copy_data_iter
commit: 8d57b5876d39679c81d479485422e88319f17418
[3/5] block: unexport blk_io_schedule
commit: 9957d5bbb916d37b277bf298e635d29a71205f99
[4/5] block: unexport blk_status_to_str
commit: 82aaa55a3162acaad10baced6f87126a4454a0d7
[5/5] block: unexport bio_{set,check}_pages_dirty
commit: be34ec59ef061a1cc435a3e066ad71ca675c7fcdBest regards,
Signature · 1 line
Jens Axboe