[PATCH 15/15] block: blk-integrity: remove blk_rq_count_integrity_sg()

From: Jinyoung CHOI
Date: Wed May 03 2023 - 06:28:27 EST


blk_rq_nr_nr_integrity_segments() allows you to obtain the number of
integrity. Therefore, blk_rq_count_integrity_sg() is no longer necessary.

Cc: Christoph Hellwig <hch@xxxxxx>
Cc: Martin K. Petersen <martin.petersen@xxxxxxxxxx>

Signed-off-by: Jinyoung Choi <j-young.choi@xxxxxxxxxxx>
---
block/blk-integrity.c | 39 -----------------------------------
include/linux/blk-integrity.h | 1 -
2 files changed, 40 deletions(-)

diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index c50954652177..9bac2836c3ff 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -16,45 +16,6 @@

#include "blk.h"

-/**
- * blk_rq_count_integrity_sg - Count number of integrity scatterlist elements
- * @q: request queue
- * @bio: bio with integrity metadata attached
- *
- * Description: Returns the number of elements required in a
- * scatterlist corresponding to the integrity metadata in a bio.
- */
-int blk_rq_count_integrity_sg(struct request_queue *q, struct bio *bio)
-{
- struct bio_vec iv, ivprv = { NULL };
- unsigned int segments = 0;
- unsigned int seg_size = 0;
- struct bvec_iter iter;
- int prev = 0;
-
- bio_for_each_integrity_vec(iv, bio, iter) {
-
- if (prev) {
- if (!biovec_phys_mergeable(q, &ivprv, &iv))
- goto new_segment;
- if (seg_size + iv.bv_len > queue_max_segment_size(q))
- goto new_segment;
-
- seg_size += iv.bv_len;
- } else {
-new_segment:
- segments++;
- seg_size = iv.bv_len;
- }
-
- prev = 1;
- ivprv = iv;
- }
-
- return segments;
-}
-EXPORT_SYMBOL(blk_rq_count_integrity_sg);
-
/**
* blk_integrity_compare - Compare integrity profile of two disks
* @gd1: Disk to compare
diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h
index 45b9fde1fee1..a2a9d72e8fab 100644
--- a/include/linux/blk-integrity.h
+++ b/include/linux/blk-integrity.h
@@ -41,7 +41,6 @@ void blk_integrity_unregister(struct gendisk *);
int blk_integrity_compare(struct gendisk *, struct gendisk *);
int blk_rq_map_integrity_sg(struct request_queue *, struct bio *,
struct scatterlist *);
-int blk_rq_count_integrity_sg(struct request_queue *, struct bio *);

static inline unsigned short blk_rq_nr_integrity_segments(struct request *rq)
{
--
2.34.1