[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220224090654.54671-14-jianchao.wan9@gmail.com>
Date: Thu, 24 Feb 2022 17:06:51 +0800
From: "Wang Jianchao (Kuaishou)" <jianchao.wan9@...il.com>
To: Jens Axboe <axboe@...nel.dk>
Cc: Josef Bacik <jbacik@...com>, Tejun Heo <tj@...nel.org>,
Bart Van Assche <bvanassche@....org>,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [RFC V5 13/16] blk-wbt: move cache setting to rq_qos_setting_changed()
Move cache setting to rq_qos_setting_changed then we can avoid
to export a standalone wbt interface to blk_queue_write_cache().
Signed-off-by: Wang Jianchao (Kuaishou) <jianchao.wan9@...il.com>
---
block/blk-settings.c | 4 ++--
block/blk-wbt.c | 13 ++-----------
block/blk-wbt.h | 7 -------
3 files changed, 4 insertions(+), 20 deletions(-)
diff --git a/block/blk-settings.c b/block/blk-settings.c
index bceb1925e978..124bf5cc623f 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -16,7 +16,7 @@
#include <linux/dma-mapping.h>
#include "blk.h"
-#include "blk-wbt.h"
+#include "blk-rq-qos.h"
void blk_queue_rq_timeout(struct request_queue *q, unsigned int timeout)
{
@@ -800,7 +800,7 @@ void blk_queue_write_cache(struct request_queue *q, bool wc, bool fua)
else
blk_queue_flag_clear(QUEUE_FLAG_FUA, q);
- wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags));
+ rq_qos_setting_changed(q);
}
EXPORT_SYMBOL_GPL(blk_queue_write_cache);
diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index 3a3a683009c4..83e05417e25f 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -615,16 +615,6 @@ static void wbt_requeue(struct rq_qos *rqos, struct request *rq)
}
}
-void wbt_set_write_cache(struct request_queue *q, bool write_cache_on)
-{
- struct rq_qos *rqos = wbt_rq_qos(q);
-
- if (rqos) {
- RQWB(rqos)->wc = write_cache_on;
- rq_qos_put(rqos);
- }
-}
-
static u64 wbt_default_latency_nsec(struct request_queue *q)
{
/*
@@ -656,6 +646,7 @@ static void wbt_setting_changed(struct rq_qos *rqos)
RQWB(rqos)->rq_depth.queue_depth = blk_queue_depth(rqos->q);
wbt_update_limits(RQWB(rqos));
}
+ RQWB(rqos)->wc = test_bit(QUEUE_FLAG_WC, &rqos->q->queue_flags);
}
static ssize_t wbt_lat_show(struct request_queue *q, char *page)
@@ -844,7 +835,7 @@ static int wbt_init(struct request_queue *q)
rwb->min_lat_nsec = wbt_default_latency_nsec(q);
wbt_setting_changed(&rwb->rqos);
- wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags));
+ rwb->wc = test_bit(QUEUE_FLAG_WC, &q->queue_flags);
ret = sysfs_create_file(&q->kobj, &wbt_attr.attr);
if (ret < 0)
diff --git a/block/blk-wbt.h b/block/blk-wbt.h
index fe26f78390bd..eb837dfd0ace 100644
--- a/block/blk-wbt.h
+++ b/block/blk-wbt.h
@@ -74,17 +74,10 @@ static inline unsigned int wbt_inflight(struct rq_wb *rwb)
}
#ifdef CONFIG_BLK_WBT
-
-void wbt_set_write_cache(struct request_queue *, bool);
-
#else
-
static inline void wbt_track(struct request *rq, enum wbt_flags flags)
{
}
-static inline void wbt_set_write_cache(struct request_queue *q, bool wc)
-{
-}
#endif /* CONFIG_BLK_WBT */
#endif
--
2.17.1
Powered by blists - more mailing lists