random improvments and cleanups for elevator.c
cover random improvments and cleanups for elevator.c
This series updates some function documents (patch 1 and 3), removes an outdated comment (patch 4), and adds a warning message (patch 2) in elevator.c.
Jinlong Chen (4):
elevator: update the document of elevator_switch
elevator: printk a warning if switching to a new io scheduler fails
elevator: update the document of elevator_match
elevator: remove an outdated comment in elevator_change
block/elevator.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/4 elevator: update the document of elevator_switch
We no longer support falling back to the old io scheduler if switching to the new one fails. Update the document to indicate that.
--- block/elevator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
block/elevator.c +4 -4
@@ -650,10 +650,10 @@ void elevator_init_mq(struct request_queue *q) }/* -* switch to new_e io scheduler. be careful not to introduce deadlocks - -* we don't free the old io scheduler, before we have allocated what we -* need for the new one. this way we have a chance of going back to the old -* one, if the new one fails init for some reason. +* Switch to new_e io scheduler. +* +* If switching fails, we are most likely running out of memory and not able +* to restore the old io scheduler, so leaving the io scheduler being none. */ int elevator_switch (struct request_queue *q,struct elevator_type *new_e) {
Signature · 1 line
2.34.1
Re: [PATCH 1/4] elevator: update the document of elevator_switch
Looks good:
PATCH 2/4 elevator: printk a warning if switching to a new io scheduler fails
In reply to Jinlong Chenprintk a warning to indicate that the io scheduler has been set to none if switching to a new io scheduler fails.
--- block/elevator.c | 6 ++++++ 1 file changed, 6 insertions(+)
block/elevator.c +6 -0
@@ -683,6 +683,12 @@ int elevator_switch(struct request_queue *q, struct elevator_type *new_e) out_unfreeze:blk_mq_unquiesce_queue (q);blk_mq_unfreeze_queue (q); + +if (ret) { +pr_warn ("elv: switch to \"%s\" failed, falling back to \"none\"\n" , + new_e->elevator_name); + } +return ret; }
Signature · 1 line
2.34.1
Re: [PATCH 2/4] elevator: printk a warning if switching to a new io scheduler fails
Quoted 16 lines
printk a warning to indicate that the io scheduler has been set to none if switching to a new io scheduler fails.
Signed-off-by Jinlong Chen <[email protected]>--- block/elevator.c | 6 ++++++ 1 file changed, 6 insertions(+)block/elevator.c +0
-0@@ -683,6 +683,12 @@ int elevator_switch(struct request_queue *q, struct elevator_type *new_e) out_unfreeze:blk_mq_unquiesce_queue (q);
block/elevator.c int elevator_switch(struct request_queue *q, struct elevator_type *new_e) · line 694
Quoted 10 lines
block/elevator.c +6
-0blk_mq_unfreeze_queue (q); + +if (ret) { +pr_warn ("elv: switch to \"%s\" failed, falling back to \"none\"\n" , + new_e->elevator_name); + } +return ret; }
Hi, Jens!
This patch is suggested by Christoph, but I forgot to add the Suggested-by tag. Would you please add "Suggested-by: Christoph Hellwig <[email protected]>" if you apply the patch?
Thanks!
Jinlong Chen
Re: [PATCH 2/4] elevator: printk a warning if switching to a new io scheduler fails
In reply to Jinlong ChenLooks good:
PATCH 3/4 elevator: update the document of elevator_match
In reply to Jinlong Chenelevator_match does not care about elevator_features any more. Remove related descriptions from its document.
--- block/elevator.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
block/elevator.c +2 -3
@@ -91,12 +91,11 @@ static inline bool elv_support_features(struct request_queue *q, }/** -* elevator_match - Test an elevator name and features +* elevator_match - Check whether @e's name or alias matches @name * @e: Scheduler to test * @name: Elevator name to test * -* Return true if the elevator @e name matches @name and if @e provides all -* the features specified by @required_features. +* Return true if the elevator @e's name or alias matches @name. */ static bool elevator_match (const struct elevator_type *e,const char *name) {
Signature · 1 line
2.34.1
Re: [PATCH 3/4] elevator: update the document of elevator_match
Looks good:
PATCH 4/4 elevator: remove an outdated comment in elevator_change
In reply to Jinlong Chenmq is no longer a special case.
--- block/elevator.c | 3 --- 1 file changed, 3 deletions(-)
block/elevator.c +0 -3
@@ -721,9 +721,6 @@ static int elevator_change(struct request_queue *q, const char *elevator_name)if (!blk_queue_registered (q))return -ENOENT ; -/* -* Special case for mq, turn off scheduling -*/ if (!strncmp (elevator_name,"none" ,4 )) {if (q->elevator)elevator_disable (q);
Signature · 1 line
2.34.1
Re: [PATCH 4/4] elevator: remove an outdated comment in elevator_change
Quoted 1 line · Jinlong Chen
mq is no longer a special case.
But switching to none still is a special case. Then again this should be very obvious from the code, so I'm fine the comment removal:
Quoted 11 lines · Jinlong Chen
This series updates some function documents (patch 1 and 3), removes an outdated comment (patch 4), and adds a warning message (patch 2) in
elevator.c.Jinlong Chen (4):
elevator: update the document ofelevator_switch
elevator: printk a warning if switching to a new io scheduler fails
elevator: update the document ofelevator_match
elevator: remove an outdated comment inelevator_change[...]
Applied, thanks!
[1/4] elevator: update the document of elevator_switch
commit: ac1171bd2c7a3a32dfbdd3c347919fee32b745a1
[2/4] elevator: printk a warning if switching to a new io scheduler fails
commit: e0cca8bc9cd8d6176921cb3f5f466d3ccfbc6b99
[3/4] elevator: update the document of elevator_match
commit: f69b5e8f356e4e57e94b806ca1dcb9771933bb9c
[4/4] elevator: remove an outdated comment in elevator_change
commit: 4284354758d67cf77ab2a4494e28d4c05fb83074Best regards,
Signature · 1 line
Jens Axboe