Re: [PATCH 05/26] xfs_quota: convert time_to_string to use time64_t

Christoph Hellwig
2020-10-29T09:47:17Z

On Mon, Oct 26, 2020 at 04:34:38PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Rework the time_to_string helper to be capable of dealing with 64-bit
> timestamps.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> quota/quota.c | 16 ++++++++++------
> quota/quota.h | 2 +-
> quota/report.c | 16 ++++++++++------
> quota/util.c | 5 +++--
> 4 files changed, 24 insertions(+), 15 deletions(-)
>
>
> diff --git a/quota/quota.c b/quota/quota.c
> index 9545cc430a93..8ba0995d9174 100644
> --- a/quota/quota.c
> +++ b/quota/quota.c
> @@ -48,6 +48,7 @@ quota_mount(
> uint flags)
> {
> fs_disk_quota_t d;
> + time64_t timer;
> char *dev = mount->fs_name;
> char c[8], h[8], s[8];
> uint qflags;
> @@ -100,6 +101,7 @@ quota_mount(
> }
>
> if (form & XFS_BLOCK_QUOTA) {
> + timer = d.d_btimer;
> qflags = (flags & HUMAN_FLAG);
> if (d.d_blk_hardlimit && d.d_bcount > d.d_blk_hardlimit)
> qflags |= LIMIT_FLAG;
> @@ -111,16 +113,17 @@ quota_mount(
> bbs_to_string(d.d_blk_softlimit, s, sizeof(s)),
> bbs_to_string(d.d_blk_hardlimit, h, sizeof(h)),
> d.d_bwarns,
> - time_to_string(d.d_btimer, qflags));
> + time_to_string(timer, qflags));

What do the local variables buy us over just relying on the implicit cast
to a larger integer type?