summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorJinlong Chen <nickyc975@zju.edu.cn>2022-11-29 23:46:34 +0800
committerJens Axboe <axboe@kernel.dk>2022-11-29 10:48:59 -0700
commit7919d679ae09c0dc30dfecb7cbc02306cf95cdd7 (patch)
tree992cf92c3adf24e9690387954328119787c23f9b /block
parent8613dec04e746f698418e9b8344acf19efff4997 (diff)
block: include 'none' for initial elv_iosched_show call
This makes the printing order of the io schedulers consistent, and removes a redundant q->elevator check. Signed-off-by: Jinlong Chen <nickyc975@zju.edu.cn> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/bdd7083ed4f232e3285f39081e3c5f30b20b8da2.1669736350.git.nickyc975@zju.edu.cn Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/elevator.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/block/elevator.c b/block/elevator.c
index 599413620558..308bee253564 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -767,10 +767,12 @@ ssize_t elv_iosched_show(struct request_queue *q, char *name)
if (!elv_support_iosched(q))
return sprintf(name, "none\n");
- if (!q->elevator)
+ if (!q->elevator) {
len += sprintf(name+len, "[none] ");
- else
+ } else {
+ len += sprintf(name+len, "none ");
cur = eq->type;
+ }
spin_lock(&elv_list_lock);
list_for_each_entry(e, &elv_list, list) {
@@ -783,9 +785,6 @@ ssize_t elv_iosched_show(struct request_queue *q, char *name)
}
spin_unlock(&elv_list_lock);
- if (q->elevator)
- len += sprintf(name+len, "none");
-
len += sprintf(len+name, "\n");
return len;
}