* [PATCH] xfsprogs: xfs_quota state command should report ugp grace times
@ 2020-07-09 21:26 Bill O'Donnell
2020-07-10 9:00 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Bill O'Donnell @ 2020-07-09 21:26 UTC (permalink / raw)
To: linux-xfs; +Cc: sandeen, darrick.wong
Since grace periods are now supported for three quota types (ugp),
modify xfs_quota state command to report times for all three.
Signed-off-by: Bill O'Donnell <billodo@redhat.com>
---
quota/state.c | 71 ++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 56 insertions(+), 15 deletions(-)
diff --git a/quota/state.c b/quota/state.c
index 7a595fc6..32ccfa42 100644
--- a/quota/state.c
+++ b/quota/state.c
@@ -193,33 +193,74 @@ state_quotafile_mount(
sv.qs_version = FS_QSTATV_VERSION1;
- 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;
+ if (type & XFS_USER_QUOTA) {
+ if (xfsquotactl(XFS_GETQSTATV, dev, XFS_USER_QUOTA,
+ 0, (void *)&sv) < 0) {
+ if (xfsquotactl(XFS_GETQSTAT, dev, XFS_USER_QUOTA,
+ 0, (void *)&s) < 0) {
+ if (flags & VERBOSE_FLAG)
+ fprintf(fp,
+ _("%s quota are not enabled on %s\n"),
+ type_to_string(XFS_USER_QUOTA),
+ dev);
+ return;
+ }
+ state_stat_to_statv(&s, &sv);
}
- state_stat_to_statv(&s, &sv);
- }
- if (type & XFS_USER_QUOTA)
state_qfilestat(fp, mount, XFS_USER_QUOTA, &sv.qs_uquota,
sv.qs_flags & XFS_QUOTA_UDQ_ACCT,
sv.qs_flags & XFS_QUOTA_UDQ_ENFD);
- if (type & XFS_GROUP_QUOTA)
+ state_timelimit(fp, XFS_BLOCK_QUOTA, sv.qs_btimelimit);
+ state_timelimit(fp, XFS_INODE_QUOTA, sv.qs_itimelimit);
+ state_timelimit(fp, XFS_RTBLOCK_QUOTA, sv.qs_rtbtimelimit);
+ }
+
+ 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);
+ }
state_qfilestat(fp, mount, XFS_GROUP_QUOTA, &sv.qs_gquota,
sv.qs_flags & XFS_QUOTA_GDQ_ACCT,
sv.qs_flags & XFS_QUOTA_GDQ_ENFD);
- if (type & XFS_PROJ_QUOTA)
+
+ state_timelimit(fp, XFS_BLOCK_QUOTA, sv.qs_btimelimit);
+ state_timelimit(fp, XFS_INODE_QUOTA, sv.qs_itimelimit);
+ state_timelimit(fp, XFS_RTBLOCK_QUOTA, sv.qs_rtbtimelimit);
+ }
+
+ if (type & XFS_PROJ_QUOTA) {
+ if (xfsquotactl(XFS_GETQSTATV, dev, XFS_PROJ_QUOTA,
+ 0, (void *)&sv) < 0) {
+ if (xfsquotactl(XFS_GETQSTAT, dev, XFS_PROJ_QUOTA,
+ 0, (void *)&s) < 0) {
+ if (flags & VERBOSE_FLAG)
+ fprintf(fp,
+ _("%s quota are not enabled on %s\n"),
+ type_to_string(XFS_PROJ_QUOTA),
+ dev);
+ return;
+ }
+ state_stat_to_statv(&s, &sv);
+ }
state_qfilestat(fp, mount, XFS_PROJ_QUOTA, &sv.qs_pquota,
sv.qs_flags & XFS_QUOTA_PDQ_ACCT,
sv.qs_flags & XFS_QUOTA_PDQ_ENFD);
- state_timelimit(fp, XFS_BLOCK_QUOTA, sv.qs_btimelimit);
- state_timelimit(fp, XFS_INODE_QUOTA, sv.qs_itimelimit);
- state_timelimit(fp, XFS_RTBLOCK_QUOTA, sv.qs_rtbtimelimit);
+ state_timelimit(fp, XFS_BLOCK_QUOTA, sv.qs_btimelimit);
+ state_timelimit(fp, XFS_INODE_QUOTA, sv.qs_itimelimit);
+ state_timelimit(fp, XFS_RTBLOCK_QUOTA, sv.qs_rtbtimelimit);
+ }
}
static void
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfsprogs: xfs_quota state command should report ugp grace times
2020-07-09 21:26 [PATCH] xfsprogs: xfs_quota state command should report ugp grace times Bill O'Donnell
@ 2020-07-10 9:00 ` Christoph Hellwig
2020-07-10 13:53 ` Bill O'Donnell
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2020-07-10 9:00 UTC (permalink / raw)
To: Bill O'Donnell; +Cc: linux-xfs, sandeen, darrick.wong
On Thu, Jul 09, 2020 at 04:26:57PM -0500, 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.
This looks like it'll clash with the patch that Darrick just sent..
> + if (type & XFS_USER_QUOTA) {
> + if (xfsquotactl(XFS_GETQSTATV, dev, XFS_USER_QUOTA,
> + 0, (void *)&sv) < 0) {
> + if (xfsquotactl(XFS_GETQSTAT, dev, XFS_USER_QUOTA,
> + 0, (void *)&s) < 0) {
> + if (flags & VERBOSE_FLAG)
> + fprintf(fp,
> + _("%s quota are not enabled on %s\n"),
> + type_to_string(XFS_USER_QUOTA),
> + dev);
> + return;
> + }
> + state_stat_to_statv(&s, &sv);
> }
>
> state_qfilestat(fp, mount, XFS_USER_QUOTA, &sv.qs_uquota,
> sv.qs_flags & XFS_QUOTA_UDQ_ACCT,
> sv.qs_flags & XFS_QUOTA_UDQ_ENFD);
> + state_timelimit(fp, XFS_BLOCK_QUOTA, sv.qs_btimelimit);
> + state_timelimit(fp, XFS_INODE_QUOTA, sv.qs_itimelimit);
> + state_timelimit(fp, XFS_RTBLOCK_QUOTA, sv.qs_rtbtimelimit);
> + }
Any chance we could factor this repititive code into a helper?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfsprogs: xfs_quota state command should report ugp grace times
2020-07-10 9:00 ` Christoph Hellwig
@ 2020-07-10 13:53 ` Bill O'Donnell
0 siblings, 0 replies; 3+ messages in thread
From: Bill O'Donnell @ 2020-07-10 13:53 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs, sandeen, darrick.wong
On Fri, Jul 10, 2020 at 10:00:42AM +0100, Christoph Hellwig wrote:
> On Thu, Jul 09, 2020 at 04:26:57PM -0500, 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.
>
> This looks like it'll clash with the patch that Darrick just sent..
>
> > + if (type & XFS_USER_QUOTA) {
> > + if (xfsquotactl(XFS_GETQSTATV, dev, XFS_USER_QUOTA,
> > + 0, (void *)&sv) < 0) {
> > + if (xfsquotactl(XFS_GETQSTAT, dev, XFS_USER_QUOTA,
> > + 0, (void *)&s) < 0) {
> > + if (flags & VERBOSE_FLAG)
> > + fprintf(fp,
> > + _("%s quota are not enabled on %s\n"),
> > + type_to_string(XFS_USER_QUOTA),
> > + dev);
> > + return;
> > + }
> > + state_stat_to_statv(&s, &sv);
> > }
> >
> > state_qfilestat(fp, mount, XFS_USER_QUOTA, &sv.qs_uquota,
> > sv.qs_flags & XFS_QUOTA_UDQ_ACCT,
> > sv.qs_flags & XFS_QUOTA_UDQ_ENFD);
> > + state_timelimit(fp, XFS_BLOCK_QUOTA, sv.qs_btimelimit);
> > + state_timelimit(fp, XFS_INODE_QUOTA, sv.qs_itimelimit);
> > + state_timelimit(fp, XFS_RTBLOCK_QUOTA, sv.qs_rtbtimelimit);
> > + }
>
> Any chance we could factor this repititive code into a helper?
>
Yeah, that makes sense. I'll do it.
Thanks-
Bill
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-10 13:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09 21:26 [PATCH] xfsprogs: xfs_quota state command should report ugp grace times Bill O'Donnell
2020-07-10 9:00 ` Christoph Hellwig
2020-07-10 13:53 ` Bill O'Donnell
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.