All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 06/11] xfs: always use xfs_dquot_type when extracting type from a dquot
Date: Wed, 15 Jul 2020 23:45:57 -0700	[thread overview]
Message-ID: <159488195772.3813063.4337415651120546350.stgit@magnolia> (raw)
In-Reply-To: <159488191927.3813063.6443979621452250872.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

Always use the xfs_dquot_type helper to extract the quota type from an
incore dquot.  This moves responsibility for filtering internal state
information and whatnot to anybody passing around a dquot.

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


diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index ce946d53bb61..b46a9e63b286 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -273,14 +273,15 @@ xfs_dquot_disk_alloc(
 	struct xfs_trans	*tp = *tpp;
 	struct xfs_mount	*mp = tp->t_mountp;
 	struct xfs_buf		*bp;
-	struct xfs_inode	*quotip = xfs_quota_inode(mp, dqp->dq_flags);
+	uint			qtype = xfs_dquot_type(dqp);
+	struct xfs_inode	*quotip = xfs_quota_inode(mp, qtype);
 	int			nmaps = 1;
 	int			error;
 
 	trace_xfs_dqalloc(dqp);
 
 	xfs_ilock(quotip, XFS_ILOCK_EXCL);
-	if (!xfs_this_quota_on(dqp->q_mount, dqp->dq_flags)) {
+	if (!xfs_this_quota_on(dqp->q_mount, qtype)) {
 		/*
 		 * Return if this type of quotas is turned off while we didn't
 		 * have an inode lock
@@ -317,8 +318,7 @@ xfs_dquot_disk_alloc(
 	 * Make a chunk of dquots out of this buffer and log
 	 * the entire thing.
 	 */
-	xfs_qm_init_dquot_blk(tp, mp, dqp->q_id,
-			      dqp->dq_flags & XFS_DQTYPE_REC_MASK, bp);
+	xfs_qm_init_dquot_blk(tp, mp, dqp->q_id, xfs_dquot_type(dqp), bp);
 	xfs_buf_set_ref(bp, XFS_DQUOT_REF);
 
 	/*
@@ -365,13 +365,14 @@ xfs_dquot_disk_read(
 {
 	struct xfs_bmbt_irec	map;
 	struct xfs_buf		*bp;
-	struct xfs_inode	*quotip = xfs_quota_inode(mp, dqp->dq_flags);
+	uint			qtype = xfs_dquot_type(dqp);
+	struct xfs_inode	*quotip = xfs_quota_inode(mp, qtype);
 	uint			lock_mode;
 	int			nmaps = 1;
 	int			error;
 
 	lock_mode = xfs_ilock_data_map_shared(quotip);
-	if (!xfs_this_quota_on(mp, dqp->dq_flags)) {
+	if (!xfs_this_quota_on(mp, qtype)) {
 		/*
 		 * Return if this type of quotas is turned off while we
 		 * didn't have the quota inode lock.
@@ -487,7 +488,7 @@ xfs_dquot_from_disk(
 	 * Ensure that we got the type and ID we were looking for.
 	 * Everything else was checked by the dquot buffer verifier.
 	 */
-	if ((ddqp->d_flags & XFS_DQTYPE_REC_MASK) != dqp->dq_flags ||
+	if ((ddqp->d_flags & XFS_DQTYPE_REC_MASK) != xfs_dquot_type(dqp) ||
 	    be32_to_cpu(ddqp->d_id) != dqp->q_id) {
 		xfs_alert_tag(bp->b_mount, XFS_PTAG_VERIFIER_ERROR,
 			  "Metadata corruption detected at %pS, quota %u",
diff --git a/fs/xfs/xfs_dquot.h b/fs/xfs/xfs_dquot.h
index 60bccb5f7435..07e18ce33560 100644
--- a/fs/xfs/xfs_dquot.h
+++ b/fs/xfs/xfs_dquot.h
@@ -167,7 +167,7 @@ static inline bool
 xfs_dquot_is_enforced(
 	const struct xfs_dquot	*dqp)
 {
-	switch (dqp->dq_flags & XFS_DQTYPE_REC_MASK) {
+	switch (xfs_dquot_type(dqp)) {
 	case XFS_DQTYPE_USER:
 		return XFS_IS_UQUOTA_ENFORCED(dqp->q_mount);
 	case XFS_DQTYPE_GROUP:


  parent reply	other threads:[~2020-07-16  6:46 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16  6:45 [PATCH v5 00/11] xfs: separate dquot type from flags Darrick J. Wong
2020-07-16  6:45 ` [PATCH 01/11] xfs: drop the type parameter from xfs_dquot_verify Darrick J. Wong
2020-07-16 23:32   ` Dave Chinner
2020-07-21 14:54   ` Christoph Hellwig
2020-07-16  6:45 ` [PATCH 02/11] xfs: rename XFS_DQ_{USER,GROUP,PROJ} to XFS_DQTYPE_* Darrick J. Wong
2020-07-16 23:36   ` Dave Chinner
2020-07-21 14:54   ` Christoph Hellwig
2020-07-16  6:45 ` [PATCH 03/11] xfs: refactor testing if a particular dquot is being enforced Darrick J. Wong
2020-07-16 23:47   ` Dave Chinner
2020-07-21 14:55   ` Christoph Hellwig
2020-07-16  6:45 ` [PATCH 04/11] xfs: remove the XFS_QM_IS[UGP]DQ macros Darrick J. Wong
2020-07-16 23:49   ` Dave Chinner
2020-07-21 14:55   ` Christoph Hellwig
2020-07-16  6:45 ` [PATCH 05/11] xfs: refactor quota type testing Darrick J. Wong
2020-07-16 23:51   ` Dave Chinner
2020-07-21 14:56   ` Christoph Hellwig
2020-07-16  6:45 ` Darrick J. Wong [this message]
2020-07-16 23:57   ` [PATCH 06/11] xfs: always use xfs_dquot_type when extracting type from a dquot Dave Chinner
2020-07-21 14:56   ` Christoph Hellwig
2020-07-16  6:46 ` [PATCH 07/11] xfs: remove unnecessary quota type masking Darrick J. Wong
2020-07-17  0:01   ` Dave Chinner
2020-07-21 14:57   ` Christoph Hellwig
2020-07-16  6:46 ` [PATCH 08/11] xfs: replace a few open-coded XFS_DQTYPE_REC_MASK uses Darrick J. Wong
2020-07-17  0:02   ` Dave Chinner
2020-07-17  1:07     ` Darrick J. Wong
2020-07-17  1:18       ` Dave Chinner
2020-07-21 14:57   ` Christoph Hellwig
2020-07-16  6:46 ` [PATCH 09/11] xfs: create xfs_dqtype_t to represent quota types Darrick J. Wong
2020-07-17  0:08   ` Dave Chinner
2020-07-21 14:58   ` Christoph Hellwig
2020-07-16  6:46 ` [PATCH 10/11] xfs: improve ondisk dquot flags checking Darrick J. Wong
2020-07-17  0:13   ` Dave Chinner
2020-07-17  1:05     ` Darrick J. Wong
2020-07-17  1:11       ` Dave Chinner
2020-07-17  1:12   ` [PATCH v2 " Darrick J. Wong
2020-07-17  1:18     ` Dave Chinner
2020-07-21 14:58     ` Christoph Hellwig
2020-07-16  6:46 ` [PATCH 11/11] xfs: rename the ondisk dquot d_flags to d_type Darrick J. Wong
2020-07-17  0:15   ` Dave Chinner
2020-07-21 14:59   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=159488195772.3813063.4337415651120546350.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.