Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Christoph Hellwig and committed by
Jens Axboe
d51c9cdf 758737d8

+8 -13
+3 -6
block/blk-sysfs.c
··· 23 23 struct queue_sysfs_entry { 24 24 struct attribute attr; 25 25 ssize_t (*show)(struct gendisk *disk, char *page); 26 - int (*load_module)(struct gendisk *disk, const char *page, size_t count); 27 26 ssize_t (*store)(struct gendisk *disk, const char *page, size_t count); 27 + void (*load_module)(struct gendisk *disk, const char *page, size_t count); 28 28 }; 29 29 30 30 static ssize_t ··· 684 684 * queue to ensure that the module file can be read when the request 685 685 * queue is the one for the device storing the module file. 686 686 */ 687 - if (entry->load_module) { 688 - res = entry->load_module(disk, page, length); 689 - if (res) 690 - return res; 691 - } 687 + if (entry->load_module) 688 + entry->load_module(disk, page, length); 692 689 693 690 blk_mq_freeze_queue(q); 694 691 mutex_lock(&q->sysfs_lock);
+3 -5
block/elevator.c
··· 704 704 return ret; 705 705 } 706 706 707 - int elv_iosched_load_module(struct gendisk *disk, const char *buf, 708 - size_t count) 707 + void elv_iosched_load_module(struct gendisk *disk, const char *buf, 708 + size_t count) 709 709 { 710 710 char elevator_name[ELV_NAME_MAX]; 711 711 struct elevator_type *found; 712 712 const char *name; 713 713 714 714 if (!elv_support_iosched(disk->queue)) 715 - return -EOPNOTSUPP; 715 + return; 716 716 717 717 strscpy(elevator_name, buf, sizeof(elevator_name)); 718 718 name = strstrip(elevator_name); ··· 723 723 724 724 if (!found) 725 725 request_module("%s-iosched", name); 726 - 727 - return 0; 728 726 } 729 727 730 728 ssize_t elv_iosched_store(struct gendisk *disk, const char *buf,
+2 -2
block/elevator.h
··· 148 148 * io scheduler sysfs switching 149 149 */ 150 150 ssize_t elv_iosched_show(struct gendisk *disk, char *page); 151 - int elv_iosched_load_module(struct gendisk *disk, const char *page, 152 - size_t count); 151 + void elv_iosched_load_module(struct gendisk *disk, const char *page, 152 + size_t count); 153 153 ssize_t elv_iosched_store(struct gendisk *disk, const char *page, size_t count); 154 154 155 155 extern bool elv_bio_merge_ok(struct request *, struct bio *);