From: Damien Le Moal <dlemoal@kernel.org>
To: fio@vger.kernel.org, Vincent Fu <vincentfu@gmail.com>,
Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 1/2] iolog: refactor read_iolog()
Date: Wed, 2 Dec 2026 08:38:00 +0900 [thread overview]
Message-ID: <20261201233801.400379-2-dlemoal@kernel.org> (raw)
In-Reply-To: <20261201233801.400379-1-dlemoal@kernel.org>
In read_iolog(), use a switch-case for handling an iolog item rw type.
This is cleaner and more efficient than a series of if-else-if.
No functional change.
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
iolog.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/iolog.c b/iolog.c
index 41a3102c6c5c..54fb8283b766 100644
--- a/iolog.c
+++ b/iolog.c
@@ -582,30 +582,38 @@ static bool read_iolog(struct thread_data *td)
continue;
}
- if (rw == DDIR_READ)
+ switch (rw) {
+ case DDIR_READ:
reads++;
- else if (rw == DDIR_WRITE) {
+ break;
+ case DDIR_WRITE:
/*
* Don't add a write for ro mode
*/
if (read_only)
continue;
writes++;
- } else if (rw == DDIR_TRIM) {
+ break;
+ case DDIR_TRIM:
/*
* Don't add a trim for ro mode
*/
if (read_only)
continue;
trims++;
- } else if (rw == DDIR_WAIT) {
+ break;
+ case DDIR_WAIT:
if (td->o.no_stall)
continue;
waits++;
- } else if (rw == DDIR_INVAL) {
- } else if (ddir_sync(rw)) {
- syncs++;
- } else {
+ break;
+ case DDIR_INVAL:
+ break;
+ default:
+ if (ddir_sync(rw)) {
+ syncs++;
+ break;
+ }
log_err("bad ddir: %d\n", rw);
continue;
}
--
2.56.1
next prev parent reply other threads:[~2026-12-01 23:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 23:37 [PATCH 0/2] Cleanup and fix iolog replay Damien Le Moal
2026-12-01 23:38 ` Damien Le Moal [this message]
2026-12-01 23:38 ` [PATCH 2/2] iolog: fix iolog_items_to_fetch() Damien Le Moal
2026-12-02 1:45 ` Vincent Fu
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=20261201233801.400379-2-dlemoal@kernel.org \
--to=dlemoal@kernel.org \
--cc=axboe@kernel.dk \
--cc=fio@vger.kernel.org \
--cc=vincentfu@gmail.com \
/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.