From: Chandra Seetharaman <sekharan@us.ibm.com>
To: xfs@oss.sgi.com
Cc: Chandra Seetharaman <sekharan@us.ibm.com>
Subject: [RFC PATCH 1/4] Define a new function xfs_this_quota_on()
Date: Thu, 27 Oct 2011 17:05:29 -0500 [thread overview]
Message-ID: <20111027220529.2638.41757.sendpatchset@chandra-lucid.austin.ibm.com> (raw)
In-Reply-To: <20111027220523.2638.12351.sendpatchset@chandra-lucid.austin.ibm.com>
Create a new function xfs_this_quota_on() that takes a xfs_mount
data srtucture 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>
---
fs/xfs/xfs_dquot.c | 4 ++--
fs/xfs/xfs_dquot.h | 17 +++++++++++++----
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 25d7280..815e231 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -372,7 +372,7 @@ xfs_qm_dqalloc(
* Return if this type of quotas is turned off while we didn't
* have an inode lock
*/
- if (XFS_IS_THIS_QUOTA_OFF(dqp)) {
+ if (!xfs_this_quota_on(dqp->q_mount, dqp->dq_flags)) {
xfs_iunlock(quotip, XFS_ILOCK_EXCL);
return (ESRCH);
}
@@ -474,7 +474,7 @@ xfs_qm_dqtobp(
dqp->q_fileoffset = (xfs_fileoff_t)id / mp->m_quotainfo->qi_dqperchunk;
xfs_ilock(quotip, XFS_ILOCK_SHARED);
- if (XFS_IS_THIS_QUOTA_OFF(dqp)) {
+ if (!xfs_this_quota_on(dqp->q_mount, dqp->dq_flags)) {
/*
* Return if this type of quotas is turned off while we
* didn't have the quota inode lock.
diff --git a/fs/xfs/xfs_dquot.h b/fs/xfs/xfs_dquot.h
index 34b7e94..ef7a312 100644
--- a/fs/xfs/xfs_dquot.h
+++ b/fs/xfs/xfs_dquot.h
@@ -102,6 +102,19 @@ static inline void xfs_dqfunlock(xfs_dquot_t *dqp)
complete(&dqp->q_flush);
}
+static inline int xfs_this_quota_on(struct xfs_mount *mp, int type)
+{
+ type &= XFS_DQ_ALLTYPES;
+ switch(type) {
+ case XFS_DQ_USER:
+ return XFS_IS_UQUOTA_ON(mp);
+ case XFS_DQ_GROUP:
+ case XFS_DQ_PROJ:
+ default:
+ return XFS_IS_OQUOTA_ON(mp);
+ }
+}
+
#define XFS_DQ_IS_LOCKED(dqp) (mutex_is_locked(&((dqp)->q_qlock)))
#define XFS_DQ_IS_DIRTY(dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY)
#define XFS_QM_ISUDQ(dqp) ((dqp)->dq_flags & XFS_DQ_USER)
@@ -112,10 +125,6 @@ static inline void xfs_dqfunlock(xfs_dquot_t *dqp)
XFS_DQ_TO_QINF(dqp)->qi_uquotaip : \
XFS_DQ_TO_QINF(dqp)->qi_gquotaip)
-#define XFS_IS_THIS_QUOTA_OFF(d) (! (XFS_QM_ISUDQ(d) ? \
- (XFS_IS_UQUOTA_ON((d)->q_mount)) : \
- (XFS_IS_OQUOTA_ON((d)->q_mount))))
-
extern void xfs_qm_dqdestroy(xfs_dquot_t *);
extern int xfs_qm_dqflush(xfs_dquot_t *, uint);
extern int xfs_qm_dqpurge(xfs_dquot_t *);
--
1.7.1
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-10-27 22:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-27 22:05 [RFC PATCH 0/4] Rearrange code to make the code more readable Chandra Seetharaman
2011-10-27 22:05 ` Chandra Seetharaman [this message]
2011-10-27 22:24 ` [RFC PATCH 1/4] Define a new function xfs_this_quota_on() Christoph Hellwig
2011-11-11 20:29 ` Alex Elder
2011-10-27 22:05 ` [RFC PATCH 2/4] Define a new function xfs_inode_dquot() Chandra Seetharaman
2011-11-11 20:29 ` Alex Elder
2011-10-27 22:05 ` [RFC PATCH 3/4] Change xfs_sb_from_disk() interface to take a mount pointer Chandra Seetharaman
2011-11-11 20:29 ` Alex Elder
2011-10-27 22:05 ` [RFC PATCH 4/4] Define new macro XFS_ALL_QUOTA_ACTIVE and simply some usage Chandra Seetharaman
2011-11-07 20:05 ` [RFC PATCH 0/4] Rearrange code to make the code more readable Ben Myers
-- strict thread matches above, loose matches on Subject: below --
2012-01-23 17:31 Chandra Seetharaman
2012-01-23 17:31 ` [RFC PATCH 1/4] Define a new function xfs_this_quota_on() Chandra Seetharaman
2012-01-24 17:47 ` Christoph Hellwig
2012-02-03 15:19 ` Ben Myers
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=20111027220529.2638.41757.sendpatchset@chandra-lucid.austin.ibm.com \
--to=sekharan@us.ibm.com \
--cc=xfs@oss.sgi.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox