Skip to content

Commit 2bc1f6e

Browse files
damien-lemoalaxboe
authored andcommitted
block: remove blk-mq-sysfs dead code
In block/blk-mq-sysfs.c, struct blk_mq_ctx_sysfs_entry is not used to define any attribute since the "mq" sysfs directory contains only sub-directories (no attribute files). As a result, blk_mq_sysfs_show(), blk_mq_sysfs_store(), and struct sysfs_ops blk_mq_sysfs_ops are all unused and unnecessary. Remove all this unused code. Signed-off-by: Damien Le Moal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 9f65c48 commit 2bc1f6e

File tree

1 file changed

+0
-55
lines changed

1 file changed

+0
-55
lines changed

block/blk-mq-sysfs.c

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -45,60 +45,12 @@ static void blk_mq_hw_sysfs_release(struct kobject *kobj)
4545
kfree(hctx);
4646
}
4747

48-
struct blk_mq_ctx_sysfs_entry {
49-
struct attribute attr;
50-
ssize_t (*show)(struct blk_mq_ctx *, char *);
51-
ssize_t (*store)(struct blk_mq_ctx *, const char *, size_t);
52-
};
53-
5448
struct blk_mq_hw_ctx_sysfs_entry {
5549
struct attribute attr;
5650
ssize_t (*show)(struct blk_mq_hw_ctx *, char *);
5751
ssize_t (*store)(struct blk_mq_hw_ctx *, const char *, size_t);
5852
};
5953

60-
static ssize_t blk_mq_sysfs_show(struct kobject *kobj, struct attribute *attr,
61-
char *page)
62-
{
63-
struct blk_mq_ctx_sysfs_entry *entry;
64-
struct blk_mq_ctx *ctx;
65-
struct request_queue *q;
66-
ssize_t res;
67-
68-
entry = container_of(attr, struct blk_mq_ctx_sysfs_entry, attr);
69-
ctx = container_of(kobj, struct blk_mq_ctx, kobj);
70-
q = ctx->queue;
71-
72-
if (!entry->show)
73-
return -EIO;
74-
75-
mutex_lock(&q->sysfs_lock);
76-
res = entry->show(ctx, page);
77-
mutex_unlock(&q->sysfs_lock);
78-
return res;
79-
}
80-
81-
static ssize_t blk_mq_sysfs_store(struct kobject *kobj, struct attribute *attr,
82-
const char *page, size_t length)
83-
{
84-
struct blk_mq_ctx_sysfs_entry *entry;
85-
struct blk_mq_ctx *ctx;
86-
struct request_queue *q;
87-
ssize_t res;
88-
89-
entry = container_of(attr, struct blk_mq_ctx_sysfs_entry, attr);
90-
ctx = container_of(kobj, struct blk_mq_ctx, kobj);
91-
q = ctx->queue;
92-
93-
if (!entry->store)
94-
return -EIO;
95-
96-
mutex_lock(&q->sysfs_lock);
97-
res = entry->store(ctx, page, length);
98-
mutex_unlock(&q->sysfs_lock);
99-
return res;
100-
}
101-
10254
static ssize_t blk_mq_hw_sysfs_show(struct kobject *kobj,
10355
struct attribute *attr, char *page)
10456
{
@@ -198,23 +150,16 @@ static struct attribute *default_hw_ctx_attrs[] = {
198150
};
199151
ATTRIBUTE_GROUPS(default_hw_ctx);
200152

201-
static const struct sysfs_ops blk_mq_sysfs_ops = {
202-
.show = blk_mq_sysfs_show,
203-
.store = blk_mq_sysfs_store,
204-
};
205-
206153
static const struct sysfs_ops blk_mq_hw_sysfs_ops = {
207154
.show = blk_mq_hw_sysfs_show,
208155
.store = blk_mq_hw_sysfs_store,
209156
};
210157

211158
static struct kobj_type blk_mq_ktype = {
212-
.sysfs_ops = &blk_mq_sysfs_ops,
213159
.release = blk_mq_sysfs_release,
214160
};
215161

216162
static struct kobj_type blk_mq_ctx_ktype = {
217-
.sysfs_ops = &blk_mq_sysfs_ops,
218163
.release = blk_mq_ctx_sysfs_release,
219164
};
220165

0 commit comments

Comments
 (0)