Re: [PATCH 3/3] xfsprogs: xfs_quota state command should report ugp grace times

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

...

> +	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)

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




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux