[07/11] xfs: remove unnecessary quota type masking
diff mbox series

Message ID 159488196391.3813063.17612590871057481605.stgit@magnolia
State Accepted
Headers show
Series
  • xfs: separate dquot type from flags
Related show

Commit Message

Darrick J. Wong July 16, 2020, 6:46 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

When XFS' quota functions take a parameter for the quota type, they only
care about the three quota record types (user, group, project).
Internal state flags and whatnot should never be passed by callers and
are an error.  Now that we've moved responsibility for filtering out
internal state to the callers, we can drop the masking everywhere else.

In other words, if you call a quota function, you must only pass in
XFS_DQTYPE_*.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/xfs_dquot.h |    4 ++--
 fs/xfs/xfs_qm.h    |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Dave Chinner July 17, 2020, 12:01 a.m. UTC | #1
On Wed, Jul 15, 2020 at 11:46:03PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> When XFS' quota functions take a parameter for the quota type, they only
> care about the three quota record types (user, group, project).
> Internal state flags and whatnot should never be passed by callers and
> are an error.  Now that we've moved responsibility for filtering out
> internal state to the callers, we can drop the masking everywhere else.
> 
> In other words, if you call a quota function, you must only pass in
> XFS_DQTYPE_*.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Christoph Hellwig July 21, 2020, 2:57 p.m. UTC | #2
On Wed, Jul 15, 2020 at 11:46:03PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> When XFS' quota functions take a parameter for the quota type, they only
> care about the three quota record types (user, group, project).
> Internal state flags and whatnot should never be passed by callers and
> are an error.  Now that we've moved responsibility for filtering out
> internal state to the callers, we can drop the masking everywhere else.
> 
> In other words, if you call a quota function, you must only pass in
> XFS_DQTYPE_*.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

Patch
diff mbox series

diff --git a/fs/xfs/xfs_dquot.h b/fs/xfs/xfs_dquot.h
index 07e18ce33560..81ba614439bd 100644
--- a/fs/xfs/xfs_dquot.h
+++ b/fs/xfs/xfs_dquot.h
@@ -136,7 +136,7 @@  xfs_dquot_type(const struct xfs_dquot *dqp)
 
 static inline int xfs_this_quota_on(struct xfs_mount *mp, int type)
 {
-	switch (type & XFS_DQTYPE_REC_MASK) {
+	switch (type) {
 	case XFS_DQTYPE_USER:
 		return XFS_IS_UQUOTA_ON(mp);
 	case XFS_DQTYPE_GROUP:
@@ -150,7 +150,7 @@  static inline int xfs_this_quota_on(struct xfs_mount *mp, int type)
 
 static inline struct xfs_dquot *xfs_inode_dquot(struct xfs_inode *ip, int type)
 {
-	switch (type & XFS_DQTYPE_REC_MASK) {
+	switch (type) {
 	case XFS_DQTYPE_USER:
 		return ip->i_udquot;
 	case XFS_DQTYPE_GROUP:
diff --git a/fs/xfs/xfs_qm.h b/fs/xfs/xfs_qm.h
index f04af35349d7..fac6fa81f1fa 100644
--- a/fs/xfs/xfs_qm.h
+++ b/fs/xfs/xfs_qm.h
@@ -88,7 +88,7 @@  xfs_dquot_tree(
 static inline struct xfs_inode *
 xfs_quota_inode(xfs_mount_t *mp, uint dq_flags)
 {
-	switch (dq_flags & XFS_DQTYPE_REC_MASK) {
+	switch (dq_flags) {
 	case XFS_DQTYPE_USER:
 		return mp->m_quotainfo->qi_uquotaip;
 	case XFS_DQTYPE_GROUP: