From: sashiko-bot@kernel.org
To: "Hiroshi Nishida" <nishidafmly@gmail.com>
Cc: linux-raid@vger.kernel.org, yukuai@fygo.io
Subject: Re: [PATCH 5/5] md: clarify the resync ETA comment in status_resync()
Date: Wed, 24 Jun 2026 15:58:27 +0000 [thread overview]
Message-ID: <20260624155828.3C6F91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260624155421.211626-6-nishidafmly@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The newly added comment incorrectly states that the divisor `db` is scaled up by 32, when the code actually scales it down.
--
commit 21672ecf7d2b823245c32b9d2699f7cf1a5c2e7c
Author: Hiroshi Nishida <nishidafmly@gmail.com>
md: clarify the resync ETA comment in status_resync()
This commit updates the block comment above the remaining-time computation
in status_resync() to clarify the calculation logic. It is a comment-only
change.
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 0cd85cc92ed31..a5c0da0d11334 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -8916,17 +8916,11 @@ static int status_resync(struct seq_file *seq, struct mddev *mddev)
> * db: blocks written from mark until now
> * rt: remaining time
> *
> - * rt is a sector_t, which is always 64bit now. We are keeping
> - * the original algorithm, but it is not really necessary.
> - *
> - * Original algorithm:
> - * So we divide before multiply in case it is 32bit and close
> - * to the limit.
> - * We scale the divisor (db) by 32 to avoid losing precision
> - * near the end of resync when the number of remaining sectors
> - * is close to 'db'.
> - * We then divide rt by 32 after multiplying by db to compensate.
> - * The '+1' avoids division by zero if db is very small.
> + * rt is computed as (remaining sectors) * dt / db. To keep precision
> + * near the end of resync, when the remaining count is close to db, the
> + * divisor db is scaled up by 32 before the divide and rt is scaled back
[Severity: Low]
Is this new comment accurate regarding the math applied to db?
The comment states that the divisor db is scaled up by 32, but looking at
the actual code:
rt = max_sectors - resync;
rt = div64_u64(rt, db/32+1);
This divides db by 32, effectively scaling it down rather than up (which in
turn scales the resulting quotient up). Does this comment need to be
adjusted to reflect the db/32 downscaling?
> + * down by 32 afterwards. The '+1' avoids division by zero when db is
> + * very small.
> */
> dt = ((jiffies - mddev->resync_mark) / HZ);
> if (!dt) dt++;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260624155421.211626-1-nishidafmly@gmail.com?part=5
next prev parent reply other threads:[~2026-06-24 15:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 15:54 [PATCH 0/5] md: minor cleanups in md core and raid5/raid1/raid10 Hiroshi Nishida
2026-06-24 15:54 ` [PATCH 1/5] md/raid1,raid10: drop unused mddev arg from check_decay_read_errors() Hiroshi Nishida
2026-06-24 15:54 ` [PATCH 2/5] md/raid5: use max() in raid5_calc_degraded() Hiroshi Nishida
2026-06-24 15:54 ` [PATCH 3/5] md: make is_mddev_idle() take a bool init flag Hiroshi Nishida
2026-06-24 15:54 ` [PATCH 4/5] md: use sector_t for recovery_active in status_resync() Hiroshi Nishida
2026-06-24 16:03 ` sashiko-bot
2026-06-24 16:48 ` Hiroshi Nishida
2026-06-24 15:54 ` [PATCH 5/5] md: clarify the resync ETA comment " Hiroshi Nishida
2026-06-24 15:58 ` sashiko-bot [this message]
2026-06-24 16:50 ` Hiroshi Nishida
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=20260624155828.3C6F91F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=nishidafmly@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yukuai@fygo.io \
/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