All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bill O'Donnell <billodo@redhat.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: linux-xfs@vger.kernel.org, darrick.wong@oracle.com
Subject: Re: [PATCH 3/3] xfsprogs: xfs_quota state command should report ugp grace times
Date: Wed, 15 Jul 2020 15:44:51 -0500	[thread overview]
Message-ID: <20200715204451.GA172874@redhat.com> (raw)
In-Reply-To: <359b4cde-f252-214d-6828-2d5f85050705@sandeen.net>

On Wed, Jul 15, 2020 at 01:33:29PM -0700, Eric Sandeen wrote:
> On 7/15/20 1:12 PM, Bill O'Donnell wrote:
> > Since grace periods are now supported for three quota types (ugp),
> > modify xfs_quota state command to report times for all three.
> > Add a helper function for stat reporting.
> > 
> > Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> 
> ...
> 
> > +	if (type & XFS_GROUP_QUOTA) {
> > +		if (xfsquotactl(XFS_GETQSTATV, dev, XFS_GROUP_QUOTA,
> > +				0, (void *)&sv) < 0) {
> > +			if (xfsquotactl(XFS_GETQSTAT, dev, XFS_GROUP_QUOTA,
> > +					0, (void *)&s) < 0) {
> > +				if (flags & VERBOSE_FLAG)
> > +					fprintf(fp,
> > +						_("%s quota are not enabled on %s\n"),
> > +						type_to_string(XFS_GROUP_QUOTA),
> > +						dev);
> > +				return;
> > +			}
> > +			state_stat_to_statv(&s, &sv);
> > +		}
> 
> At first glance, can't all of the above be moved into the helper as well?
> 
> Maybe something like this (needs fixing up for sure)

Yeah, I should further reduce the redundancy.
Thanks-
Bill


> 
> static void
> state_quotafile_stat(
> 	FILE			*fp,
> 	uint			type,
> 	struct fs_path		*mount,
> 	struct fs_quota_statv	*sv)
> {
> 	bool 			accounting, enforcing;
> 	struct fs_qfilestat	*qsv;
> 
> 	switch(type) {
> 	case XFS_USER_QUOTA:
> 		qsv = &sv->qs_uquota;
> 		accounting = sv->qs_flags & XFS_QUOTA_UDQ_ACCT;
> 		enforcing = sv->qs_flags & XFS_QUOTA_UDQ_ENFD;		
> 		break;
> 	case XFS_GROUP_QUOTA:
> 		...
> 		break;
> ...
> 	default:
> 		/* defensive check goes here */
> 	}
> 
> 	if (xfsquotactl(XFS_GETQSTATV, dev, type, 0, (void *)&sv) < 0) {
> 		if (xfsquotactl(XFS_GETQSTAT, dev, type, 0, (void *)&s) < 0) {
> 			if (flags & VERBOSE_FLAG)
> 				fprintf(fp,
> 					_("%s quota are not enabled on %s\n"),
> 					type_to_string(type), dev);
> 			return;
> 		}
> 		state_stat_to_statv(&s, &sv)
> 	}	
> 
> 	state_qfilestat(fp, mount, type, qsv, accounting, enforcing);
> 
> 	state_timelimit(fp, XFS_BLOCK_QUOTA, sv->qs_btimelimit);
> 	state_warnlimit(fp, XFS_BLOCK_QUOTA, sv->qs_bwarnlimit);
> 
> 	state_timelimit(fp, XFS_INODE_QUOTA, sv->qs_itimelimit);
> 	state_warnlimit(fp, XFS_INODE_QUOTA, sv->qs_iwarnlimit);
> 
> 	state_timelimit(fp, XFS_RTBLOCK_QUOTA, sv->qs_rtbtimelimit);
> }
> 
> 
> Thanks,
> -Eric
> 


  reply	other threads:[~2020-07-15 20:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-15 20:12 [PATCH 0/3] xfsprogs: xfs_quota error message and state reporting improvement Bill O'Donnell
2020-07-15 20:12 ` [PATCH 1/3] xfsprogs: xfs_quota command error message improvement Bill O'Donnell
2020-07-17 21:10   ` Darrick J. Wong
2020-07-21 15:04   ` Christoph Hellwig
2020-07-21 15:55     ` Bill O'Donnell
2020-07-15 20:12 ` [PATCH 2/3] xfs_quota: display warning limits when printing quota type information Bill O'Donnell
2020-07-15 20:12 ` [PATCH 3/3] xfsprogs: xfs_quota state command should report ugp grace times Bill O'Donnell
2020-07-15 20:33   ` Eric Sandeen
2020-07-15 20:44     ` Bill O'Donnell [this message]
2020-07-17 20:43   ` [PATCH v2 " Bill O'Donnell
2020-07-17 21:13     ` Darrick J. Wong
2020-07-21 15:05     ` Christoph Hellwig
2020-07-30 17:46 ` [PATCH 0/3] xfsprogs: xfs_quota error message and state reporting improvement Eric Sandeen
2020-07-30 17:52   ` Bill O'Donnell
2020-07-30 18:30     ` Eric Sandeen

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=20200715204451.GA172874@redhat.com \
    --to=billodo@redhat.com \
    --cc=darrick.wong@oracle.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.