Linux-Block Archive mirror
 help / color / mirror / Atom feed
* [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup
@ 2023-05-27  1:06 Yu Kuai
  2023-05-27  1:06 ` [PATCH -next v3 1/5] blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled Yu Kuai
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Yu Kuai @ 2023-05-27  1:06 UTC (permalink / raw
  To: hch, axboe
  Cc: cgroups, linux-block, linux-kernel, yukuai3, yukuai1, yi.zhang,
	yangerkun

From: Yu Kuai <yukuai3@huawei.com>

Changes in v3:
 - patch 1 from v2 is sent separately, and it's removd from this series.
 - add review tag for all the patches.

Changes in v2:
 - make the code more readable for patch 1
 - add a new attr_group that is only visible for rq based device
 - explain in detail for patch 4
 - add review tag for patch 2,3,5

Yu Kuai (5):
  blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled
  blk-wbt: remove dead code to handle wbt enable/disable with io
    inflight
  blk-wbt: cleanup rwb_enabled() and wbt_disabled()
  blk-iocost: move wbt_enable/disable_default() out of spinlock
  blk-sysfs: add a new attr_group for blk_mq

 block/blk-iocost.c |   7 +-
 block/blk-sysfs.c  | 181 ++++++++++++++++++++++++++-------------------
 block/blk-wbt.c    |  21 +-----
 block/blk-wbt.h    |  19 -----
 4 files changed, 110 insertions(+), 118 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH -next v3 1/5] blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled
  2023-05-27  1:06 [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup Yu Kuai
@ 2023-05-27  1:06 ` Yu Kuai
  2023-05-27  1:06 ` [PATCH -next v3 2/5] blk-wbt: remove dead code to handle wbt enable/disable with io inflight Yu Kuai
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Yu Kuai @ 2023-05-27  1:06 UTC (permalink / raw
  To: hch, axboe
  Cc: cgroups, linux-block, linux-kernel, yukuai3, yukuai1, yi.zhang,
	yangerkun

From: Yu Kuai <yukuai3@huawei.com>

sysfs entry /sys/block/[device]/queue/wbt_lat_usec will be created even
if CONFIG_BLK_WBT is disabled, while read and write will always fail.
It doesn't make sense to create a sysfs entry that can't be accessed,
so don't create such entry.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-sysfs.c | 143 ++++++++++++++++++++++++----------------------
 block/blk-wbt.h   |  19 ------
 2 files changed, 74 insertions(+), 88 deletions(-)

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index a64208583853..6c1c4ba66bc0 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -47,19 +47,6 @@ queue_var_store(unsigned long *var, const char *page, size_t count)
 	return count;
 }
 
-static ssize_t queue_var_store64(s64 *var, const char *page)
-{
-	int err;
-	s64 v;
-
-	err = kstrtos64(page, 10, &v);
-	if (err < 0)
-		return err;
-
-	*var = v;
-	return 0;
-}
-
 static ssize_t queue_requests_show(struct request_queue *q, char *page)
 {
 	return queue_var_show(q->nr_requests, page);
@@ -451,61 +438,6 @@ static ssize_t queue_io_timeout_store(struct request_queue *q, const char *page,
 	return count;
 }
 
-static ssize_t queue_wb_lat_show(struct request_queue *q, char *page)
-{
-	if (!wbt_rq_qos(q))
-		return -EINVAL;
-
-	if (wbt_disabled(q))
-		return sprintf(page, "0\n");
-
-	return sprintf(page, "%llu\n", div_u64(wbt_get_min_lat(q), 1000));
-}
-
-static ssize_t queue_wb_lat_store(struct request_queue *q, const char *page,
-				  size_t count)
-{
-	struct rq_qos *rqos;
-	ssize_t ret;
-	s64 val;
-
-	ret = queue_var_store64(&val, page);
-	if (ret < 0)
-		return ret;
-	if (val < -1)
-		return -EINVAL;
-
-	rqos = wbt_rq_qos(q);
-	if (!rqos) {
-		ret = wbt_init(q->disk);
-		if (ret)
-			return ret;
-	}
-
-	if (val == -1)
-		val = wbt_default_latency_nsec(q);
-	else if (val >= 0)
-		val *= 1000ULL;
-
-	if (wbt_get_min_lat(q) == val)
-		return count;
-
-	/*
-	 * Ensure that the queue is idled, in case the latency update
-	 * ends up either enabling or disabling wbt completely. We can't
-	 * have IO inflight if that happens.
-	 */
-	blk_mq_freeze_queue(q);
-	blk_mq_quiesce_queue(q);
-
-	wbt_set_min_lat(q, val);
-
-	blk_mq_unquiesce_queue(q);
-	blk_mq_unfreeze_queue(q);
-
-	return count;
-}
-
 static ssize_t queue_wc_show(struct request_queue *q, char *page)
 {
 	if (test_bit(QUEUE_FLAG_WC, &q->queue_flags))
@@ -598,7 +530,6 @@ QUEUE_RW_ENTRY(queue_wc, "write_cache");
 QUEUE_RO_ENTRY(queue_fua, "fua");
 QUEUE_RO_ENTRY(queue_dax, "dax");
 QUEUE_RW_ENTRY(queue_io_timeout, "io_timeout");
-QUEUE_RW_ENTRY(queue_wb_lat, "wbt_lat_usec");
 QUEUE_RO_ENTRY(queue_virt_boundary_mask, "virt_boundary_mask");
 QUEUE_RO_ENTRY(queue_dma_alignment, "dma_alignment");
 
@@ -617,6 +548,78 @@ QUEUE_RW_ENTRY(queue_iostats, "iostats");
 QUEUE_RW_ENTRY(queue_random, "add_random");
 QUEUE_RW_ENTRY(queue_stable_writes, "stable_writes");
 
+#ifdef CONFIG_BLK_WBT
+static ssize_t queue_var_store64(s64 *var, const char *page)
+{
+	int err;
+	s64 v;
+
+	err = kstrtos64(page, 10, &v);
+	if (err < 0)
+		return err;
+
+	*var = v;
+	return 0;
+}
+
+static ssize_t queue_wb_lat_show(struct request_queue *q, char *page)
+{
+	if (!wbt_rq_qos(q))
+		return -EINVAL;
+
+	if (wbt_disabled(q))
+		return sprintf(page, "0\n");
+
+	return sprintf(page, "%llu\n", div_u64(wbt_get_min_lat(q), 1000));
+}
+
+static ssize_t queue_wb_lat_store(struct request_queue *q, const char *page,
+				  size_t count)
+{
+	struct rq_qos *rqos;
+	ssize_t ret;
+	s64 val;
+
+	ret = queue_var_store64(&val, page);
+	if (ret < 0)
+		return ret;
+	if (val < -1)
+		return -EINVAL;
+
+	rqos = wbt_rq_qos(q);
+	if (!rqos) {
+		ret = wbt_init(q->disk);
+		if (ret)
+			return ret;
+	}
+
+	if (val == -1)
+		val = wbt_default_latency_nsec(q);
+	else if (val >= 0)
+		val *= 1000ULL;
+
+	if (wbt_get_min_lat(q) == val)
+		return count;
+
+	/*
+	 * Ensure that the queue is idled, in case the latency update
+	 * ends up either enabling or disabling wbt completely. We can't
+	 * have IO inflight if that happens.
+	 */
+	blk_mq_freeze_queue(q);
+	blk_mq_quiesce_queue(q);
+
+	wbt_set_min_lat(q, val);
+
+	blk_mq_unquiesce_queue(q);
+	blk_mq_unfreeze_queue(q);
+
+	return count;
+}
+
+QUEUE_RW_ENTRY(queue_wb_lat, "wbt_lat_usec");
+#endif
+
 static struct attribute *queue_attrs[] = {
 	&queue_requests_entry.attr,
 	&queue_ra_entry.attr,
@@ -655,7 +658,9 @@ static struct attribute *queue_attrs[] = {
 	&queue_wc_entry.attr,
 	&queue_fua_entry.attr,
 	&queue_dax_entry.attr,
+#ifdef CONFIG_BLK_WBT
 	&queue_wb_lat_entry.attr,
+#endif
 	&queue_poll_delay_entry.attr,
 	&queue_io_timeout_entry.attr,
 #ifdef CONFIG_BLK_DEV_THROTTLING_LOW
diff --git a/block/blk-wbt.h b/block/blk-wbt.h
index ba6cca5849a6..8a029e138f7a 100644
--- a/block/blk-wbt.h
+++ b/block/blk-wbt.h
@@ -18,10 +18,6 @@ u64 wbt_default_latency_nsec(struct request_queue *);
 
 #else
 
-static inline int wbt_init(struct gendisk *disk)
-{
-	return -EINVAL;
-}
 static inline void wbt_disable_default(struct gendisk *disk)
 {
 }
@@ -31,21 +27,6 @@ static inline void wbt_enable_default(struct gendisk *disk)
 static inline void wbt_set_write_cache(struct request_queue *q, bool wc)
 {
 }
-static inline u64 wbt_get_min_lat(struct request_queue *q)
-{
-	return 0;
-}
-static inline void wbt_set_min_lat(struct request_queue *q, u64 val)
-{
-}
-static inline u64 wbt_default_latency_nsec(struct request_queue *q)
-{
-	return 0;
-}
-static inline bool wbt_disabled(struct request_queue *q)
-{
-	return true;
-}
 
 #endif /* CONFIG_BLK_WBT */
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH -next v3 2/5] blk-wbt: remove dead code to handle wbt enable/disable with io inflight
  2023-05-27  1:06 [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup Yu Kuai
  2023-05-27  1:06 ` [PATCH -next v3 1/5] blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled Yu Kuai
@ 2023-05-27  1:06 ` Yu Kuai
  2023-05-27  1:06 ` [PATCH -next v3 3/5] blk-wbt: cleanup rwb_enabled() and wbt_disabled() Yu Kuai
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Yu Kuai @ 2023-05-27  1:06 UTC (permalink / raw
  To: hch, axboe
  Cc: cgroups, linux-block, linux-kernel, yukuai3, yukuai1, yi.zhang,
	yangerkun

From: Yu Kuai <yukuai3@huawei.com>

enable or disable wbt is always called with queue freezed, so that wbt
can never be enabled or disabled while io is still inflight, and this
behaviour should always hold to avoid io hang(There have been reported
several times).

Therefor, the code to handle wbt enable/diskble with io inflight is not
and never will be used, hence remove such dead code.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-wbt.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index 9ec2a2f1eda3..cb464c572840 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -200,15 +200,6 @@ static void wbt_rqw_done(struct rq_wb *rwb, struct rq_wait *rqw,
 
 	inflight = atomic_dec_return(&rqw->inflight);
 
-	/*
-	 * wbt got disabled with IO in flight. Wake up any potential
-	 * waiters, we don't have to do more than that.
-	 */
-	if (unlikely(!rwb_enabled(rwb))) {
-		rwb_wake_all(rwb);
-		return;
-	}
-
 	/*
 	 * For discards, our limit is always the background. For writes, if
 	 * the device does write back caching, drop further down before we
@@ -545,13 +536,6 @@ static inline unsigned int get_limit(struct rq_wb *rwb, blk_opf_t opf)
 {
 	unsigned int limit;
 
-	/*
-	 * If we got disabled, just return UINT_MAX. This ensures that
-	 * we'll properly inc a new IO, and dec+wakeup at the end.
-	 */
-	if (!rwb_enabled(rwb))
-		return UINT_MAX;
-
 	if ((opf & REQ_OP_MASK) == REQ_OP_DISCARD)
 		return rwb->wb_background;
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH -next v3 3/5] blk-wbt: cleanup rwb_enabled() and wbt_disabled()
  2023-05-27  1:06 [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup Yu Kuai
  2023-05-27  1:06 ` [PATCH -next v3 1/5] blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled Yu Kuai
  2023-05-27  1:06 ` [PATCH -next v3 2/5] blk-wbt: remove dead code to handle wbt enable/disable with io inflight Yu Kuai
@ 2023-05-27  1:06 ` Yu Kuai
  2023-05-27  1:06 ` [PATCH -next v3 4/5] blk-iocost: move wbt_enable/disable_default() out of spinlock Yu Kuai
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Yu Kuai @ 2023-05-27  1:06 UTC (permalink / raw
  To: hch, axboe
  Cc: cgroups, linux-block, linux-kernel, yukuai3, yukuai1, yi.zhang,
	yangerkun

From: Yu Kuai <yukuai3@huawei.com>

'wb_normal' will set to 0 if 'min_lat_nsec' is 0, and 'min_lat_nsec' can
only be set to 0 through sysfs configuration where 'WBT_STATE_OFF_MANUAL'
is set together, in the meantime, they can only be cleared together
through sysfs afterwards. Hence 'wb_normal != 0' is the same as
'rwb->enable_state != WBT_STATE_OFF_MANUAL'.

The code is redundan, hence replace the checking of 'wb_normal' to
'enable_state' in rwb_enabled() and reuse rwb_enabled() for
wbt_disabled().

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-wbt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index cb464c572840..06d400fa050d 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -146,7 +146,7 @@ enum {
 static inline bool rwb_enabled(struct rq_wb *rwb)
 {
 	return rwb && rwb->enable_state != WBT_STATE_OFF_DEFAULT &&
-		      rwb->wb_normal != 0;
+		      rwb->enable_state != WBT_STATE_OFF_MANUAL;
 }
 
 static void wb_timestamp(struct rq_wb *rwb, unsigned long *var)
@@ -494,8 +494,7 @@ bool wbt_disabled(struct request_queue *q)
 {
 	struct rq_qos *rqos = wbt_rq_qos(q);
 
-	return !rqos || RQWB(rqos)->enable_state == WBT_STATE_OFF_DEFAULT ||
-	       RQWB(rqos)->enable_state == WBT_STATE_OFF_MANUAL;
+	return !rqos || !rwb_enabled(RQWB(rqos));
 }
 
 u64 wbt_get_min_lat(struct request_queue *q)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH -next v3 4/5] blk-iocost: move wbt_enable/disable_default() out of spinlock
  2023-05-27  1:06 [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup Yu Kuai
                   ` (2 preceding siblings ...)
  2023-05-27  1:06 ` [PATCH -next v3 3/5] blk-wbt: cleanup rwb_enabled() and wbt_disabled() Yu Kuai
@ 2023-05-27  1:06 ` Yu Kuai
  2023-05-27  1:06 ` [PATCH -next v3 5/5] blk-sysfs: add a new attr_group for blk_mq Yu Kuai
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Yu Kuai @ 2023-05-27  1:06 UTC (permalink / raw
  To: hch, axboe
  Cc: cgroups, linux-block, linux-kernel, yukuai3, yukuai1, yi.zhang,
	yangerkun

From: Yu Kuai <yukuai3@huawei.com>

There are following smatch warning:

block/blk-wbt.c:843 wbt_init() warn: sleeping in atomic context
ioc_qos_write() <- disables preempt
-> wbt_enable_default()
   -> wbt_init()

wbt_init() will be called from wbt_enable_default() if wbt is not
initialized, currently this is only possible in blk_register_queue(), hence
wbt_init() will never be called from iocost and this warning is false
positive.

However, we might support rq_qos destruction dynamically in the future,
and it's better to prevent that, hence move wbt_enable_default() outside
'ioc->lock'. This is safe because queue is still freezed.

Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/lkml/Y+Ja5SRs886CEz7a@kadam/
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-iocost.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 285ced3467ab..eb57e7e4f2db 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -3300,11 +3300,9 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
 		blk_stat_enable_accounting(disk->queue);
 		blk_queue_flag_set(QUEUE_FLAG_RQ_ALLOC_TIME, disk->queue);
 		ioc->enabled = true;
-		wbt_disable_default(disk);
 	} else {
 		blk_queue_flag_clear(QUEUE_FLAG_RQ_ALLOC_TIME, disk->queue);
 		ioc->enabled = false;
-		wbt_enable_default(disk);
 	}
 
 	if (user) {
@@ -3317,6 +3315,11 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
 	ioc_refresh_params(ioc, true);
 	spin_unlock_irq(&ioc->lock);
 
+	if (enable)
+		wbt_disable_default(disk);
+	else
+		wbt_enable_default(disk);
+
 	blk_mq_unquiesce_queue(disk->queue);
 	blk_mq_unfreeze_queue(disk->queue);
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH -next v3 5/5] blk-sysfs: add a new attr_group for blk_mq
  2023-05-27  1:06 [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup Yu Kuai
                   ` (3 preceding siblings ...)
  2023-05-27  1:06 ` [PATCH -next v3 4/5] blk-iocost: move wbt_enable/disable_default() out of spinlock Yu Kuai
@ 2023-05-27  1:06 ` Yu Kuai
  2023-06-08  2:36 ` [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup Yu Kuai
  2023-06-26 15:53 ` Jens Axboe
  6 siblings, 0 replies; 9+ messages in thread
From: Yu Kuai @ 2023-05-27  1:06 UTC (permalink / raw
  To: hch, axboe
  Cc: cgroups, linux-block, linux-kernel, yukuai3, yukuai1, yi.zhang,
	yangerkun

From: Yu Kuai <yukuai3@huawei.com>

Currently wbt sysfs entry is created for bio based device, and wbt can
be enabled for such device through sysfs while it doesn't make sense
because wbt can only work for rq based device. In the meantime, there
are other similar sysfs entries.

Fix this by adding a new attr_group for blk_mq, and sysfs entries will
only be created when the device is rq based.

Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-sysfs.c | 42 +++++++++++++++++++++++++++++++-----------
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 6c1c4ba66bc0..afc797fb0dfc 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -621,7 +621,6 @@ QUEUE_RW_ENTRY(queue_wb_lat, "wbt_lat_usec");
 #endif
 
 static struct attribute *queue_attrs[] = {
-	&queue_requests_entry.attr,
 	&queue_ra_entry.attr,
 	&queue_max_hw_sectors_entry.attr,
 	&queue_max_sectors_entry.attr,
@@ -629,7 +628,6 @@ static struct attribute *queue_attrs[] = {
 	&queue_max_discard_segments_entry.attr,
 	&queue_max_integrity_segments_entry.attr,
 	&queue_max_segment_size_entry.attr,
-	&elv_iosched_entry.attr,
 	&queue_hw_sector_size_entry.attr,
 	&queue_logical_block_size_entry.attr,
 	&queue_physical_block_size_entry.attr,
@@ -650,7 +648,6 @@ static struct attribute *queue_attrs[] = {
 	&queue_max_open_zones_entry.attr,
 	&queue_max_active_zones_entry.attr,
 	&queue_nomerges_entry.attr,
-	&queue_rq_affinity_entry.attr,
 	&queue_iostats_entry.attr,
 	&queue_stable_writes_entry.attr,
 	&queue_random_entry.attr,
@@ -658,11 +655,7 @@ static struct attribute *queue_attrs[] = {
 	&queue_wc_entry.attr,
 	&queue_fua_entry.attr,
 	&queue_dax_entry.attr,
-#ifdef CONFIG_BLK_WBT
-	&queue_wb_lat_entry.attr,
-#endif
 	&queue_poll_delay_entry.attr,
-	&queue_io_timeout_entry.attr,
 #ifdef CONFIG_BLK_DEV_THROTTLING_LOW
 	&blk_throtl_sample_time_entry.attr,
 #endif
@@ -671,16 +664,23 @@ static struct attribute *queue_attrs[] = {
 	NULL,
 };
 
+static struct attribute *blk_mq_queue_attrs[] = {
+	&queue_requests_entry.attr,
+	&elv_iosched_entry.attr,
+	&queue_rq_affinity_entry.attr,
+	&queue_io_timeout_entry.attr,
+#ifdef CONFIG_BLK_WBT
+	&queue_wb_lat_entry.attr,
+#endif
+	NULL,
+};
+
 static umode_t queue_attr_visible(struct kobject *kobj, struct attribute *attr,
 				int n)
 {
 	struct gendisk *disk = container_of(kobj, struct gendisk, queue_kobj);
 	struct request_queue *q = disk->queue;
 
-	if (attr == &queue_io_timeout_entry.attr &&
-		(!q->mq_ops || !q->mq_ops->timeout))
-			return 0;
-
 	if ((attr == &queue_max_open_zones_entry.attr ||
 	     attr == &queue_max_active_zones_entry.attr) &&
 	    !blk_queue_is_zoned(q))
@@ -689,11 +689,30 @@ static umode_t queue_attr_visible(struct kobject *kobj, struct attribute *attr,
 	return attr->mode;
 }
 
+static umode_t blk_mq_queue_attr_visible(struct kobject *kobj,
+					 struct attribute *attr, int n)
+{
+	struct gendisk *disk = container_of(kobj, struct gendisk, queue_kobj);
+	struct request_queue *q = disk->queue;
+
+	if (!queue_is_mq(q))
+		return 0;
+
+	if (attr == &queue_io_timeout_entry.attr && !q->mq_ops->timeout)
+		return 0;
+
+	return attr->mode;
+}
+
 static struct attribute_group queue_attr_group = {
 	.attrs = queue_attrs,
 	.is_visible = queue_attr_visible,
 };
 
+static struct attribute_group blk_mq_queue_attr_group = {
+	.attrs = blk_mq_queue_attrs,
+	.is_visible = blk_mq_queue_attr_visible,
+};
 
 #define to_queue(atr) container_of((atr), struct queue_sysfs_entry, attr)
 
@@ -738,6 +757,7 @@ static const struct sysfs_ops queue_sysfs_ops = {
 
 static const struct attribute_group *blk_queue_attr_groups[] = {
 	&queue_attr_group,
+	&blk_mq_queue_attr_group,
 	NULL
 };
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup
  2023-05-27  1:06 [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup Yu Kuai
                   ` (4 preceding siblings ...)
  2023-05-27  1:06 ` [PATCH -next v3 5/5] blk-sysfs: add a new attr_group for blk_mq Yu Kuai
@ 2023-06-08  2:36 ` Yu Kuai
  2023-06-26  2:46   ` Yu Kuai
  2023-06-26 15:53 ` Jens Axboe
  6 siblings, 1 reply; 9+ messages in thread
From: Yu Kuai @ 2023-06-08  2:36 UTC (permalink / raw
  To: Yu Kuai, hch, axboe
  Cc: cgroups, linux-block, linux-kernel, yi.zhang, yangerkun,
	yukuai (C)

Hi, Jens

Can you apply this patchset?

Thanks,
Kuai

在 2023/05/27 9:06, Yu Kuai 写道:
> From: Yu Kuai <yukuai3@huawei.com>
> 
> Changes in v3:
>   - patch 1 from v2 is sent separately, and it's removd from this series.
>   - add review tag for all the patches.
> 
> Changes in v2:
>   - make the code more readable for patch 1
>   - add a new attr_group that is only visible for rq based device
>   - explain in detail for patch 4
>   - add review tag for patch 2,3,5
> 
> Yu Kuai (5):
>    blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled
>    blk-wbt: remove dead code to handle wbt enable/disable with io
>      inflight
>    blk-wbt: cleanup rwb_enabled() and wbt_disabled()
>    blk-iocost: move wbt_enable/disable_default() out of spinlock
>    blk-sysfs: add a new attr_group for blk_mq
> 
>   block/blk-iocost.c |   7 +-
>   block/blk-sysfs.c  | 181 ++++++++++++++++++++++++++-------------------
>   block/blk-wbt.c    |  21 +-----
>   block/blk-wbt.h    |  19 -----
>   4 files changed, 110 insertions(+), 118 deletions(-)
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup
  2023-06-08  2:36 ` [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup Yu Kuai
@ 2023-06-26  2:46   ` Yu Kuai
  0 siblings, 0 replies; 9+ messages in thread
From: Yu Kuai @ 2023-06-26  2:46 UTC (permalink / raw
  To: Yu Kuai, hch, axboe
  Cc: cgroups, linux-block, linux-kernel, yi.zhang, yangerkun,
	yukuai (C)

Hi, Jens

在 2023/06/08 10:36, Yu Kuai 写道:
> Hi, Jens
> 
> Can you apply this patchset?

The only fix from this patchset is applied separately, so this patchset
is just simple cleanups now, can you please consider this for the next
merge window?

Thanks,
Kuai
> 
> Thanks,
> Kuai
> 
> 在 2023/05/27 9:06, Yu Kuai 写道:
>> From: Yu Kuai <yukuai3@huawei.com>
>>
>> Changes in v3:
>>   - patch 1 from v2 is sent separately, and it's removd from this series.
>>   - add review tag for all the patches.
>>
>> Changes in v2:
>>   - make the code more readable for patch 1
>>   - add a new attr_group that is only visible for rq based device
>>   - explain in detail for patch 4
>>   - add review tag for patch 2,3,5
>>
>> Yu Kuai (5):
>>    blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled
>>    blk-wbt: remove dead code to handle wbt enable/disable with io
>>      inflight
>>    blk-wbt: cleanup rwb_enabled() and wbt_disabled()
>>    blk-iocost: move wbt_enable/disable_default() out of spinlock
>>    blk-sysfs: add a new attr_group for blk_mq
>>
>>   block/blk-iocost.c |   7 +-
>>   block/blk-sysfs.c  | 181 ++++++++++++++++++++++++++-------------------
>>   block/blk-wbt.c    |  21 +-----
>>   block/blk-wbt.h    |  19 -----
>>   4 files changed, 110 insertions(+), 118 deletions(-)
>>
> 
> .
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup
  2023-05-27  1:06 [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup Yu Kuai
                   ` (5 preceding siblings ...)
  2023-06-08  2:36 ` [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup Yu Kuai
@ 2023-06-26 15:53 ` Jens Axboe
  6 siblings, 0 replies; 9+ messages in thread
From: Jens Axboe @ 2023-06-26 15:53 UTC (permalink / raw
  To: hch, Yu Kuai
  Cc: cgroups, linux-block, linux-kernel, yukuai3, yi.zhang, yangerkun


On Sat, 27 May 2023 09:06:39 +0800, Yu Kuai wrote:
> Changes in v3:
>  - patch 1 from v2 is sent separately, and it's removd from this series.
>  - add review tag for all the patches.
> 
> Changes in v2:
>  - make the code more readable for patch 1
>  - add a new attr_group that is only visible for rq based device
>  - explain in detail for patch 4
>  - add review tag for patch 2,3,5
> 
> [...]

Applied, thanks!

[1/5] blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled
      commit: 645a829e03384a235b3760959d4ebe420a0f2027
[2/5] blk-wbt: remove dead code to handle wbt enable/disable with io inflight
      commit: 71b8642e79f277459555629f2bea1a8d1fed307e
[3/5] blk-wbt: cleanup rwb_enabled() and wbt_disabled()
      commit: 06257fda83ebfd1c33fb992e41dba7be4e1184d4
[4/5] blk-iocost: move wbt_enable/disable_default() out of spinlock
      commit: eebc21d12f56c1e09a163abf91e351fa2a55a938
[5/5] blk-sysfs: add a new attr_group for blk_mq
      commit: 6d85ebf95c44e52337ca1d07f0db4b435d1e6762

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-06-26 15:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-27  1:06 [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup Yu Kuai
2023-05-27  1:06 ` [PATCH -next v3 1/5] blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled Yu Kuai
2023-05-27  1:06 ` [PATCH -next v3 2/5] blk-wbt: remove dead code to handle wbt enable/disable with io inflight Yu Kuai
2023-05-27  1:06 ` [PATCH -next v3 3/5] blk-wbt: cleanup rwb_enabled() and wbt_disabled() Yu Kuai
2023-05-27  1:06 ` [PATCH -next v3 4/5] blk-iocost: move wbt_enable/disable_default() out of spinlock Yu Kuai
2023-05-27  1:06 ` [PATCH -next v3 5/5] blk-sysfs: add a new attr_group for blk_mq Yu Kuai
2023-06-08  2:36 ` [PATCH -next v3 0/5] blk-wbt: minor fix and cleanup Yu Kuai
2023-06-26  2:46   ` Yu Kuai
2023-06-26 15:53 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).