[PATCH 5/5] md: clarify the resync ETA comment in status_resync()
From: Hiroshi Nishida
Date: Wed Jun 24 2026 - 11:55:41 EST
The comment above the remaining-time computation was self-contradictory:
it said the original algorithm was being kept but "is not really
necessary", then described that algorithm under an "Original algorithm:"
heading as if it had been replaced. The code still uses it. Rewrite the
comment to simply describe what the code does.
Comment only; no functional change.
Assisted-by: Claude:claude-opus-4-8 [Claude Code]
Signed-off-by: Hiroshi Nishida <nishidafmly@xxxxxxxxx>
---
drivers/md/md.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 0cd85cc92ed3..a5c0da0d1133 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
+ * down by 32 afterwards. The '+1' avoids division by zero when db is
+ * very small.
*/
dt = ((jiffies - mddev->resync_mark) / HZ);
if (!dt) dt++;
--
2.43.0