* [PATCH 0/4] random improvments and cleanups for elevator.c
@ 2022-11-22 14:21 Jinlong Chen
2022-11-22 14:21 ` [PATCH 1/4] elevator: update the document of elevator_switch Jinlong Chen
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: Jinlong Chen @ 2022-11-22 14:21 UTC (permalink / raw)
To: axboe; +Cc: hch, linux-block, linux-kernel, nickyc975
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(-)
--
2.34.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/4] elevator: update the document of elevator_switch
2022-11-22 14:21 [PATCH 0/4] random improvments and cleanups for elevator.c Jinlong Chen
@ 2022-11-22 14:21 ` Jinlong Chen
2022-11-23 7:37 ` Christoph Hellwig
2022-11-22 14:21 ` [PATCH 2/4] elevator: printk a warning if switching to a new io scheduler fails Jinlong Chen
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Jinlong Chen @ 2022-11-22 14:21 UTC (permalink / raw)
To: axboe; +Cc: hch, linux-block, linux-kernel, nickyc975
We no longer support falling back to the old io scheduler if switching to
the new one fails. Update the document to indicate that.
Fixes: a1ce35fa4985 ("block: remove dead elevator code")
Signed-off-by: Jinlong Chen <nickyc975@zju.edu.cn>
---
block/elevator.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/elevator.c b/block/elevator.c
index a5bdc3b1e7e5..01aa9f38f22e 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -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)
{
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/4] elevator: printk a warning if switching to a new io scheduler fails
2022-11-22 14:21 [PATCH 0/4] random improvments and cleanups for elevator.c Jinlong Chen
2022-11-22 14:21 ` [PATCH 1/4] elevator: update the document of elevator_switch Jinlong Chen
@ 2022-11-22 14:21 ` Jinlong Chen
2022-11-22 14:55 ` Jinlong Chen
2022-11-23 7:37 ` Christoph Hellwig
2022-11-22 14:21 ` [PATCH 3/4] elevator: update the document of elevator_match Jinlong Chen
` (2 subsequent siblings)
4 siblings, 2 replies; 11+ messages in thread
From: Jinlong Chen @ 2022-11-22 14:21 UTC (permalink / raw)
To: axboe; +Cc: hch, linux-block, linux-kernel, nickyc975
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 <nickyc975@zju.edu.cn>
---
block/elevator.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/block/elevator.c b/block/elevator.c
index 01aa9f38f22e..1fa45717b1d6 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -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;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/4] elevator: update the document of elevator_match
2022-11-22 14:21 [PATCH 0/4] random improvments and cleanups for elevator.c Jinlong Chen
2022-11-22 14:21 ` [PATCH 1/4] elevator: update the document of elevator_switch Jinlong Chen
2022-11-22 14:21 ` [PATCH 2/4] elevator: printk a warning if switching to a new io scheduler fails Jinlong Chen
@ 2022-11-22 14:21 ` Jinlong Chen
2022-11-23 7:37 ` Christoph Hellwig
2022-11-22 14:21 ` [PATCH 4/4] elevator: remove an outdated comment in elevator_change Jinlong Chen
2022-11-23 13:53 ` [PATCH 0/4] random improvments and cleanups for elevator.c Jens Axboe
4 siblings, 1 reply; 11+ messages in thread
From: Jinlong Chen @ 2022-11-22 14:21 UTC (permalink / raw)
To: axboe; +Cc: hch, linux-block, linux-kernel, nickyc975
elevator_match does not care about elevator_features any more. Remove
related descriptions from its document.
Fixes: ffb86425ee2c ("block: don't check for required features in elevator_match")
Signed-off-by: Jinlong Chen <nickyc975@zju.edu.cn>
---
block/elevator.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/block/elevator.c b/block/elevator.c
index 1fa45717b1d6..5287b39cd7a9 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -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)
{
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/4] elevator: remove an outdated comment in elevator_change
2022-11-22 14:21 [PATCH 0/4] random improvments and cleanups for elevator.c Jinlong Chen
` (2 preceding siblings ...)
2022-11-22 14:21 ` [PATCH 3/4] elevator: update the document of elevator_match Jinlong Chen
@ 2022-11-22 14:21 ` Jinlong Chen
2022-11-23 7:38 ` Christoph Hellwig
2022-11-23 13:53 ` [PATCH 0/4] random improvments and cleanups for elevator.c Jens Axboe
4 siblings, 1 reply; 11+ messages in thread
From: Jinlong Chen @ 2022-11-22 14:21 UTC (permalink / raw)
To: axboe; +Cc: hch, linux-block, linux-kernel, nickyc975
mq is no longer a special case.
Signed-off-by: Jinlong Chen <nickyc975@zju.edu.cn>
---
block/elevator.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/block/elevator.c b/block/elevator.c
index 5287b39cd7a9..599413620558 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -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);
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/4] elevator: printk a warning if switching to a new io scheduler fails
2022-11-22 14:21 ` [PATCH 2/4] elevator: printk a warning if switching to a new io scheduler fails Jinlong Chen
@ 2022-11-22 14:55 ` Jinlong Chen
2022-11-23 7:37 ` Christoph Hellwig
1 sibling, 0 replies; 11+ messages in thread
From: Jinlong Chen @ 2022-11-22 14:55 UTC (permalink / raw)
To: axboe; +Cc: hch, linux-block, linux-kernel
>
> 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 <nickyc975@zju.edu.cn>
> ---
> block/elevator.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/block/elevator.c b/block/elevator.c
> index 01aa9f38f22e..1fa45717b1d6 100644
> --- a/block/elevator.c
> +++ b/block/elevator.c
> @@ -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;
> }
>
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 <hch@lst.de>"
if you apply the patch?
Thanks!
Jinlong Chen
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/4] elevator: update the document of elevator_switch
2022-11-22 14:21 ` [PATCH 1/4] elevator: update the document of elevator_switch Jinlong Chen
@ 2022-11-23 7:37 ` Christoph Hellwig
0 siblings, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2022-11-23 7:37 UTC (permalink / raw)
To: Jinlong Chen; +Cc: axboe, hch, linux-block, linux-kernel
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/4] elevator: printk a warning if switching to a new io scheduler fails
2022-11-22 14:21 ` [PATCH 2/4] elevator: printk a warning if switching to a new io scheduler fails Jinlong Chen
2022-11-22 14:55 ` Jinlong Chen
@ 2022-11-23 7:37 ` Christoph Hellwig
1 sibling, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2022-11-23 7:37 UTC (permalink / raw)
To: Jinlong Chen; +Cc: axboe, hch, linux-block, linux-kernel
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] elevator: update the document of elevator_match
2022-11-22 14:21 ` [PATCH 3/4] elevator: update the document of elevator_match Jinlong Chen
@ 2022-11-23 7:37 ` Christoph Hellwig
0 siblings, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2022-11-23 7:37 UTC (permalink / raw)
To: Jinlong Chen; +Cc: axboe, hch, linux-block, linux-kernel
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/4] elevator: remove an outdated comment in elevator_change
2022-11-22 14:21 ` [PATCH 4/4] elevator: remove an outdated comment in elevator_change Jinlong Chen
@ 2022-11-23 7:38 ` Christoph Hellwig
0 siblings, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2022-11-23 7:38 UTC (permalink / raw)
To: Jinlong Chen; +Cc: axboe, hch, linux-block, linux-kernel
On Tue, Nov 22, 2022 at 10:21:26PM +0800, Jinlong Chen wrote:
> 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:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/4] random improvments and cleanups for elevator.c
2022-11-22 14:21 [PATCH 0/4] random improvments and cleanups for elevator.c Jinlong Chen
` (3 preceding siblings ...)
2022-11-22 14:21 ` [PATCH 4/4] elevator: remove an outdated comment in elevator_change Jinlong Chen
@ 2022-11-23 13:53 ` Jens Axboe
4 siblings, 0 replies; 11+ messages in thread
From: Jens Axboe @ 2022-11-23 13:53 UTC (permalink / raw)
To: Jinlong Chen; +Cc: linux-block, hch, linux-kernel
On Tue, 22 Nov 2022 22:21:22 +0800, Jinlong Chen wrote:
> 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
>
> [...]
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: 4284354758d67cf77ab2a4494e28d4c05fb83074
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-11-23 13:59 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-22 14:21 [PATCH 0/4] random improvments and cleanups for elevator.c Jinlong Chen
2022-11-22 14:21 ` [PATCH 1/4] elevator: update the document of elevator_switch Jinlong Chen
2022-11-23 7:37 ` Christoph Hellwig
2022-11-22 14:21 ` [PATCH 2/4] elevator: printk a warning if switching to a new io scheduler fails Jinlong Chen
2022-11-22 14:55 ` Jinlong Chen
2022-11-23 7:37 ` Christoph Hellwig
2022-11-22 14:21 ` [PATCH 3/4] elevator: update the document of elevator_match Jinlong Chen
2022-11-23 7:37 ` Christoph Hellwig
2022-11-22 14:21 ` [PATCH 4/4] elevator: remove an outdated comment in elevator_change Jinlong Chen
2022-11-23 7:38 ` Christoph Hellwig
2022-11-23 13:53 ` [PATCH 0/4] random improvments and cleanups for elevator.c Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).