[PATCH 11/13] blk: remove unused interfaces of blk-rq-qos

From: Wang Jianchao
Date: Mon Jan 10 2022 - 04:13:31 EST


From: Wang Jianchao <wangjianchao@xxxxxxxxxxxx>

No functional changes here

Signed-off-by: Wang Jianchao <wangjianchao@xxxxxxxxxxxx>
---
block/blk-mq-debugfs.c | 10 +-------
block/blk-rq-qos.h | 52 +-----------------------------------------
2 files changed, 2 insertions(+), 60 deletions(-)

diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index 90610a0cd25a..f4f5ca1953f3 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -817,11 +817,6 @@ void blk_mq_debugfs_unregister_sched(struct request_queue *q)
q->sched_debugfs_dir = NULL;
}

-static const char *rq_qos_id_to_name(enum rq_qos_id id)
-{
- return "unknown";
-}
-
void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos)
{
debugfs_remove_recursive(rqos->debugfs_dir);
@@ -832,9 +827,6 @@ EXPORT_SYMBOL_GPL(blk_mq_debugfs_unregister_rqos);
void blk_mq_debugfs_register_rqos(struct rq_qos *rqos)
{
struct request_queue *q = rqos->q;
- const char *dir_name;
-
- dir_name = rqos->ops->name ? rqos->ops->name : rq_qos_id_to_name(rqos->id);

if (rqos->debugfs_dir || !rqos->ops->debugfs_attrs)
return;
@@ -843,7 +835,7 @@ void blk_mq_debugfs_register_rqos(struct rq_qos *rqos)
q->rqos_debugfs_dir = debugfs_create_dir("rqos",
q->debugfs_dir);

- rqos->debugfs_dir = debugfs_create_dir(dir_name,
+ rqos->debugfs_dir = debugfs_create_dir(rqos->ops->name,
rqos->q->rqos_debugfs_dir);

debugfs_create_files(rqos->debugfs_dir, rqos, rqos->ops->debugfs_attrs);
diff --git a/block/blk-rq-qos.h b/block/blk-rq-qos.h
index ee396367a5b2..123b6b100355 100644
--- a/block/blk-rq-qos.h
+++ b/block/blk-rq-qos.h
@@ -13,10 +13,6 @@

struct blk_mq_debugfs_attr;

-enum rq_qos_id {
- RQ_QOS_UNUSED,
-};
-
struct rq_wait {
wait_queue_head_t wait;
atomic_t inflight;
@@ -28,7 +24,7 @@ struct rq_qos {
bool dying;
const struct rq_qos_ops *ops;
struct request_queue *q;
- enum rq_qos_id id;
+ int id;
struct rq_qos *next;
#ifdef CONFIG_BLK_DEBUG_FS
struct dentry *debugfs_dir;
@@ -89,52 +85,6 @@ static inline void rq_wait_init(struct rq_wait *rq_wait)
init_waitqueue_head(&rq_wait->wait);
}

-static inline void rq_qos_add(struct request_queue *q, struct rq_qos *rqos)
-{
- /*
- * No IO can be in-flight when adding rqos, so freeze queue, which
- * is fine since we only support rq_qos for blk-mq queue.
- *
- * Reuse ->queue_lock for protecting against other concurrent
- * rq_qos adding/deleting
- */
- blk_mq_freeze_queue(q);
-
- spin_lock_irq(&q->queue_lock);
- rqos->next = q->rq_qos;
- q->rq_qos = rqos;
- spin_unlock_irq(&q->queue_lock);
-
- blk_mq_unfreeze_queue(q);
-
- if (rqos->ops->debugfs_attrs)
- blk_mq_debugfs_register_rqos(rqos);
-}
-
-static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos)
-{
- struct rq_qos **cur;
-
- /*
- * See comment in rq_qos_add() about freezing queue & using
- * ->queue_lock.
- */
- blk_mq_freeze_queue(q);
-
- spin_lock_irq(&q->queue_lock);
- for (cur = &q->rq_qos; *cur; cur = &(*cur)->next) {
- if (*cur == rqos) {
- *cur = rqos->next;
- break;
- }
- }
- spin_unlock_irq(&q->queue_lock);
-
- blk_mq_unfreeze_queue(q);
-
- blk_mq_debugfs_unregister_rqos(rqos);
-}
-
int rq_qos_register(struct rq_qos_ops *ops);
void rq_qos_unregister(struct rq_qos_ops *ops);
void rq_qos_activate(struct request_queue *q,
--
2.17.1