[PATCH 13/17] xfs: get rid of indirections in the quotaops implementation

Dave Chinner david at fromorbit.com
Sun Feb 8 20:41:15 CST 2009


On Mon, Jan 26, 2009 at 02:31:49AM -0500, Christoph Hellwig wrote:
> Currently we call from the nicely abstracted linux quotaops into a ugly
> multiplexer just to split the calls out at the same boundary again.
> Rewrite the quota ops handling to remove that obfucation.
> 
> 
> Signed-off-by: Christoph Hellwig <hch at lst.de>
.....
> +STATIC int
> +xfs_fs_get_xstate(
> +	struct super_block	*sb,
> +	struct fs_quota_stat	*fqs)
> +{
> +	struct xfs_mount	*mp = XFS_M(sb);
> +
> +	if (!XFS_IS_QUOTA_RUNNING(mp))
> +		return -ENOSYS;
> +	return xfs_qm_scall_getqstat(mp, fqs);

The return of xfs_qm_scall_getqstat() needs to be negated.

> +STATIC int
> +xfs_fs_set_xquota(
> +	struct super_block	*sb,
> +	int			type,
> +	qid_t			id,
> +	struct fs_disk_quota	*fdq)
> +{
> +	struct xfs_mount	*mp = XFS_M(sb);
> +
> +	if (sb->s_flags & MS_RDONLY)
> +		return -EROFS;
> +	if (!XFS_IS_QUOTA_RUNNING(mp))
> +		return -ENOSYS;
> +	if (!XFS_IS_QUOTA_ON(mp))
> +		return -ESRCH;
> +	if (!capable(CAP_SYS_ADMIN))
> +		return -EPERM;
> +
> +	return xfs_qm_scall_setqlim(mp, id, xfs_quota_type(type), fdq);

That should be negated as well.

Other than those two little things, looks good.

Reviewed-by: Dave Chinner <david at fromorbit.com>

-- 
Dave Chinner
david at fromorbit.com




More information about the xfs mailing list