public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] block: make some sysfs attribute instances const
@ 2026-03-16 22:43 Thomas Weißschuh
  2026-03-16 22:43 ` [PATCH 1/4] block: make queue_sysfs_entry " Thomas Weißschuh
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Thomas Weißschuh @ 2026-03-16 22:43 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, linux-kernel, Thomas Weißschuh

These attribute structures are never modified, mark them as const.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (4):
      block: make queue_sysfs_entry instances const
      block: ia-ranges: make blk_ia_range_sysfs_entry instances const
      blk-crypto: make blk_crypto_attr instances const
      blk-mq: make blk_mq_hw_ctx_sysfs_entry instances const

 block/blk-crypto-sysfs.c | 40 ++++++++++++++++++++--------------------
 block/blk-ia-ranges.c    |  6 +++---
 block/blk-mq-sysfs.c     | 10 +++++-----
 block/blk-sysfs.c        | 46 +++++++++++++++++++++++-----------------------
 4 files changed, 51 insertions(+), 51 deletions(-)
---
base-commit: 95c541ddfb0815a0ea8477af778bb13bb075079a
change-id: 20250628-b4-sysfs-const-attr-block-9cac3791238d
prerequisite-change-id: 20250114-sysfs-const-attr-prep-e9414982dc4f:v2
prerequisite-patch-id: e6bb942ab01bd8ea292bd728798170c9331fa3e7
prerequisite-patch-id: 233540a50b602b30a5a10bcaeb71127c416433b3
prerequisite-patch-id: 1a16da4318d82f598bc0b35932c9184f714e1c16
prerequisite-patch-id: 1b7ad00feff741bcb64df61a21af65f165927f8d
prerequisite-patch-id: 7a197a4d1524884a2c75a49f019f3b4535b2243c
prerequisite-patch-id: 9112b35d2ac7d0ae6f9f1cf5d2634884590507ab
prerequisite-patch-id: ab160b8b4f60f53923208365403102303f6390ff

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


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

* [PATCH 1/4] block: make queue_sysfs_entry instances const
  2026-03-16 22:43 [PATCH 0/4] block: make some sysfs attribute instances const Thomas Weißschuh
@ 2026-03-16 22:43 ` Thomas Weißschuh
  2026-03-17 16:18   ` John Garry
  2026-03-16 22:43 ` [PATCH 2/4] block: ia-ranges: make blk_ia_range_sysfs_entry " Thomas Weißschuh
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Thomas Weißschuh @ 2026-03-16 22:43 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, linux-kernel, Thomas Weißschuh

The queue_sysfs_entry structures are never modified, mark them as const.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 block/blk-sysfs.c | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 878b8a4b55bb..f22c1f253eb3 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -581,27 +581,27 @@ static int queue_wc_store(struct gendisk *disk, const char *page,
 	return 0;
 }
 
-#define QUEUE_RO_ENTRY(_prefix, _name)			\
-static struct queue_sysfs_entry _prefix##_entry = {	\
-	.attr	= { .name = _name, .mode = 0444 },	\
-	.show	= _prefix##_show,			\
+#define QUEUE_RO_ENTRY(_prefix, _name)				\
+static const struct queue_sysfs_entry _prefix##_entry = {	\
+	.attr	= { .name = _name, .mode = 0444 },		\
+	.show	= _prefix##_show,				\
 };
 
-#define QUEUE_RW_ENTRY(_prefix, _name)			\
-static struct queue_sysfs_entry _prefix##_entry = {	\
-	.attr	= { .name = _name, .mode = 0644 },	\
-	.show	= _prefix##_show,			\
-	.store	= _prefix##_store,			\
+#define QUEUE_RW_ENTRY(_prefix, _name)				\
+static const struct queue_sysfs_entry _prefix##_entry = {	\
+	.attr	= { .name = _name, .mode = 0644 },		\
+	.show	= _prefix##_show,				\
+	.store	= _prefix##_store,				\
 };
 
 #define QUEUE_LIM_RO_ENTRY(_prefix, _name)			\
