xfsprogs: xfs_quota state command should report ugp grace times
PATCH 1/1 xfsprogs: xfs_quota state command should report ugp grace times
Since grace periods are now supported for three quota types (ugp), modify xfs_quota state command to report times for all three.
--- quota/state.c | 71 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 15 deletions(-)
quota/state.c +56 -15
@@ -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
Signature · 1 line
2.26.2
Quoted 2 lines · Bill O'Donnell
Since grace periods are now supported for three quota types (ugp), modify
xfs_quotastate command to report times for all three.
This looks like it'll clash with the patch that Darrick just sent..
Quoted 12 lines
quota/state.c +12
-0+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 ; + }
quota/state.c state_quotafile_mount( · line 217
Quoted 10 lines
quota/state.c +5
-0+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?
Quoted 21 lines · Christoph Hellwig
Quoted 2 lines · Bill O'Donnell
Since grace periods are now supported for three quota types (ugp), modify
xfs_quotastate command to report times for all three.This looks like it'll clash with the patch that Darrick just sent..
Quoted 15 lines
quota/state.c +13
-0+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); }
Quoted 10 lines
quota/state.c state_quotafile_mount( · line 217
Quoted 7 lines
quota/state.c +4
-0state_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