aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandra Seetharaman <sekharan@us.ibm.com>2012-01-23 12:31:25 -0500
committerBen Myers <bpm@sgi.com>2012-02-03 10:42:53 -0500
commit6967b964c1012231f338445f20f877e680cd4cb8 (patch)
treebbf07cd6220f957eed9dead914f8603548c21fbb
parentb9957308452afcf58e656db834f44df10d7b1662 (diff)
Define a new function xfs_this_quota_on()
Create a new function xfs_this_quota_on() that takes a xfs_mount data structure and a disk quota type and returns true if the specified type of quota is ON in the xfs_mount data structure. Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ben Myers <bpm@sgi.com>
-rw-r--r--fs/xfs/xfs_dquot.c4
-rw-r--r--fs/xfs/xfs_dquot.h17
2 files changed, 15 insertions, 6 deletions
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index b4ff40b5f918..4c8b3d2cc961 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -358,7 +358,7 @@ xfs_qm_dqalloc(
358 * Return if this type of quotas is turned off while we didn't 358 * Return if this type of quotas is turned off while we didn't
359 * have an inode lock 359 * have an inode lock
360 */ 360 */
361 if (XFS_IS_THIS_QUOTA_OFF(dqp)) { 361 if (!xfs_this_quota_on(dqp->q_mount, dqp->dq_flags)) {
362 xfs_iunlock(quotip, XFS_ILOCK_EXCL); 362 xfs_iunlock(quotip, XFS_ILOCK_EXCL);
363 return (ESRCH); 363 return (ESRCH);
364 } 364 }
@@ -460,7 +460,7 @@ xfs_qm_dqtobp(
460 dqp->q_fileoffset = (xfs_fileoff_t)id / mp->m_quotainfo->qi_dqperchunk; 460 dqp->q_fileoffset = (xfs_fileoff_t)id / mp->m_quotainfo->qi_dqperchunk;
461 461
462 xfs_ilock(quotip, XFS_ILOCK_SHARED); 462 xfs_ilock(quotip, XFS_ILOCK_SHARED);
463 if (XFS_IS_THIS_QUOTA_OFF(dqp)) { 463 if (!xfs_this_quota_on(dqp->q_mount, dqp->dq_flags)) {
464 /* 464 /*
465 * Return if this type of quotas is turned off while we 465 * Return if this type of quotas is turned off while we
466 * didn't have the quota inode lock. 466 * didn't have the quota inode lock.
diff --git a/fs/xfs/xfs_dquot.h b/fs/xfs/xfs_dquot.h
index a1d91d8f1802..1c48489423e4 100644
--- a/fs/xfs/xfs_dquot.h
+++ b/fs/xfs/xfs_dquot.h
@@ -115,6 +115,19 @@ static inline void xfs_dqunlock_nonotify(struct xfs_dquot *dqp)
115 mutex_unlock(&dqp->q_qlock); 115 mutex_unlock(&dqp->q_qlock);
116} 116}
117 117
118static inline int xfs_this_quota_on(struct xfs_mount *mp, int type)
119{
120 switch (type & XFS_DQ_ALLTYPES) {
121 case XFS_DQ_USER:
122 return XFS_IS_UQUOTA_ON(mp);
123 case XFS_DQ_GROUP:
124 case XFS_DQ_PROJ:
125 return XFS_IS_OQUOTA_ON(mp);
126 default:
127 return 0;
128 }
129}
130
118#define XFS_DQ_IS_LOCKED(dqp) (mutex_is_locked(&((dqp)->q_qlock))) 131#define XFS_DQ_IS_LOCKED(dqp) (mutex_is_locked(&((dqp)->q_qlock)))
119#define XFS_DQ_IS_DIRTY(dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY) 132#define XFS_DQ_IS_DIRTY(dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY)
120#define XFS_QM_ISUDQ(dqp) ((dqp)->dq_flags & XFS_DQ_USER) 133#define XFS_QM_ISUDQ(dqp) ((dqp)->dq_flags & XFS_DQ_USER)
@@ -125,10 +138,6 @@ static inline void xfs_dqunlock_nonotify(struct xfs_dquot *dqp)
125 XFS_DQ_TO_QINF(dqp)->qi_uquotaip : \ 138 XFS_DQ_TO_QINF(dqp)->qi_uquotaip : \
126 XFS_DQ_TO_QINF(dqp)->qi_gquotaip) 139 XFS_DQ_TO_QINF(dqp)->qi_gquotaip)
127 140
128#define XFS_IS_THIS_QUOTA_OFF(d) (! (XFS_QM_ISUDQ(d) ? \
129 (XFS_IS_UQUOTA_ON((d)->q_mount)) : \
130 (XFS_IS_OQUOTA_ON((d)->q_mount))))
131
132extern int xfs_qm_dqread(struct xfs_mount *, xfs_dqid_t, uint, 141extern int xfs_qm_dqread(struct xfs_mount *, xfs_dqid_t, uint,
133 uint, struct xfs_dquot **); 142 uint, struct xfs_dquot **);
134extern void xfs_qm_dqdestroy(xfs_dquot_t *); 143extern void xfs_qm_dqdestroy(xfs_dquot_t *);