-static struct queue_sysfs_entry _prefix##_entry = {	\
+static const struct queue_sysfs_entry _prefix##_entry = {	\
 	.attr		= { .name = _name, .mode = 0444 },	\
 	.show_limit	= _prefix##_show,			\
 }
 
 #define QUEUE_LIM_RW_ENTRY(_prefix, _name)			\
-static struct queue_sysfs_entry _prefix##_entry = {	\
+static const struct queue_sysfs_entry _prefix##_entry = {	\
 	.attr		= { .name = _name, .mode = 0644 },	\
 	.show_limit	= _prefix##_show,			\
 	.store_limit	= _prefix##_store,			\
@@ -665,7 +665,7 @@ QUEUE_LIM_RO_ENTRY(queue_virt_boundary_mask, "virt_boundary_mask");
 QUEUE_LIM_RO_ENTRY(queue_dma_alignment, "dma_alignment");
 
 /* legacy alias for logical_block_size: */
-static struct queue_sysfs_entry queue_hw_sector_size_entry = {
+static const struct queue_sysfs_entry queue_hw_sector_size_entry = {
 	.attr		= {.name = "hw_sector_size", .mode = 0444 },
 	.show_limit	= queue_logical_block_size_show,
 };
@@ -731,7 +731,7 @@ QUEUE_RW_ENTRY(queue_wb_lat, "wbt_lat_usec");
 #endif
 
 /* Common attributes for bio-based and request-based queues. */
-static struct attribute *queue_attrs[] = {
+static const struct attribute *const queue_attrs[] = {
 	/*
 	 * Attributes which are protected with q->limits_lock.
 	 */
@@ -791,7 +791,7 @@ static struct attribute *queue_attrs[] = {
 };
 
 /* Request-based queue attributes that are not relevant for bio-based queues. */
-static struct attribute *blk_mq_queue_attrs[] = {
+static const struct attribute *const blk_mq_queue_attrs[] = {
 	/*
 	 * Attributes which require some form of locking other than
 	 * q->sysfs_lock.
@@ -811,7 +811,7 @@ static struct attribute *blk_mq_queue_attrs[] = {
 	NULL,
 };
 
-static umode_t queue_attr_visible(struct kobject *kobj, struct attribute *attr,
+static umode_t queue_attr_visible(struct kobject *kobj, const struct attribute *attr,
 				int n)
 {
 	struct gendisk *disk = container_of(kobj, struct gendisk, queue_kobj);
@@ -827,7 +827,7 @@ static umode_t queue_attr_visible(struct kobject *kobj, struct attribute *attr,
 }
 
 static umode_t blk_mq_queue_attr_visible(struct kobject *kobj,
-					 struct attribute *attr, int n)
+					 const struct attribute *attr, int n)
 {
 	struct gendisk *disk = container_of(kobj, struct gendisk, queue_kobj);
 	struct request_queue *q = disk->queue;
@@ -841,17 +841,17 @@ static umode_t blk_mq_queue_attr_visible(struct kobject *kobj,
 	return attr->mode;
 }
 
-static struct attribute_group queue_attr_group = {
-	.attrs = queue_attrs,
-	.is_visible = queue_attr_visible,
+static const struct attribute_group queue_attr_group = {
+	.attrs_const = queue_attrs,
+	.is_visible_const = queue_attr_visible,
 };
 
-static struct attribute_group blk_mq_queue_attr_group = {
-	.attrs = blk_mq_queue_attrs,
-	.is_visible = blk_mq_queue_attr_visible,
+static const struct attribute_group blk_mq_queue_attr_group = {
+	.attrs_const = blk_mq_queue_attrs,
+	.is_visible_const = blk_mq_queue_attr_visible,
 };
 
-#define to_queue(atr) container_of((atr), struct queue_sysfs_entry, attr)
+#define to_queue(atr) container_of_const((atr), struct queue_sysfs_entry, attr)
 
 static ssize_t
 queue_attr_show(struct kobject *kobj, struct attribute *attr, char *page)

-- 
2.53.0


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

* [PATCH 2/4] block: ia-ranges: make blk_ia_range_sysfs_entry instances const
  2026-03-16 22:43 [PATCH 0/4] block: make some sysfs attribute instances const Thomas Weißschuh
  2026-03-16 22:43 ` [PATCH 1/4] block: make queue_sysfs_entry " Thomas Weißschuh
@ 2026-03-16 22:43 ` Thomas Weißschuh
  2026-03-17 16:19   ` John Garry
  2026-03-16 22:43 ` [PATCH 3/4] blk-crypto: make blk_crypto_attr " Thomas Weißschuh
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Thomas Weißschuh @ 2026-03-16 22:43 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, linux-kernel, Thomas Weißschuh

The blk_ia_range_sysfs_entry structures are never modified,
mark them as const.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 block/blk-ia-ranges.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/block/blk-ia-ranges.c b/block/blk-ia-ranges.c
index d479f5481b66..7be8b58893c9 100644
--- a/block/blk-ia-ranges.c
+++ b/block/blk-ia-ranges.c
@@ -30,17 +30,17 @@ struct blk_ia_range_sysfs_entry {
 	ssize_t (*show)(struct blk_independent_access_range *iar, char *buf);
 };
 
-static struct blk_ia_range_sysfs_entry blk_ia_range_sector_entry = {
+static const struct blk_ia_range_sysfs_entry blk_ia_range_sector_entry = {
 	.attr = { .name = "sector", .mode = 0444 },
 	.show = blk_ia_range_sector_show,
 };
 
-static struct blk_ia_range_sysfs_entry blk_ia_range_nr_sectors_entry = {
+static const struct blk_ia_range_sysfs_entry blk_ia_range_nr_sectors_entry = {
 	.attr = { .name = "nr_sectors", .mode = 0444 },
 	.show = blk_ia_range_nr_sectors_show,
 };
 
-static struct attribute *blk_ia_range_attrs[] = {
+static const struct attribute *const blk_ia_range_attrs[] = {
 	&blk_ia_range_sector_entry.attr,
 	&blk_ia_range_nr_sectors_entry.attr,
 	NULL,

-- 
2.53.0


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

* [PATCH 3/4] blk-crypto: make blk_crypto_attr instances const
  2026-03-16 22:43 [PATCH 0/4] block: make some sysfs attribute instances const Thomas Weißschuh
  2026-03-16 22:43 ` [PATCH 1/4] block: make queue_sysfs_entry " Thomas Weißschuh
  2026-03-16 22:43 ` [PATCH 2/4] block: ia-ranges: make blk_ia_range_sysfs_entry " Thomas Weißschuh
@ 2026-03-16 22:43 ` Thomas Weißschuh
  2026-03-17 16:30   ` John Garry
  2026-03-16 22:43 ` [PATCH 4/4] blk-mq: make blk_mq_hw_ctx_sysfs_entry " Thomas Weißschuh
  2026-03-18  1:32 ` [PATCH 0/4] block: make some sysfs attribute " Jens Axboe
  4 siblings, 1 reply; 10+ messages in thread
From: Thomas Weißschuh @ 2026-03-16 22:43 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, linux-kernel, Thomas Weißschuh

The blk_crypto_attrs structures are never modified, mark them as const.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 block/blk-crypto-sysfs.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/block/blk-crypto-sysfs.c b/block/blk-crypto-sysfs.c
index ea7a0b85a46f..b069c418b6cc 100644
--- a/block/blk-crypto-sysfs.c
+++ b/block/blk-crypto-sysfs.c
@@ -18,7 +18,7 @@ struct blk_crypto_kobj {
 struct blk_crypto_attr {
 	struct attribute attr;
 	ssize_t (*show)(struct blk_crypto_profile *profile,
-			struct blk_crypto_attr *attr, char *page);
+			const struct blk_crypto_attr *attr, char *page);
 };
 
 static struct blk_crypto_profile *kobj_to_crypto_profile(struct kobject *kobj)
@@ -26,39 +26,39 @@ static struct blk_crypto_profile *kobj_to_crypto_profile(struct kobject *kobj)
 	return container_of(kobj, struct blk_crypto_kobj, kobj)->profile;
 }
 
-static struct blk_crypto_attr *attr_to_crypto_attr(struct attribute *attr)
+static const struct blk_crypto_attr *attr_to_crypto_attr(const struct attribute *attr)
 {
-	return container_of(attr, struct blk_crypto_attr, attr);
+	return container_of_const(attr, struct blk_crypto_attr, attr);
 }
 
 static ssize_t hw_wrapped_keys_show(struct blk_crypto_profile *profile,
-				    struct blk_crypto_attr *attr, char *page)
+				    const struct blk_crypto_attr *attr, char *page)
 {
 	/* Always show supported, since the file doesn't exist otherwise. */
 	return sysfs_emit(page, "supported\n");
 }
 
 static ssize_t max_dun_bits_show(struct blk_crypto_profile *profile,
-				 struct blk_crypto_attr *attr, char *page)
+				 const struct blk_crypto_attr *attr, char *page)
 {
 	return sysfs_emit(page, "%u\n", 8 * profile->max_dun_bytes_supported);
 }
 
 static ssize_t num_keyslots_show(struct blk_crypto_profile *profile,
-				 struct blk_crypto_attr *attr, char *page)
+				 const struct blk_crypto_attr *attr, char *page)
 {
 	return sysfs_emit(page, "%u\n", profile->num_slots);
 }
 
 static ssize_t raw_keys_show(struct blk_crypto_profile *profile,
-			     struct blk_crypto_attr *attr, char *page)
+			     const struct blk_crypto_attr *attr, char *page)
 {
 	/* Always show supported, since the file doesn't exist otherwise. */
 	return sysfs_emit(page, "supported\n");
 }
 
 #define BLK_CRYPTO_RO_ATTR(_name) \
-	static struct blk_crypto_attr _name##_attr = __ATTR_RO(_name)
+	static const struct blk_crypto_attr _name##_attr = __ATTR_RO(_name)
 
 BLK_CRYPTO_RO_ATTR(hw_wrapped_keys);
 BLK_CRYPTO_RO_ATTR(max_dun_bits);
@@ -66,10 +66,10 @@ BLK_CRYPTO_RO_ATTR(num_keyslots);
 BLK_CRYPTO_RO_ATTR(raw_keys);
 
 static umode_t blk_crypto_is_visible(struct kobject *kobj,
-				     struct attribute *attr, int n)
+				     const struct attribute *attr, int n)
 {
 	struct blk_crypto_profile *profile = kobj_to_crypto_profile(kobj);
-	struct blk_crypto_attr *a = attr_to_crypto_attr(attr);
+	const struct blk_crypto_attr *a = attr_to_crypto_attr(attr);
 
 	if (a == &hw_wrapped_keys_attr &&
 	    !(profile->key_types_supported & BLK_CRYPTO_KEY_TYPE_HW_WRAPPED))
@@ -81,7 +81,7 @@ static umode_t blk_crypto_is_visible(struct kobject *kobj,
 	return 0444;
 }
 
-static struct attribute *blk_crypto_attrs[] = {
+static const struct attribute *const blk_crypto_attrs[] = {
 	&hw_wrapped_keys_attr.attr,
 	&max_dun_bits_attr.attr,
 	&num_keyslots_attr.attr,
@@ -90,8 +90,8 @@ static struct attribute *blk_crypto_attrs[] = {
 };
 
 static const struct attribute_group blk_crypto_attr_group = {
-	.attrs = blk_crypto_attrs,
-	.is_visible = blk_crypto_is_visible,
+	.attrs_const = blk_crypto_attrs,
+	.is_visible_const = blk_crypto_is_visible,
 };
 
 /*
@@ -99,13 +99,13 @@ static const struct attribute_group blk_crypto_attr_group = {
  * modes, these are initialized at boot time by blk_crypto_sysfs_init().
  */
 static struct blk_crypto_attr __blk_crypto_mode_attrs[BLK_ENCRYPTION_MODE_MAX];
-static struct attribute *blk_crypto_mode_attrs[BLK_ENCRYPTION_MODE_MAX + 1];
+static const struct attribute *blk_crypto_mode_attrs[BLK_ENCRYPTION_MODE_MAX + 1];
 
 static umode_t blk_crypto_mode_is_visible(struct kobject *kobj,
-					  struct attribute *attr, int n)
+					  const struct attribute *attr, int n)
 {
 	struct blk_crypto_profile *profile = kobj_to_crypto_profile(kobj);
-	struct blk_crypto_attr *a = attr_to_crypto_attr(attr);
+	const struct blk_crypto_attr *a = attr_to_crypto_attr(attr);
 	int mode_num = a - __blk_crypto_mode_attrs;
 
 	if (profile->modes_supported[mode_num])
@@ -114,7 +114,7 @@ static umode_t blk_crypto_mode_is_visible(struct kobject *kobj,
 }
 
 static ssize_t blk_crypto_mode_show(struct blk_crypto_profile *profile,
-				    struct blk_crypto_attr *attr, char *page)
+				    const struct blk_crypto_attr *attr, char *page)
 {
 	int mode_num = attr - __blk_crypto_mode_attrs;
 
@@ -123,8 +123,8 @@ static ssize_t blk_crypto_mode_show(struct blk_crypto_profile *profile,
 
 static const struct attribute_group blk_crypto_modes_attr_group = {
 	.name = "modes",
-	.attrs = blk_crypto_mode_attrs,
-	.is_visible = blk_crypto_mode_is_visible,
+	.attrs_const = blk_crypto_mode_attrs,
+	.is_visible_const = blk_crypto_mode_is_visible,
 };
 
 static const struct attribute_group *blk_crypto_attr_groups[] = {
@@ -137,7 +137,7 @@ static ssize_t blk_crypto_attr_show(struct kobject *kobj,
 				    struct attribute *attr, char *page)
 {
 	struct blk_crypto_profile *profile = kobj_to_crypto_profile(kobj);
-	struct blk_crypto_attr *a = attr_to_crypto_attr(attr);
+	const struct blk_crypto_attr *a = attr_to_crypto_attr(attr);
 
 	return a->show(profile, a, page);
 }

-- 
2.53.0


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

* [PATCH 4/4] blk-mq: make blk_mq_hw_ctx_sysfs_entry instances const
  2026-03-16 22:43 [PATCH 0/4] block: make some sysfs attribute instances const Thomas Weißschuh
                   ` (2 preceding siblings ...)
  2026-03-16 22:43 ` [PATCH 3/4] blk-crypto: make blk_crypto_attr " Thomas Weißschuh
@ 2026-03-16 22:43 ` Thomas Weißschuh
  2026-03-17 16:31   ` John Garry
  2026-03-18  1:32 ` [PATCH 0/4] block: make some sysfs attribute " Jens Axboe
  4 siblings, 1 reply; 10+ messages in thread
From: Thomas Weißschuh @ 2026-03-16 22:43 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, linux-kernel, Thomas Weißschuh

The blk_mq_hw_ctx_sysfs_entry structures are never modified,
mark them as const.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 block/blk-mq-sysfs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
index 58ec293373c6..895397831ecc 100644
--- a/block/blk-mq-sysfs.c
+++ b/block/blk-mq-sysfs.c
@@ -53,7 +53,7 @@ static ssize_t blk_mq_hw_sysfs_show(struct kobject *kobj,
 	struct request_queue *q;
 	ssize_t res;
 
-	entry = container_of(attr, struct blk_mq_hw_ctx_sysfs_entry, attr);
+	entry = container_of_const(attr, struct blk_mq_hw_ctx_sysfs_entry, attr);
 	hctx = container_of(kobj, struct blk_mq_hw_ctx, kobj);
 	q = hctx->queue;
 
@@ -101,20 +101,20 @@ static ssize_t blk_mq_hw_sysfs_cpus_show(struct blk_mq_hw_ctx *hctx, char *page)
 	return pos + ret;
 }
 
-static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_tags = {
+static const struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_tags = {
 	.attr = {.name = "nr_tags", .mode = 0444 },
 	.show = blk_mq_hw_sysfs_nr_tags_show,
 };
-static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_reserved_tags = {
+static const struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_reserved_tags = {
 	.attr = {.name = "nr_reserved_tags", .mode = 0444 },
 	.show = blk_mq_hw_sysfs_nr_reserved_tags_show,
 };
-static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_cpus = {
+static const struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_cpus = {
 	.attr = {.name = "cpu_list", .mode = 0444 },
 	.show = blk_mq_hw_sysfs_cpus_show,
 };
 
-static struct attribute *default_hw_ctx_attrs[] = {
+static const struct attribute *const default_hw_ctx_attrs[] = {
 	&blk_mq_hw_sysfs_nr_tags.attr,
 	&blk_mq_hw_sysfs_nr_reserved_tags.attr,
 	&blk_mq_hw_sysfs_cpus.attr,

-- 
2.53.0


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

* Re: [PATCH 1/4] block: make queue_sysfs_entry instances const
  2026-03-16 22:43 ` [PATCH 1/4] block: make queue_sysfs_entry " Thomas Weißschuh
@ 2026-03-17 16:18   ` John Garry
  0 siblings, 0 replies; 10+ messages in thread
From: John Garry @ 2026-03-17 16:18 UTC (permalink / raw)
  To: Thomas Weißschuh, Jens Axboe; +Cc: linux-block, linux-kernel

On 16/03/2026 22:43, Thomas Weißschuh wrote:
> The queue_sysfs_entry structures are never modified, mark them as const.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---

FWIW,

Reviewed-by: John Garry <john.g.garry@oracle.com>

>   
> -static umode_t queue_attr_visible(struct kobject *kobj, struct attribute *attr,
> +static umode_t queue_attr_visible(struct kobject *kobj, const struct attribute *attr,
>   				int n)

This now spills over 80 characters, I am not sure what the block policy 
is on this (but I generally try to keep to it).

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

* Re: [PATCH 2/4] block: ia-ranges: make blk_ia_range_sysfs_entry instances const
  2026-03-16 22:43 ` [PATCH 2/4] block: ia-ranges: make blk_ia_range_sysfs_entry " Thomas Weißschuh
@ 2026-03-17 16:19   ` John Garry
  0 siblings, 0 replies; 10+ messages in thread
From: John Garry @ 2026-03-17 16:19 UTC (permalink / raw)
  To: Thomas Weißschuh, Jens Axboe; +Cc: linux-block, linux-kernel

On 16/03/2026 22:43, Thomas Weißschuh wrote:
> The blk_ia_range_sysfs_entry structures are never modified,
> mark them as const.
> 
> Signed-off-by: Thomas Weißschuh<linux@weissschuh.net>

Reviewed-by: John Garry <john.g.garry@oracle.com>

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

* Re: [PATCH 3/4] blk-crypto: make blk_crypto_attr instances const
  2026-03-16 22:43 ` [PATCH 3/4] blk-crypto: make blk_crypto_attr " Thomas Weißschuh
@ 2026-03-17 16:30   ` John Garry
  0 siblings, 0 replies; 10+ messages in thread
From: John Garry @ 2026-03-17 16:30 UTC (permalink / raw)
  To: Thomas Weißschuh, Jens Axboe; +Cc: linux-block, linux-kernel

On 16/03/2026 22:43, Thomas Weißschuh wrote:
> The blk_crypto_attrs structures are never modified, mark them as const.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

With reservations, below:
Reviewed-by: John Garry <john.g.garry@oracle.com>>
>   static struct blk_crypto_profile *kobj_to_crypto_profile(struct kobject *kobj)
> @@ -26,39 +26,39 @@ static struct blk_crypto_profile *kobj_to_crypto_profile(struct kobject *kobj)
>   	return container_of(kobj, struct blk_crypto_kobj, kobj)->profile;
>   }
>   
> -static struct blk_crypto_attr *attr_to_crypto_attr(struct attribute *attr)
> +static const struct blk_crypto_attr *attr_to_crypto_attr(const struct attribute *attr)

 > 80 again, FWIW

And this code is becoming very "wordy" now. Maybe someone would think 
that the following is better:

#define attr_to_crypto_attr(attr) \
	container_of_const(attr, struct blk_crypto_attr, attr)

>   {
> -	return container_of(attr, struct blk_crypto_attr, attr);
> +	return container_of_const(attr, struct blk_crypto_attr, attr);
>   }

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

* Re: [PATCH 4/4] blk-mq: make blk_mq_hw_ctx_sysfs_entry instances const
  2026-03-16 22:43 ` [PATCH 4/4] blk-mq: make blk_mq_hw_ctx_sysfs_entry " Thomas Weißschuh
@ 2026-03-17 16:31   ` John Garry
  0 siblings, 0 replies; 10+ messages in thread
From: John Garry @ 2026-03-17 16:31 UTC (permalink / raw)
  To: Thomas Weißschuh, Jens Axboe; +Cc: linux-block, linux-kernel

On 16/03/2026 22:43, Thomas Weißschuh wrote:
> The blk_mq_hw_ctx_sysfs_entry structures are never modified,
> mark them as const.
> 
> Signed-off-by: Thomas Weißschuh<linux@weissschuh.net>

FWIW,
Reviewed-by: John Garry <john.g.garry@oracle.com>

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

* Re: [PATCH 0/4] block: make some sysfs attribute instances const
  2026-03-16 22:43 [PATCH 0/4] block: make some sysfs attribute instances const Thomas Weißschuh
                   ` (3 preceding siblings ...)
  2026-03-16 22:43 ` [PATCH 4/4] blk-mq: make blk_mq_hw_ctx_sysfs_entry " Thomas Weißschuh
@ 2026-03-18  1:32 ` Jens Axboe
  4 siblings, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2026-03-18  1:32 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: linux-block, linux-kernel


On Mon, 16 Mar 2026 23:43:50 +0100, Thomas Weißschuh wrote:
> These attribute structures are never modified, mark them as const.
> 
> 

Applied, thanks!

[1/4] block: make queue_sysfs_entry instances const
      commit: 223983874d0366ac12d30eab3b633d699bdf763e
[2/4] block: ia-ranges: make blk_ia_range_sysfs_entry instances const
      commit: 3c9122630953520e2a2b6c6a28751da23457e4ef
[3/4] blk-crypto: make blk_crypto_attr instances const
      commit: f00d826f1b8ee39a4e9283f2eb537f5b49e07829
[4/4] blk-mq: make blk_mq_hw_ctx_sysfs_entry instances const
      commit: 3141e0e536b43ab3555737cb2ee6ea1ed0aff69f

Best regards,
-- 
Jens Axboe




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

end of thread, other threads:[~2026-03-18  1:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-16 22:43 [PATCH 0/4] block: make some sysfs attribute instances const Thomas Weißschuh
2026-03-16 22:43 ` [PATCH 1/4] block: make queue_sysfs_entry " Thomas Weißschuh
2026-03-17 16:18   ` John Garry
2026-03-16 22:43 ` [PATCH 2/4] block: ia-ranges: make blk_ia_range_sysfs_entry " Thomas Weißschuh
2026-03-17 16:19   ` John Garry
2026-03-16 22:43 ` [PATCH 3/4] blk-crypto: make blk_crypto_attr " Thomas Weißschuh
2026-03-17 16:30   ` John Garry
2026-03-16 22:43 ` [PATCH 4/4] blk-mq: make blk_mq_hw_ctx_sysfs_entry " Thomas Weißschuh
2026-03-17 16:31   ` John Garry
2026-03-18  1:32 ` [PATCH 0/4] block: make some sysfs attribute " Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox