lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220224090654.54671-13-jianchao.wan9@gmail.com>
Date:   Thu, 24 Feb 2022 17:06:50 +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 12/16] blk/rq-qos: change queue_depth_changed to setting_changed

Change the callback .queue_depth_changed() to .setting_changed().
Then all of the queue setting changes can be involved.

Signed-off-by: Wang Jianchao (Kuaishou) <jianchao.wan9@...il.com>
---
 block/blk-iocost.c   |  4 ++--
 block/blk-rq-qos.c   |  6 +++---
 block/blk-rq-qos.h   |  8 ++++----
 block/blk-settings.c |  2 +-
 block/blk-wbt.c      | 12 +++++++-----
 5 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 886c03383444..ad1d4d9762bd 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -2793,7 +2793,7 @@ static void ioc_rqos_done(struct rq_qos *rqos, struct request *rq)
 	put_cpu_ptr(ccs);
 }
 
-static void ioc_rqos_queue_depth_changed(struct rq_qos *rqos)
+static void ioc_rqos_setting_changed(struct rq_qos *rqos)
 {
 	struct ioc *ioc = rqos_to_ioc(rqos);
 
@@ -2885,7 +2885,7 @@ static struct rq_qos_ops ioc_rqos_ops = {
 	.merge = ioc_rqos_merge,
 	.done_bio = ioc_rqos_done_bio,
 	.done = ioc_rqos_done,
-	.queue_depth_changed = ioc_rqos_queue_depth_changed,
+	.setting_changed = ioc_rqos_setting_changed,
 	.exit = ioc_rqos_exit,
 	.init = blk_iocost_init,
 };
diff --git a/block/blk-rq-qos.c b/block/blk-rq-qos.c
index 03f2e654cd17..236ecb2af845 100644
--- a/block/blk-rq-qos.c
+++ b/block/blk-rq-qos.c
@@ -104,11 +104,11 @@ void __rq_qos_done_bio(struct rq_qos *rqos, struct bio *bio)
 	} while (rqos);
 }
 
-void __rq_qos_queue_depth_changed(struct rq_qos *rqos)
+void __rq_qos_setting_changed(struct rq_qos *rqos)
 {
 	do {
-		if (rqos->ops->queue_depth_changed)
-			rqos->ops->queue_depth_changed(rqos);
+		if (rqos->ops->setting_changed)
+			rqos->ops->setting_changed(rqos);
 		rqos = rqos->next;
 	} while (rqos);
 }
diff --git a/block/blk-rq-qos.h b/block/blk-rq-qos.h
index 58aba16c7d32..3d7df14edde3 100644
--- a/block/blk-rq-qos.h
+++ b/block/blk-rq-qos.h
@@ -42,7 +42,7 @@ struct rq_qos_ops {
 	void (*done)(struct rq_qos *, struct request *);
 	void (*done_bio)(struct rq_qos *, struct bio *);
 	void (*cleanup)(struct rq_qos *, struct bio *);
-	void (*queue_depth_changed)(struct rq_qos *);
+	void (*setting_changed)(struct rq_qos *);
 	void (*exit)(struct rq_qos *);
 	int (*init)(struct request_queue *);
 	const struct blk_mq_debugfs_attr *debugfs_attrs;
@@ -94,7 +94,7 @@ void __rq_qos_throttle(struct rq_qos *rqos, struct bio *bio);
 void __rq_qos_track(struct rq_qos *rqos, struct request *rq, struct bio *bio);
 void __rq_qos_merge(struct rq_qos *rqos, struct request *rq, struct bio *bio);
 void __rq_qos_done_bio(struct rq_qos *rqos, struct bio *bio);
-void __rq_qos_queue_depth_changed(struct rq_qos *rqos);
+void __rq_qos_setting_changed(struct rq_qos *rqos);
 
 static inline void rq_qos_cleanup(struct request_queue *q, struct bio *bio)
 {
@@ -152,7 +152,7 @@ static inline void rq_qos_merge(struct request_queue *q, struct request *rq,
 		__rq_qos_merge(q->rq_qos, rq, bio);
 }
 
-static inline void rq_qos_queue_depth_changed(struct request_queue *q)
+static inline void rq_qos_setting_changed(struct request_queue *q)
 {
 	/*
 	 * It is called by external module, protect the rqos list with
@@ -160,7 +160,7 @@ static inline void rq_qos_queue_depth_changed(struct request_queue *q)
 	 */
 	mutex_lock(&q->sysfs_lock);
 	if (q->rq_qos)
-		__rq_qos_queue_depth_changed(q->rq_qos);
+		__rq_qos_setting_changed(q->rq_qos);
 	mutex_unlock(&q->sysfs_lock);
 }
 
diff --git a/block/blk-settings.c b/block/blk-settings.c
index b880c70e22e4..bceb1925e978 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -777,7 +777,7 @@ EXPORT_SYMBOL(blk_queue_update_dma_alignment);
 void blk_set_queue_depth(struct request_queue *q, unsigned int depth)
 {
 	q->queue_depth = depth;
-	rq_qos_queue_depth_changed(q);
+	rq_qos_setting_changed(q);
 }
 EXPORT_SYMBOL(blk_set_queue_depth);
 
diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index 6c0a85ddb107..3a3a683009c4 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -650,10 +650,12 @@ static int wbt_data_dir(const struct request *rq)
 	return -1;
 }
 
-static void wbt_queue_depth_changed(struct rq_qos *rqos)
+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));
+	if (RQWB(rqos)->rq_depth.queue_depth != blk_queue_depth(rqos->q)) {
+		RQWB(rqos)->rq_depth.queue_depth = blk_queue_depth(rqos->q);
+		wbt_update_limits(RQWB(rqos));
+	}
 }
 
 static ssize_t wbt_lat_show(struct request_queue *q, char *page)
@@ -841,7 +843,7 @@ static int wbt_init(struct request_queue *q)
 
 	rwb->min_lat_nsec = wbt_default_latency_nsec(q);
 
-	wbt_queue_depth_changed(&rwb->rqos);
+	wbt_setting_changed(&rwb->rqos);
 	wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags));
 
 	ret = sysfs_create_file(&q->kobj, &wbt_attr.attr);
@@ -859,7 +861,7 @@ static struct rq_qos_ops wbt_rqos_ops = {
 	.requeue = wbt_requeue,
 	.done = wbt_done,
 	.cleanup = wbt_cleanup,
-	.queue_depth_changed = wbt_queue_depth_changed,
+	.setting_changed = wbt_setting_changed,
 	.exit = wbt_exit,
 	.init = wbt_init,
 #ifdef CONFIG_BLK_DEBUG_FS
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