linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-next v3] blk-mq: cleanup unused methods: blk_mq_hw_sysfs_store
@ 2023-01-28  3:04 Zhong Jinghua
  2023-01-29  9:17 ` Ming Lei
  2023-01-29 21:45 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Zhong Jinghua @ 2023-01-28  3:04 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel, zhongjinghua, yi.zhang, yukuai3

We found that the blk_mq_hw_sysfs_store interface has no place to use.
The object default_hw_ctx_attrs using blk_mq_hw_sysfs_ops only uses
the show method and does not use the store method.

Since this patch:
4a46f05ebf99 ("blk-mq: move hctx and ctx counters from sysfs to debugfs")
moved the store method to debugfs, the store method is not used anymore.

So let me do some tiny work to clean up unused code.

Signed-off-by: Zhong Jinghua <zhongjinghua@huawei.com>
---
 v1->v2: changed debuffs to debugfs in commit message
 v2->v3: as suggested by Christoph Hellwig, remove now unused store method
 from struct blk_mq_hw_ctx_sysfs_entry
 block/blk-mq-sysfs.c | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
index 93997d297d42..847c0151070f 100644
--- a/block/blk-mq-sysfs.c
+++ b/block/blk-mq-sysfs.c
@@ -46,7 +46,6 @@ static void blk_mq_hw_sysfs_release(struct kobject *kobj)
 struct blk_mq_hw_ctx_sysfs_entry {
 	struct attribute attr;
 	ssize_t (*show)(struct blk_mq_hw_ctx *, char *);
-	ssize_t (*store)(struct blk_mq_hw_ctx *, const char *, size_t);
 };
 
 static ssize_t blk_mq_hw_sysfs_show(struct kobject *kobj,
@@ -70,28 +69,6 @@ static ssize_t blk_mq_hw_sysfs_show(struct kobject *kobj,
 	return res;
 }
 
-static ssize_t blk_mq_hw_sysfs_store(struct kobject *kobj,
-				     struct attribute *attr, const char *page,
-				     size_t length)
-{
-	struct blk_mq_hw_ctx_sysfs_entry *entry;
-	struct blk_mq_hw_ctx *hctx;
-	struct request_queue *q;
-	ssize_t res;
-
-	entry = container_of(attr, struct blk_mq_hw_ctx_sysfs_entry, attr);
-	hctx = container_of(kobj, struct blk_mq_hw_ctx, kobj);
-	q = hctx->queue;
-
-	if (!entry->store)
-		return -EIO;
-
-	mutex_lock(&q->sysfs_lock);
-	res = entry->store(hctx, page, length);
-	mutex_unlock(&q->sysfs_lock);
-	return res;
-}
-
 static ssize_t blk_mq_hw_sysfs_nr_tags_show(struct blk_mq_hw_ctx *hctx,
 					    char *page)
 {
@@ -150,7 +127,6 @@ ATTRIBUTE_GROUPS(default_hw_ctx);
 
 static const struct sysfs_ops blk_mq_hw_sysfs_ops = {
 	.show	= blk_mq_hw_sysfs_show,
-	.store	= blk_mq_hw_sysfs_store,
 };
 
 static struct kobj_type blk_mq_ktype = {
-- 
2.31.1


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

* Re: [PATCH-next v3] blk-mq: cleanup unused methods: blk_mq_hw_sysfs_store
  2023-01-28  3:04 [PATCH-next v3] blk-mq: cleanup unused methods: blk_mq_hw_sysfs_store Zhong Jinghua
@ 2023-01-29  9:17 ` Ming Lei
  2023-01-29 21:45 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Ming Lei @ 2023-01-29  9:17 UTC (permalink / raw)
  To: Zhong Jinghua; +Cc: axboe, linux-block, linux-kernel, yi.zhang, yukuai3

On Sat, Jan 28, 2023 at 11:04:19AM +0800, Zhong Jinghua wrote:
> We found that the blk_mq_hw_sysfs_store interface has no place to use.
> The object default_hw_ctx_attrs using blk_mq_hw_sysfs_ops only uses
> the show method and does not use the store method.
> 
> Since this patch:
> 4a46f05ebf99 ("blk-mq: move hctx and ctx counters from sysfs to debugfs")
> moved the store method to debugfs, the store method is not used anymore.
> 
> So let me do some tiny work to clean up unused code.
> 
> Signed-off-by: Zhong Jinghua <zhongjinghua@huawei.com>

Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thanks,
Ming


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

* Re: [PATCH-next v3] blk-mq: cleanup unused methods: blk_mq_hw_sysfs_store
  2023-01-28  3:04 [PATCH-next v3] blk-mq: cleanup unused methods: blk_mq_hw_sysfs_store Zhong Jinghua
  2023-01-29  9:17 ` Ming Lei
@ 2023-01-29 21:45 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2023-01-29 21:45 UTC (permalink / raw)
  To: Zhong Jinghua; +Cc: linux-block, linux-kernel, yi.zhang, yukuai3


On Sat, 28 Jan 2023 11:04:19 +0800, Zhong Jinghua wrote:
> We found that the blk_mq_hw_sysfs_store interface has no place to use.
> The object default_hw_ctx_attrs using blk_mq_hw_sysfs_ops only uses
> the show method and does not use the store method.
> 
> Since this patch:
> 4a46f05ebf99 ("blk-mq: move hctx and ctx counters from sysfs to debugfs")
> moved the store method to debugfs, the store method is not used anymore.
> 
> [...]

Applied, thanks!

[1/1] blk-mq: cleanup unused methods: blk_mq_hw_sysfs_store
      commit: 52627f3c2935342dbceb2ba6fd710f1deac627a1

Best regards,
-- 
Jens Axboe




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

end of thread, other threads:[~2023-01-29 21:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-28  3:04 [PATCH-next v3] blk-mq: cleanup unused methods: blk_mq_hw_sysfs_store Zhong Jinghua
2023-01-29  9:17 ` Ming Lei
2023-01-29 21:45 ` 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 NNTP newsgroup(s).