diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2020-07-16 03:48:31 +0300 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2020-07-29 06:24:14 +0300 |
commit | dbcbc7b90e8a43aa00412bfa601a2d110a29086a (patch) | |
tree | 46a20b5b78f52e98d19cf07acc40f83db71d9b72 /fs/xfs/xfs_dquot.h | |
parent | 8cd4901da56caadc16b4e8d6b434291a8ce31d7c (diff) | |
download | linux-dbcbc7b90e8a43aa00412bfa601a2d110a29086a.tar.xz |
xfs: refactor testing if a particular dquot is being enforced
Create a small helper to test if enforcement is enabled for a
given incore dquot and replace the open-code logic testing.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_dquot.h')
-rw-r--r-- | fs/xfs/xfs_dquot.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/xfs/xfs_dquot.h b/fs/xfs/xfs_dquot.h index 17a21677723f..fcf9bd676615 100644 --- a/fs/xfs/xfs_dquot.h +++ b/fs/xfs/xfs_dquot.h @@ -156,6 +156,23 @@ static inline struct xfs_dquot *xfs_inode_dquot(struct xfs_inode *ip, int type) } } +/* Decide if the dquot's limits are actually being enforced. */ +static inline bool +xfs_dquot_is_enforced( + const struct xfs_dquot *dqp) +{ + switch (dqp->dq_flags & XFS_DQTYPE_REC_MASK) { + case XFS_DQTYPE_USER: + return XFS_IS_UQUOTA_ENFORCED(dqp->q_mount); + case XFS_DQTYPE_GROUP: + return XFS_IS_GQUOTA_ENFORCED(dqp->q_mount); + case XFS_DQTYPE_PROJ: + return XFS_IS_PQUOTA_ENFORCED(dqp->q_mount); + } + ASSERT(0); + return false; +} + /* * Check whether a dquot is under low free space conditions. We assume the quota * is enabled and enforced. |