Skip to content

Commit

Permalink
block: include 'none' for initial elv_iosched_show call
Browse files Browse the repository at this point in the history
This makes the printing order of the io schedulers consistent, and removes
a redundant q->elevator check.

Signed-off-by: Jinlong Chen <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Link: https://lore.kernel.org/r/bdd7083ed4f232e3285f39081e3c5f30b20b8da2.1669736350.git.nickyc975@zju.edu.cn
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
nickyc975 authored and axboe committed Nov 29, 2022
1 parent 8613dec commit 7919d67
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down

0 comments on commit 7919d67

Please sign in to comment.