diff options
author | Chandra Seetharaman <sekharan@us.ibm.com> | 2012-01-23 12:31:30 -0500 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-02-03 11:53:39 -0500 |
commit | 36731410834e08c7d15c3980abd6cc4c563c2e87 (patch) | |
tree | 22823adcd10572766aa37d98bb7f5c3dcc248189 /fs/xfs/xfs_dquot.h | |
parent | 6967b964c1012231f338445f20f877e680cd4cb8 (diff) |
Define a new function xfs_inode_dquot()
Define a new function xfs_inode_dquot() that takes a inode pointer
and a disk quota type and returns the quota pointer for the specified
quota type.
This simplifies the xfs_qm_dqget() error path significantly.
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_dquot.h')
-rw-r--r-- | fs/xfs/xfs_dquot.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/xfs/xfs_dquot.h b/fs/xfs/xfs_dquot.h index 1c48489423e4..48a795b141b6 100644 --- a/fs/xfs/xfs_dquot.h +++ b/fs/xfs/xfs_dquot.h | |||
@@ -128,6 +128,19 @@ static inline int xfs_this_quota_on(struct xfs_mount *mp, int type) | |||
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | static inline xfs_dquot_t *xfs_inode_dquot(struct xfs_inode *ip, int type) | ||
132 | { | ||
133 | switch (type & XFS_DQ_ALLTYPES) { | ||
134 | case XFS_DQ_USER: | ||
135 | return ip->i_udquot; | ||
136 | case XFS_DQ_GROUP: | ||
137 | case XFS_DQ_PROJ: | ||
138 | return ip->i_gdquot; | ||
139 | default: | ||
140 | return NULL; | ||
141 | } | ||
142 | } | ||
143 | |||
131 | #define XFS_DQ_IS_LOCKED(dqp) (mutex_is_locked(&((dqp)->q_qlock))) | 144 | #define XFS_DQ_IS_LOCKED(dqp) (mutex_is_locked(&((dqp)->q_qlock))) |
132 | #define XFS_DQ_IS_DIRTY(dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY) | 145 | #define XFS_DQ_IS_DIRTY(dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY) |
133 | #define XFS_QM_ISUDQ(dqp) ((dqp)->dq_flags & XFS_DQ_USER) | 146 | #define XFS_QM_ISUDQ(dqp) ((dqp)->dq_flags & XFS_DQ_USER) |