From: Racz Zoltan <racz.zoli@gmail.com>
To: dsterba@suse.cz
Cc: linux-btrfs@vger.kernel.org, Racz Zoltan <racz.zoli@gmail.com>
Subject: [PATCH 1/2] Removed redundant if/else statement
Date: Fri, 7 Feb 2025 04:33:01 +0200 [thread overview]
Message-ID: <20250207023302.311829-2-racz.zoli@gmail.com> (raw)
In-Reply-To: <20250207023302.311829-1-racz.zoli@gmail.com>
Removed unnecesary if/else statement in the print_scrub_summary
function. If unit_mode == UNITS_RAW, bytes_per_sec and limit get converted to
UNITS_RAW, otherwise to unit_mode, but in both cases the exact same message is
written to the output
cmds/scrub.c | 28 +++++++++-------------------
1 file changed, 9 insertions(+), 19 deletions(-)
diff --git a/cmds/scrub.c b/cmds/scrub.c
index b2cdc924..3507c9d8 100644
--- a/cmds/scrub.c
+++ b/cmds/scrub.c
@@ -207,25 +207,15 @@ static void print_scrub_summary(struct btrfs_scrub_progress *p, struct scrub_sta
* Rate and size units are disproportionate so they are affected only
* by --raw, otherwise it's human readable
*/
- if (unit_mode == UNITS_RAW) {
- pr_verbose(LOG_DEFAULT, "Rate: %s/s",
- pretty_size_mode(bytes_per_sec, UNITS_RAW));
- if (limit > 1)
- pr_verbose(LOG_DEFAULT, " (limit %s/s)",
- pretty_size_mode(limit, UNITS_RAW));
- else if (limit == 1)
- pr_verbose(LOG_DEFAULT, " (some device limits set)");
- pr_verbose(LOG_DEFAULT, "\n");
- } else {
- pr_verbose(LOG_DEFAULT, "Rate: %s/s",
- pretty_size_mode(bytes_per_sec, unit_mode));
- if (limit > 1)
- pr_verbose(LOG_DEFAULT, " (limit %s/s)",
- pretty_size_mode(limit, unit_mode));
- else if (limit == 1)
- pr_verbose(LOG_DEFAULT, " (some device limits set)");
- pr_verbose(LOG_DEFAULT, "\n");
- }
+
+ pr_verbose(LOG_DEFAULT, "Rate: %s/s",
+ pretty_size_mode(bytes_per_sec, unit_mode));
+ if (limit > 1)
+ pr_verbose(LOG_DEFAULT, " (limit %s/s)",
+ pretty_size_mode(limit, unit_mode));
+ else if (limit == 1)
+ pr_verbose(LOG_DEFAULT, " (some device limits set)");
+ pr_verbose(LOG_DEFAULT, "\n");
pr_verbose(LOG_DEFAULT, "Error summary: ");
if (err_cnt || err_cnt2) {
--
2.48.1
next prev parent reply other threads:[~2025-02-07 2:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 2:33 [PATCH 0/2] btrfs-progs: scrub status: add json output format Racz Zoltan
2025-02-07 2:33 ` Racz Zoltan [this message]
2025-02-11 19:14 ` [PATCH 1/2] Removed redundant if/else statement David Sterba
2025-02-11 19:31 ` Racz Zoli
2025-02-11 23:42 ` David Sterba
2025-02-13 19:49 ` Racz Zoli
2025-02-07 2:33 ` [PATCH 2/2] scrub status: add json output format Racz Zoltan
2025-02-11 19:41 ` David Sterba
2025-02-11 23:37 ` Racz Zoli
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=20250207023302.311829-2-racz.zoli@gmail.com \
--to=racz.zoli@gmail.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox