@@ -233,6 +233,8 @@ static inline void elv_deactivate_rq(struct request_queue *q, struct request *rq
int elv_register_queue(struct request_queue *q);
void elv_unregister_queue(struct request_queue *q);
+int __elevator_change(struct request_queue *q, const char *name,
+ bool try_loading);
struct hd_struct *__disk_get_part(struct gendisk *disk, int partno);
@@ -1075,7 +1075,8 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
/*
* Switch this queue to the given IO scheduler.
*/
-static int __elevator_change(struct request_queue *q, const char *name)
+int __elevator_change(struct request_queue *q, const char *name,
+ bool try_loading)
{
char elevator_name[ELV_NAME_MAX];
struct elevator_type *e;
@@ -1091,7 +1092,7 @@ static int __elevator_change(struct request_queue *q, const char *name)
return elevator_switch(q, NULL);
strlcpy(elevator_name, name, sizeof(elevator_name));
- e = elevator_get(q, strstrip(elevator_name), true);
+ e = elevator_get(q, strstrip(elevator_name), try_loading);
if (!e)
return -EINVAL;
@@ -1119,7 +1120,7 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name,
if (!(q->mq_ops || q->request_fn) || !elv_support_iosched(q))
return count;
- ret = __elevator_change(q, name);
+ ret = __elevator_change(q, name, true);
if (!ret)
return count;
The next patch will add a caller that can't trigger module loads. Also export this function for that caller. Signed-off-by: Jeff Moyer <jmoyer@redhat.com> --- block/blk.h | 2 ++ block/elevator.c | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-)