From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: sandeen@sandeen.net, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 05/26] xfs_quota: convert time_to_string to use time64_t
Date: Thu, 29 Oct 2020 10:32:34 -0700 [thread overview]
Message-ID: <20201029173234.GE1061260@magnolia> (raw)
In-Reply-To: <20201029094712.GI2091@infradead.org>
On Thu, Oct 29, 2020 at 09:47:12AM +0000, Christoph Hellwig wrote:
> 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?
It's a setup to avoid long lines of nested function call crud once we
get to patch 23. Without the local variable, the fprintf turns into
this ugliness:
fprintf(fp, " %6s %6s %6s %02d %8s ",
bbs_to_string(d.d_bcount, c, sizeof(c)),
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(decode_timer(&d, d.d_itimer,
d.d_itimer_hi),
qflags));
Which I guess is also fine but I kind of hate function call inside
function call inside function call combined with high indent levels.
--D
next prev parent reply other threads:[~2020-10-29 17:32 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-26 23:34 [PATCH v6 00/26] xfsprogs: widen timestamps to deal with y2038 Darrick J. Wong
2020-10-26 23:34 ` [PATCH 01/26] libxfs: create a real struct timespec64 Darrick J. Wong
2020-10-29 9:44 ` Christoph Hellwig
2020-10-26 23:34 ` [PATCH 02/26] libxfs: refactor NSEC_PER_SEC Darrick J. Wong
2020-10-29 9:44 ` Christoph Hellwig
2020-10-26 23:34 ` [PATCH 03/26] libfrog: define LIBFROG_BULKSTAT_CHUNKSIZE to remove dependence on XFS_INODES_PER_CHUNK Darrick J. Wong
2020-10-29 9:45 ` Christoph Hellwig
2020-10-29 9:45 ` Christoph Hellwig
2020-10-29 17:25 ` Darrick J. Wong
2020-10-30 8:20 ` Christoph Hellwig
2020-10-26 23:34 ` [PATCH 04/26] libfrog: convert cvttime to return time64_t Darrick J. Wong
2020-10-29 9:45 ` Christoph Hellwig
2020-10-26 23:34 ` [PATCH 05/26] xfs_quota: convert time_to_string to use time64_t Darrick J. Wong
2020-10-29 9:47 ` Christoph Hellwig
2020-10-29 17:32 ` Darrick J. Wong [this message]
2020-10-30 8:21 ` Christoph Hellwig
2020-11-16 20:45 ` Eric Sandeen
2020-10-26 23:34 ` [PATCH 06/26] xfs_db: refactor timestamp printing Darrick J. Wong
2020-10-29 9:47 ` Christoph Hellwig
2020-10-26 23:34 ` [PATCH 07/26] xfs_db: refactor quota timer printing Darrick J. Wong
2020-10-29 9:48 ` Christoph Hellwig
2020-10-26 23:34 ` [PATCH 08/26] xfs_logprint: refactor timestamp printing Darrick J. Wong
2020-10-29 9:48 ` Christoph Hellwig
2020-11-23 20:14 ` Eric Sandeen
2020-11-24 0:25 ` Darrick J. Wong
2020-10-26 23:35 ` [PATCH 09/26] xfs: explicitly define inode timestamp range Darrick J. Wong
2020-10-26 23:35 ` [PATCH 10/26] xfs: refactor quota expiration timer modification Darrick J. Wong
2020-10-26 23:35 ` [PATCH 11/26] xfs: refactor default quota grace period setting code Darrick J. Wong
2020-10-26 23:35 ` [PATCH 12/26] xfs: refactor quota timestamp coding Darrick J. Wong
2020-10-26 23:35 ` [PATCH 13/26] xfs: move xfs_log_dinode_to_disk to the log recovery code Darrick J. Wong
2020-10-26 23:35 ` [PATCH 14/26] xfs: redefine xfs_timestamp_t Darrick J. Wong
2020-10-26 23:35 ` [PATCH 15/26] xfs: redefine xfs_ictimestamp_t Darrick J. Wong
2020-10-26 23:35 ` [PATCH 16/26] xfs: widen ondisk inode timestamps to deal with y2038+ Darrick J. Wong
2020-10-26 23:35 ` [PATCH 17/26] xfs: widen ondisk quota expiration timestamps to handle y2038+ Darrick J. Wong
2020-10-26 23:36 ` [PATCH 18/26] libxfs: propagate bigtime inode flag when allocating Darrick J. Wong
2020-10-29 9:48 ` Christoph Hellwig
2020-10-26 23:36 ` [PATCH 19/26] libfrog: list the bigtime feature when reporting geometry Darrick J. Wong
2020-10-29 9:49 ` Christoph Hellwig
2020-10-26 23:36 ` [PATCH 20/26] xfs_db: report bigtime format timestamps Darrick J. Wong
2020-10-29 9:50 ` Christoph Hellwig
2020-10-29 17:45 ` Darrick J. Wong
2020-10-30 8:23 ` Christoph Hellwig
2020-11-16 21:16 ` Eric Sandeen
2020-11-16 22:41 ` Darrick J. Wong
2020-11-17 17:45 ` [PATCH v2 " Darrick J. Wong
2020-11-17 18:18 ` Eric Sandeen
2020-10-26 23:36 ` [PATCH 21/26] xfs_db: support printing time limits Darrick J. Wong
2020-10-29 9:50 ` Christoph Hellwig
2020-10-26 23:36 ` [PATCH 22/26] xfs_db: add bigtime upgrade path Darrick J. Wong
2020-10-29 9:51 ` Christoph Hellwig
2020-11-16 21:15 ` [PATCH v2 " Darrick J. Wong
2020-10-26 23:36 ` [PATCH 23/26] xfs_quota: support editing and reporting quotas with bigtime Darrick J. Wong
2020-10-29 9:51 ` Christoph Hellwig
2020-10-26 23:36 ` [PATCH 24/26] xfs_repair: support bigtime timestamp checking Darrick J. Wong
2020-10-29 9:52 ` Christoph Hellwig
2020-10-26 23:36 ` [PATCH 25/26] mkfs: format bigtime filesystems Darrick J. Wong
2020-10-29 9:52 ` Christoph Hellwig
2020-10-26 23:36 ` [PATCH 26/26] xfs: enable big timestamps Darrick J. Wong
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=20201029173234.GE1061260@magnolia \
--to=darrick.wong@oracle.com \
--cc=hch@infradead.org \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
/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