Skip to contentSkip to conversation

blk-mq/sbitmap: Delete some unused functions

PATCH In review John Garry 2 participants 4 messages Nov 13, 2019

Subsystems (2)
lore
Share & tools
lore

John Garry

author
#0 lore raw

cover blk-mq/sbitmap: Delete some unused functions

Function blk_mq_can_queue() never seemed to ever have been referenced, so delete it and any other now-unused callees.

John Garry (2):
blk-mq: Delete blk_mq_has_free_tags() and blk_mq_can_queue()
sbitmap: Delete sbitmap_any_bit_clear()

 block/blk-mq-tag.c      |  8 --------
 block/blk-mq-tag.h      |  1 -
 block/blk-mq.c          |  6 ------
 include/linux/blk-mq.h  |  1 -
 include/linux/sbitmap.h |  9 ---------
 lib/sbitmap.c           | 17 -----------------
 6 files changed, 42 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/2 blk-mq: Delete blk_mq_has_free_tags() and blk_mq_can_queue()

These functions are not referenced, so delete them.

---
 block/blk-mq-tag.c     | 8 --------
 block/blk-mq-tag.h     | 1 -
 block/blk-mq.c         | 6 ------
 include/linux/blk-mq.h | 1 -
 4 files changed, 16 deletions(-)
block/blk-mq-tag.c +0 -8
index 008388e82b5c..fbacde454718 100644
@@ -15,14 +15,6 @@
 #include "blk-mq.h"
 #include "blk-mq-tag.h"
 
-bool blk_mq_has_free_tags(struct blk_mq_tags *tags)
-{
-	if (!tags)
-		return true;
-
-	return sbitmap_any_bit_clear(&tags->bitmap_tags.sb);
-}
-
 /*
  * If a previously inactive queue goes active, bump the active user count.
  * We need to do this before try to allocate driver tag, then even if fail
block/blk-mq-tag.h +0 -1
index 61deab0b5a5a..15bc74acb57e 100644
@@ -28,7 +28,6 @@ extern void blk_mq_free_tags(struct blk_mq_tags *tags);
 extern unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data);
 extern void blk_mq_put_tag(struct blk_mq_hw_ctx *hctx, struct blk_mq_tags *tags,
 			   struct blk_mq_ctx *ctx, unsigned int tag);
-extern bool blk_mq_has_free_tags(struct blk_mq_tags *tags);
 extern int blk_mq_tag_update_depth(struct blk_mq_hw_ctx *hctx,
 					struct blk_mq_tags **tags,
 					unsigned int depth, bool can_grow);
block/blk-mq.c +0 -6
index 5c9adcaa27ac..323c9cb28066 100644
@@ -260,12 +260,6 @@ void blk_mq_wake_waiters(struct request_queue *q)
 			blk_mq_tag_wakeup_all(hctx->tags, true);
 }
 
-bool blk_mq_can_queue(struct blk_mq_hw_ctx *hctx)
-{
-	return blk_mq_has_free_tags(hctx->tags);
-}
-EXPORT_SYMBOL(blk_mq_can_queue);
-
 /*
  * Only need start/end time stamping if we have iostat or
  * blk stats enabled, or using an IO scheduler.
include/linux/blk-mq.h +0 -1
index dc03e059fdff..11cfd6470b1a 100644
@@ -424,7 +424,6 @@ void blk_mq_free_tag_set(struct blk_mq_tag_set *set);
 void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule);
 
 void blk_mq_free_request(struct request *rq);
-bool blk_mq_can_queue(struct blk_mq_hw_ctx *);
 
 bool blk_mq_queue_inflight(struct request_queue *q);
 
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 2/2 sbitmap: Delete sbitmap_any_bit_clear()

In reply to John Garry

Since the only caller of this function has been deleted, delete this one also.

---
 include/linux/sbitmap.h |  9 ---------
 lib/sbitmap.c           | 17 -----------------
 2 files changed, 26 deletions(-)
include/linux/sbitmap.h +0 -9
index a986ac12a848..e40d019c3d9d 100644
@@ -216,15 +216,6 @@ int sbitmap_get_shallow(struct sbitmap *sb, unsigned int alloc_hint,
  */
 bool sbitmap_any_bit_set(const struct sbitmap *sb);
 
-/**
- * sbitmap_any_bit_clear() - Check for an unset bit in a &struct
- * sbitmap.
- * @sb: Bitmap to check.
- *
- * Return: true if any bit in the bitmap is clear, false otherwise.
- */
-bool sbitmap_any_bit_clear(const struct sbitmap *sb);
-
 #define SB_NR_TO_INDEX(sb, bitnr) ((bitnr) >> (sb)->shift)
 #define SB_NR_TO_BIT(sb, bitnr) ((bitnr) & ((1U << (sb)->shift) - 1U))
 
lib/sbitmap.c +0 -17
index 969e5400a615..33feec8989f1 100644
@@ -236,23 +236,6 @@ bool sbitmap_any_bit_set(const struct sbitmap *sb)
 }
 EXPORT_SYMBOL_GPL(sbitmap_any_bit_set);
 
-bool sbitmap_any_bit_clear(const struct sbitmap *sb)
-{
-	unsigned int i;
-
-	for (i = 0; i < sb->map_nr; i++) {
-		const struct sbitmap_word *word = &sb->map[i];
-		unsigned long mask = word->word & ~word->cleared;
-		unsigned long ret;
-
-		ret = find_first_zero_bit(&mask, word->depth);
-		if (ret < word->depth)
-			return true;
-	}
-	return false;
-}
-EXPORT_SYMBOL_GPL(sbitmap_any_bit_clear);
-
 static unsigned int __sbitmap_weight(const struct sbitmap *sb, bool set)
 {
 	unsigned int i, weight = 0;
Signature · 1 line
2.17.1
maintainer
#3 lore raw
In reply to John Garry
Quoted 2 lines · John Garry

Function blk_mq_can_queue() never seemed to ever have been referenced, so delete it and any other now-unused callees.

Great, I like killing dead code. Applied for 5.5, thanks.

Signature · 1 line
Jens Axboe