block: return void from the queue_sysfs_entry load_module method

Requesting a module either succeeds or does nothing, return an error from
this method does not make sense.

Also move the load_module after the store method in the struct
declaration to keep the important show and store methods together.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
Link: https://lore.kernel.org/r/20241008050841.104602-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig 2024-10-08 07:08:41 +02:00 committed by Jens Axboe
parent 758737d86f
commit d51c9cdfc2
3 changed files with 8 additions and 13 deletions

View File

@ -23,8 +23,8 @@
struct queue_sysfs_entry { struct queue_sysfs_entry {
struct attribute attr; struct attribute attr;
ssize_t (*show)(struct gendisk *disk, char *page); ssize_t (*show)(struct gendisk *disk, char *page);
int (*load_module)(struct gendisk *disk, const char *page, size_t count);
ssize_t (*store)(struct gendisk *disk, const char *page, size_t count); ssize_t (*store)(struct gendisk *disk, const char *page, size_t count);
void (*load_module)(struct gendisk *disk, const char *page, size_t count);
}; };
static ssize_t static ssize_t
@ -684,11 +684,8 @@ queue_attr_store(struct kobject *kobj, struct attribute *attr,
* queue to ensure that the module file can be read when the request * queue to ensure that the module file can be read when the request
* queue is the one for the device storing the module file. * queue is the one for the device storing the module file.
*/ */
if (entry->load_module) { if (entry->load_module)
res = entry->load_module(disk, page, length); entry->load_module(disk, page, length);
if (res)
return res;
}
blk_mq_freeze_queue(q); blk_mq_freeze_queue(q);
mutex_lock(&q->sysfs_lock); mutex_lock(&q->sysfs_lock);

View File

@ -704,15 +704,15 @@ static int elevator_change(struct request_queue *q, const char *elevator_name)
return ret; return ret;
} }
int elv_iosched_load_module(struct gendisk *disk, const char *buf, void elv_iosched_load_module(struct gendisk *disk, const char *buf,
size_t count) size_t count)
{ {
char elevator_name[ELV_NAME_MAX]; char elevator_name[ELV_NAME_MAX];
struct elevator_type *found; struct elevator_type *found;
const char *name; const char *name;
if (!elv_support_iosched(disk->queue)) if (!elv_support_iosched(disk->queue))
return -EOPNOTSUPP; return;
strscpy(elevator_name, buf, sizeof(elevator_name)); strscpy(elevator_name, buf, sizeof(elevator_name));
name = strstrip(elevator_name); name = strstrip(elevator_name);
@ -723,8 +723,6 @@ int elv_iosched_load_module(struct gendisk *disk, const char *buf,
if (!found) if (!found)
request_module("%s-iosched", name); request_module("%s-iosched", name);
return 0;
} }
ssize_t elv_iosched_store(struct gendisk *disk, const char *buf, ssize_t elv_iosched_store(struct gendisk *disk, const char *buf,

View File

@ -148,8 +148,8 @@ extern void elv_unregister(struct elevator_type *);
* io scheduler sysfs switching * io scheduler sysfs switching
*/ */
ssize_t elv_iosched_show(struct gendisk *disk, char *page); ssize_t elv_iosched_show(struct gendisk *disk, char *page);
int elv_iosched_load_module(struct gendisk *disk, const char *page, void elv_iosched_load_module(struct gendisk *disk, const char *page,
size_t count); size_t count);
ssize_t elv_iosched_store(struct gendisk *disk, const char *page, size_t count); ssize_t elv_iosched_store(struct gendisk *disk, const char *page, size_t count);
extern bool elv_bio_merge_ok(struct request *, struct bio *); extern bool elv_bio_merge_ok(struct request *, struct bio *);