xfs: always use xfs_dquot_type when extracting type from a dquot
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 struct xfs_dquot. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
@ -273,14 +273,15 @@ xfs_dquot_disk_alloc(
|
|||||||
struct xfs_trans *tp = *tpp;
|
struct xfs_trans *tp = *tpp;
|
||||||
struct xfs_mount *mp = tp->t_mountp;
|
struct xfs_mount *mp = tp->t_mountp;
|
||||||
struct xfs_buf *bp;
|
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 nmaps = 1;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
trace_xfs_dqalloc(dqp);
|
trace_xfs_dqalloc(dqp);
|
||||||
|
|
||||||
xfs_ilock(quotip, XFS_ILOCK_EXCL);
|
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
|
* Return if this type of quotas is turned off while we didn't
|
||||||
* have an inode lock
|
* have an inode lock
|
||||||
@ -317,8 +318,7 @@ xfs_dquot_disk_alloc(
|
|||||||
* Make a chunk of dquots out of this buffer and log
|
* Make a chunk of dquots out of this buffer and log
|
||||||
* the entire thing.
|
* the entire thing.
|
||||||
*/
|
*/
|
||||||
xfs_qm_init_dquot_blk(tp, mp, dqp->q_id,
|
xfs_qm_init_dquot_blk(tp, mp, dqp->q_id, qtype, bp);
|
||||||
dqp->dq_flags & XFS_DQTYPE_REC_MASK, bp);
|
|
||||||
xfs_buf_set_ref(bp, XFS_DQUOT_REF);
|
xfs_buf_set_ref(bp, XFS_DQUOT_REF);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -365,13 +365,14 @@ xfs_dquot_disk_read(
|
|||||||
{
|
{
|
||||||
struct xfs_bmbt_irec map;
|
struct xfs_bmbt_irec map;
|
||||||
struct xfs_buf *bp;
|
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;
|
uint lock_mode;
|
||||||
int nmaps = 1;
|
int nmaps = 1;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
lock_mode = xfs_ilock_data_map_shared(quotip);
|
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
|
* Return if this type of quotas is turned off while we
|
||||||
* didn't have the quota inode lock.
|
* 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.
|
* Ensure that we got the type and ID we were looking for.
|
||||||
* Everything else was checked by the dquot buffer verifier.
|
* 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) {
|
be32_to_cpu(ddqp->d_id) != dqp->q_id) {
|
||||||
xfs_alert_tag(bp->b_mount, XFS_PTAG_VERIFIER_ERROR,
|
xfs_alert_tag(bp->b_mount, XFS_PTAG_VERIFIER_ERROR,
|
||||||
"Metadata corruption detected at %pS, quota %u",
|
"Metadata corruption detected at %pS, quota %u",
|
||||||
|
@ -167,7 +167,7 @@ static inline bool
|
|||||||
xfs_dquot_is_enforced(
|
xfs_dquot_is_enforced(
|
||||||
const struct xfs_dquot *dqp)
|
const struct xfs_dquot *dqp)
|
||||||
{
|
{
|
||||||
switch (dqp->dq_flags & XFS_DQTYPE_REC_MASK) {
|
switch (xfs_dquot_type(dqp)) {
|
||||||
case XFS_DQTYPE_USER:
|
case XFS_DQTYPE_USER:
|
||||||
return XFS_IS_UQUOTA_ENFORCED(dqp->q_mount);
|
return XFS_IS_UQUOTA_ENFORCED(dqp->q_mount);
|
||||||
case XFS_DQTYPE_GROUP:
|
case XFS_DQTYPE_GROUP:
|
||||||
|
Reference in New Issue
Block a user