From: Christoph Hellwig <hch@infradead.org>
To: Andrey Albershteyn <aalbersh@redhat.com>
Cc: cem@kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/5] xfs_repair: make duration take time_t
Date: Tue, 16 Apr 2024 09:45:59 -0700 [thread overview]
Message-ID: <Zh6rRxuTO78gyIKk@infradead.org> (raw)
In-Reply-To: <20240416123427.614899-3-aalbersh@redhat.com>
On Tue, Apr 16, 2024 at 02:34:24PM +0200, Andrey Albershteyn wrote:
> @@ -273,7 +273,7 @@ progress_rpt_thread (void *p)
> _("\t- %02d:%02d:%02d: Phase %d: %" PRIu64 "%% done - estimated remaining time %s\n"),
> tmp->tm_hour, tmp->tm_min, tmp->tm_sec,
> current_phase, percent,
> - duration((int) ((*msgp->total - sum) * (elapsed)/sum), msgbuf));
> + duration((time_t) ((*msgp->total - sum) * (elapsed)/sum), msgbuf));
What is the point of the time_t cast the gets applied to the
final calculated expression? Even if time_t is wieder than what
it was, it would only extent it after we've overlflow the original
type. The whole thing also just is formatted and filled with useles
braces to make it look really odd. Something like:
current_phase, percent,
duration((*msgp->total - sum) * elapsed / sum,
msgbuf));
would be way more readable.
next prev parent reply other threads:[~2024-04-16 16:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 12:34 [PATCH 0/5] xfsprogs random fixes found by Coverity scan Andrey Albershteyn
2024-04-16 12:34 ` [PATCH 1/5] xfs_db: fix leak in flist_find_ftyp() Andrey Albershteyn
2024-04-16 16:07 ` Darrick J. Wong
2024-04-16 16:32 ` Christoph Hellwig
2024-04-16 12:34 ` [PATCH 2/5] xfs_repair: make duration take time_t Andrey Albershteyn
2024-04-16 16:12 ` Darrick J. Wong
2024-04-16 16:20 ` Andrey Albershteyn
2024-04-16 16:45 ` Christoph Hellwig [this message]
2024-04-16 12:34 ` [PATCH 3/5] xfs_io: init count to stop loop from execution Andrey Albershteyn
2024-04-16 16:15 ` Darrick J. Wong
2024-04-16 16:22 ` Andrey Albershteyn
2024-04-16 12:34 ` [PATCH 4/5] xfs_scrub: don't call phase_end if phase_rusage was not initialized Andrey Albershteyn
2024-04-16 16:18 ` Darrick J. Wong
2024-04-16 12:34 ` [PATCH 5/5] xfs_fsr: convert fsrallfs to use time_t instead of int Andrey Albershteyn
2024-04-16 16:21 ` Darrick J. Wong
2024-04-16 16:31 ` Andrey Albershteyn
2024-04-16 17:07 ` Darrick J. Wong
2024-04-16 16:39 ` Eric Sandeen
2024-04-16 16:41 ` 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=Zh6rRxuTO78gyIKk@infradead.org \
--to=hch@infradead.org \
--cc=aalbersh@redhat.com \
--cc=cem@kernel.org \
--cc=linux-xfs@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