All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jinlong Chen <nickyc975@zju.edu.cn>
To: axboe@kernel.dk
Cc: hch@lst.de, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, nickyc975@zju.edu.cn
Subject: [PATCH 1/4] elevator: print none at first in elv_iosched_show even if the queue has a scheduler
Date: Fri, 25 Nov 2022 23:53:11 +0800	[thread overview]
Message-ID: <b613ad2a94ff552937672d70a5f2e43068e42bb2.1669391142.git.nickyc975@zju.edu.cn> (raw)
In-Reply-To: <cover.1669391142.git.nickyc975@zju.edu.cn>

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>
---
 block/elevator.c | 9 ++++-----
 1 file 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;
 }
-- 
2.34.1


  reply	other threads:[~2022-11-25 15:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 15:53 [PATCH 0/4] random improvements and cleanups for elevator.c Jinlong Chen
2022-11-25 15:53 ` Jinlong Chen [this message]
2022-11-29  8:30   ` [PATCH 1/4] elevator: print none at first in elv_iosched_show even if the queue has a scheduler Christoph Hellwig
2022-11-25 15:53 ` [PATCH 2/4] elevator: replace continue with else-if in elv_iosched_show Jinlong Chen
2022-11-29  8:33   ` Christoph Hellwig
2022-11-29 10:51     ` Jinlong Chen
2022-11-25 15:53 ` [PATCH 3/4] elevator: repalce "len+name" with "name+len" " Jinlong Chen
2022-11-29  8:33   ` Christoph Hellwig
2022-11-25 15:53 ` [PATCH 4/4] elevator: use bool instead of int as the return type of elv_iosched_allow_bio_merge Jinlong Chen
2022-11-29  8:34   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b613ad2a94ff552937672d70a5f2e43068e42bb2.1669391142.git.nickyc975@zju.edu.cn \
    --to=nickyc975@zju.edu.cn \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.