Commit 8a7b8a89 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Alex Elder
Browse files

xfs: access quotainfo structure directly



Access fields in m_quotainfo directly instead of hiding them behind the
XFS_QI_* macros.  Add local variables for the quotainfo pointer in places
where we have lots of them.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <david@fromorbit.com>
parent 37bc5743
......@@ -252,7 +252,7 @@ xfs_qm_adjust_dqtimers(
(be64_to_cpu(d->d_bcount) >=
be64_to_cpu(d->d_blk_hardlimit)))) {
d->d_btimer = cpu_to_be32(get_seconds() +
XFS_QI_BTIMELIMIT(mp));
mp->m_quotainfo->qi_btimelimit);
} else {
d->d_bwarns = 0;
}
......@@ -275,7 +275,7 @@ xfs_qm_adjust_dqtimers(
(be64_to_cpu(d->d_icount) >=
be64_to_cpu(d->d_ino_hardlimit)))) {
d->d_itimer = cpu_to_be32(get_seconds() +
XFS_QI_ITIMELIMIT(mp));
mp->m_quotainfo->qi_itimelimit);
} else {
d->d_iwarns = 0;
}
......@@ -298,7 +298,7 @@ xfs_qm_adjust_dqtimers(
(be64_to_cpu(d->d_rtbcount) >=
be64_to_cpu(d->d_rtb_hardlimit)))) {
d->d_rtbtimer = cpu_to_be32(get_seconds() +
XFS_QI_RTBTIMELIMIT(mp));
mp->m_quotainfo->qi_rtbtimelimit);
} else {
d->d_rtbwarns = 0;
}
......@@ -325,6 +325,7 @@ xfs_qm_init_dquot_blk(
uint type,
xfs_buf_t *bp)
{
struct xfs_quotainfo *q = mp->m_quotainfo;
xfs_dqblk_t *d;
int curid, i;
......@@ -337,16 +338,16 @@ xfs_qm_init_dquot_blk(
/*
* ID of the first dquot in the block - id's are zero based.
*/
curid = id - (id % XFS_QM_DQPERBLK(mp));
curid = id - (id % q->qi_dqperchunk);
ASSERT(curid >= 0);
memset(d, 0, BBTOB(XFS_QI_DQCHUNKLEN(mp)));
for (i = 0; i < XFS_QM_DQPERBLK(mp); i++, d++, curid++)
memset(d, 0, BBTOB(q->qi_dqchunklen));
for (i = 0; i < q->qi_dqperchunk; i++, d++, curid++)
xfs_qm_dqinit_core(curid, type, d);
xfs_trans_dquot_buf(tp, bp,
(type & XFS_DQ_USER ? XFS_BLI_UDQUOT_BUF :
((type & XFS_DQ_PROJ) ? XFS_BLI_PDQUOT_BUF :
XFS_BLI_GDQUOT_BUF)));
xfs_trans_log_buf(tp, bp, 0, BBTOB(XFS_QI_DQCHUNKLEN(mp)) - 1);
xfs_trans_log_buf(tp, bp, 0, BBTOB(q->qi_dqchunklen) - 1);
}
......@@ -419,7 +420,7 @@ xfs_qm_dqalloc(
/* now we can just get the buffer (there's nothing to read yet) */
bp = xfs_trans_get_buf(tp, mp->m_ddev_targp,
dqp->q_blkno,
XFS_QI_DQCHUNKLEN(mp),
mp->m_quotainfo->qi_dqchunklen,
0);
if (!bp || (error = XFS_BUF_GETERROR(bp)))
goto error1;
......@@ -500,7 +501,8 @@ xfs_qm_dqtobp(
*/
if (dqp->q_blkno == (xfs_daddr_t) 0) {
/* We use the id as an index */
dqp->q_fileoffset = (xfs_fileoff_t)id / XFS_QM_DQPERBLK(mp);
dqp->q_fileoffset = (xfs_fileoff_t)id /
mp->m_quotainfo->qi_dqperchunk;
nmaps = 1;
quotip = XFS_DQ_TO_QIP(dqp);
xfs_ilock(quotip, XFS_ILOCK_SHARED);
......@@ -529,7 +531,7 @@ xfs_qm_dqtobp(
/*
* offset of dquot in the (fixed sized) dquot chunk.
*/
dqp->q_bufoffset = (id % XFS_QM_DQPERBLK(mp)) *
dqp->q_bufoffset = (id % mp->m_quotainfo->qi_dqperchunk) *
sizeof(xfs_dqblk_t);
if (map.br_startblock == HOLESTARTBLOCK) {
/*
......@@ -559,15 +561,13 @@ xfs_qm_dqtobp(
* Read in the buffer, unless we've just done the allocation
* (in which case we already have the buf).
*/
if (! newdquot) {
if (!newdquot) {
trace_xfs_dqtobp_read(dqp);
if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
dqp->q_blkno,
XFS_QI_DQCHUNKLEN(mp),
0, &bp))) {
return (error);
}
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
dqp->q_blkno,
mp->m_quotainfo->qi_dqchunklen,
0, &bp);
if (error || !bp)
return XFS_ERROR(error);
}
......@@ -689,14 +689,14 @@ xfs_qm_idtodq(
tp = NULL;
if (flags & XFS_QMOPT_DQALLOC) {
tp = xfs_trans_alloc(mp, XFS_TRANS_QM_DQALLOC);
if ((error = xfs_trans_reserve(tp,
XFS_QM_DQALLOC_SPACE_RES(mp),
XFS_WRITE_LOG_RES(mp) +
BBTOB(XFS_QI_DQCHUNKLEN(mp)) - 1 +
128,
0,
XFS_TRANS_PERM_LOG_RES,
XFS_WRITE_LOG_COUNT))) {
error = xfs_trans_reserve(tp, XFS_QM_DQALLOC_SPACE_RES(mp),
XFS_WRITE_LOG_RES(mp) +
BBTOB(mp->m_quotainfo->qi_dqchunklen) - 1 +
128,
0,
XFS_TRANS_PERM_LOG_RES,
XFS_WRITE_LOG_COUNT);
if (error) {
cancelflags = 0;
goto error0;
}
......@@ -1495,6 +1495,7 @@ void
xfs_qm_dqflock_pushbuf_wait(
xfs_dquot_t *dqp)
{
xfs_mount_t *mp = dqp->q_mount;
xfs_buf_t *bp;
/*
......@@ -1503,14 +1504,14 @@ xfs_qm_dqflock_pushbuf_wait(
* out immediately. We'll be able to acquire
* the flush lock when the I/O completes.
*/
bp = xfs_incore(dqp->q_mount->m_ddev_targp, dqp->q_blkno,
XFS_QI_DQCHUNKLEN(dqp->q_mount), XBF_TRYLOCK);
bp = xfs_incore(mp->m_ddev_targp, dqp->q_blkno,
mp->m_quotainfo->qi_dqchunklen, XBF_TRYLOCK);
if (!bp)
goto out_lock;
if (XFS_BUF_ISDELAYWRITE(bp)) {
if (XFS_BUF_ISPINNED(bp))
xfs_log_force(dqp->q_mount, 0);
xfs_log_force(mp, 0);
xfs_buf_delwri_promote(bp);
wake_up_process(bp->b_target->bt_task);
}
......
......@@ -227,7 +227,7 @@ xfs_qm_dquot_logitem_pushbuf(
}
mp = dqp->q_mount;
bp = xfs_incore(mp->m_ddev_targp, qip->qli_format.qlf_blkno,
XFS_QI_DQCHUNKLEN(mp), XBF_TRYLOCK);
mp->m_quotainfo->qi_dqchunklen, XBF_TRYLOCK);
xfs_dqunlock(dqp);
if (!bp)
return;
......
......@@ -465,20 +465,21 @@ xfs_qm_unmount_quotas(
*/
STATIC int
xfs_qm_dqflush_all(
xfs_mount_t *mp,
int sync_mode)
struct xfs_mount *mp,
int sync_mode)
{
int recl;
xfs_dquot_t *dqp;
int niters;
int error;
struct xfs_quotainfo *q = mp->m_quotainfo;
int recl;
struct xfs_dquot *dqp;
int niters;
int error;
if (mp->m_quotainfo == NULL)
if (!q)
return 0;
niters = 0;
again:
mutex_lock(&mp->m_quotainfo->qi_dqlist_lock);
list_for_each_entry(dqp, &mp->m_quotainfo->qi_dqlist, q_mplist) {
mutex_lock(&q->qi_dqlist_lock);
list_for_each_entry(dqp, &q->qi_dqlist, q_mplist) {
xfs_dqlock(dqp);
if (! XFS_DQ_IS_DIRTY(dqp)) {
xfs_dqunlock(dqp);
......@@ -486,7 +487,7 @@ again:
}
/* XXX a sentinel would be better */
recl = mp->m_quotainfo->qi_dqreclaims;
recl = q->qi_dqreclaims;
if (!xfs_dqflock_nowait(dqp)) {
/*
* If we can't grab the flush lock then check
......@@ -501,21 +502,21 @@ again:
* Let go of the mplist lock. We don't want to hold it
* across a disk write.
*/
mutex_unlock(&mp->m_quotainfo->qi_dqlist_lock);
mutex_unlock(&q->qi_dqlist_lock);
error = xfs_qm_dqflush(dqp, sync_mode);
xfs_dqunlock(dqp);
if (error)
return error;
mutex_lock(&mp->m_quotainfo->qi_dqlist_lock);
if (recl != mp->m_quotainfo->qi_dqreclaims) {
mutex_unlock(&mp->m_quotainfo->qi_dqlist_lock);
mutex_lock(&q->qi_dqlist_lock);
if (recl != q->qi_dqreclaims) {
mutex_unlock(&q->qi_dqlist_lock);
/* XXX restart limit */
goto again;
}
}
mutex_unlock(&mp->m_quotainfo->qi_dqlist_lock);
mutex_unlock(&q->qi_dqlist_lock);
/* return ! busy */
return 0;
}
......@@ -525,14 +526,15 @@ again:
*/
STATIC void
xfs_qm_detach_gdquots(
xfs_mount_t *mp)
struct xfs_mount *mp)
{
xfs_dquot_t *dqp, *gdqp;
int nrecl;
struct xfs_quotainfo *q = mp->m_quotainfo;
struct xfs_dquot *dqp, *gdqp;
int nrecl;
again:
ASSERT(mutex_is_locked(&mp->m_quotainfo->qi_dqlist_lock));
list_for_each_entry(dqp, &mp->m_quotainfo->qi_dqlist, q_mplist) {
ASSERT(mutex_is_locked(&q->qi_dqlist_lock));
list_for_each_entry(dqp, &q->qi_dqlist, q_mplist) {
xfs_dqlock(dqp);
if ((gdqp = dqp->q_gdquot)) {
xfs_dqlock(gdqp);
......@@ -545,12 +547,12 @@ xfs_qm_detach_gdquots(
* Can't hold the mplist lock across a dqput.
* XXXmust convert to marker based iterations here.
*/
nrecl = mp->m_quotainfo->qi_dqreclaims;
mutex_unlock(&mp->m_quotainfo->qi_dqlist_lock);
nrecl = q->qi_dqreclaims;
mutex_unlock(&q->qi_dqlist_lock);
xfs_qm_dqput(gdqp);
mutex_lock(&mp->m_quotainfo->qi_dqlist_lock);
if (nrecl != mp->m_quotainfo->qi_dqreclaims)
mutex_lock(&q->qi_dqlist_lock);
if (nrecl != q->qi_dqreclaims)
goto again;
}
}
......@@ -564,22 +566,23 @@ xfs_qm_detach_gdquots(
*/
STATIC int
xfs_qm_dqpurge_int(
xfs_mount_t *mp,
uint flags) /* QUOTAOFF/UMOUNTING/UQUOTA/PQUOTA/GQUOTA */
struct xfs_mount *mp,
uint flags)
{
xfs_dquot_t *dqp, *n;
uint dqtype;
int nrecl;
int nmisses;
struct xfs_quotainfo *q = mp->m_quotainfo;
struct xfs_dquot *dqp, *n;
uint dqtype;
int nrecl;
int nmisses;
if (mp->m_quotainfo == NULL)
if (!q)
return 0;
dqtype = (flags & XFS_QMOPT_UQUOTA) ? XFS_DQ_USER : 0;
dqtype |= (flags & XFS_QMOPT_PQUOTA) ? XFS_DQ_PROJ : 0;
dqtype |= (flags & XFS_QMOPT_GQUOTA) ? XFS_DQ_GROUP : 0;
mutex_lock(&mp->m_quotainfo->qi_dqlist_lock);
mutex_lock(&q->qi_dqlist_lock);
/*
* In the first pass through all incore dquots of this filesystem,
......@@ -591,12 +594,12 @@ xfs_qm_dqpurge_int(
again:
nmisses = 0;
ASSERT(mutex_is_locked(&mp->m_quotainfo->qi_dqlist_lock));
ASSERT(mutex_is_locked(&q->qi_dqlist_lock));
/*
* Try to get rid of all of the unwanted dquots. The idea is to
* get them off mplist and hashlist, but leave them on freelist.
*/
list_for_each_entry_safe(dqp, n, &mp->m_quotainfo->qi_dqlist, q_mplist) {
list_for_each_entry_safe(dqp, n, &q->qi_dqlist, q_mplist) {
/*
* It's OK to look at the type without taking dqlock here.
* We're holding the mplist lock here, and that's needed for
......@@ -606,10 +609,10 @@ xfs_qm_dqpurge_int(
continue;
if (!mutex_trylock(&dqp->q_hash->qh_lock)) {
nrecl = mp->m_quotainfo->qi_dqreclaims;
mutex_unlock(&mp->m_quotainfo->qi_dqlist_lock);
nrecl = q->qi_dqreclaims;
mutex_unlock(&q->qi_dqlist_lock);
mutex_lock(&dqp->q_hash->qh_lock);
mutex_lock(&mp->m_quotainfo->qi_dqlist_lock);
mutex_lock(&q->qi_dqlist_lock);
/*
* XXXTheoretically, we can get into a very long
......@@ -617,7 +620,7 @@ xfs_qm_dqpurge_int(
* No one can be adding dquots to the mplist at
* this point, but somebody might be taking things off.
*/
if (nrecl != mp->m_quotainfo->qi_dqreclaims) {
if (nrecl != q->qi_dqreclaims) {
mutex_unlock(&dqp->q_hash->qh_lock);
goto again;
}
......@@ -629,7 +632,7 @@ xfs_qm_dqpurge_int(
*/
nmisses += xfs_qm_dqpurge(dqp);
}
mutex_unlock(&mp->m_quotainfo->qi_dqlist_lock);
mutex_unlock(&q->qi_dqlist_lock);
return nmisses;
}
......@@ -929,12 +932,13 @@ xfs_qm_dqdetach(
int
xfs_qm_sync(
xfs_mount_t *mp,
int flags)
struct xfs_mount *mp,
int flags)
{
int recl, restarts;
xfs_dquot_t *dqp;
int error;
struct xfs_quotainfo *q = mp->m_quotainfo;
int recl, restarts;
struct xfs_dquot *dqp;
int error;
if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp))
return 0;
......@@ -942,7 +946,7 @@ xfs_qm_sync(
restarts = 0;
again:
mutex_lock(&mp->m_quotainfo->qi_dqlist_lock);
mutex_lock(&q->qi_dqlist_lock);
/*
* dqpurge_all() also takes the mplist lock and iterate thru all dquots
* in quotaoff. However, if the QUOTA_ACTIVE bits are not cleared
......@@ -950,11 +954,11 @@ xfs_qm_sync(
* as long as we have it locked.
*/
if (!XFS_IS_QUOTA_ON(mp)) {
mutex_unlock(&mp->m_quotainfo->qi_dqlist_lock);
mutex_unlock(&q->qi_dqlist_lock);
return 0;
}
ASSERT(mutex_is_locked(&mp->m_quotainfo->qi_dqlist_lock));
list_for_each_entry(dqp, &mp->m_quotainfo->qi_dqlist, q_mplist) {
ASSERT(mutex_is_locked(&q->qi_dqlist_lock));
list_for_each_entry(dqp, &q->qi_dqlist, q_mplist) {
/*
* If this is vfs_sync calling, then skip the dquots that
* don't 'seem' to be dirty. ie. don't acquire dqlock.
......@@ -978,7 +982,7 @@ xfs_qm_sync(
}
/* XXX a sentinel would be better */
recl = mp->m_quotainfo->qi_dqreclaims;
recl = q->qi_dqreclaims;
if (!xfs_dqflock_nowait(dqp)) {
if (flags & SYNC_TRYLOCK) {
xfs_dqunlock(dqp);
......@@ -998,7 +1002,7 @@ xfs_qm_sync(
* Let go of the mplist lock. We don't want to hold it
* across a disk write
*/
mutex_unlock(&mp->m_quotainfo->qi_dqlist_lock);
mutex_unlock(&q->qi_dqlist_lock);
error = xfs_qm_dqflush(dqp, flags);
xfs_dqunlock(dqp);
if (error && XFS_FORCED_SHUTDOWN(mp))
......@@ -1006,17 +1010,17 @@ xfs_qm_sync(
else if (error)
return error;
mutex_lock(&mp->m_quotainfo->qi_dqlist_lock);
if (recl != mp->m_quotainfo->qi_dqreclaims) {
mutex_lock(&q->qi_dqlist_lock);
if (recl != q->qi_dqreclaims) {
if (++restarts >= XFS_QM_SYNC_MAX_RESTARTS)
break;
mutex_unlock(&mp->m_quotainfo->qi_dqlist_lock);
mutex_unlock(&q->qi_dqlist_lock);
goto again;
}
}
mutex_unlock(&mp->m_quotainfo->qi_dqlist_lock);
mutex_unlock(&q->qi_dqlist_lock);
return 0;
}
......@@ -1382,10 +1386,10 @@ xfs_qm_reset_dqcounts(
#ifdef DEBUG
j = XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
do_div(j, sizeof(xfs_dqblk_t));
ASSERT(XFS_QM_DQPERBLK(mp) == j);
ASSERT(mp->m_quotainfo->qi_dqperchunk == j);
#endif
ddq = (xfs_disk_dquot_t *)XFS_BUF_PTR(bp);
for (j = 0; j < XFS_QM_DQPERBLK(mp); j++) {
for (j = 0; j < mp->m_quotainfo->qi_dqperchunk; j++) {
/*
* Do a sanity check, and if needed, repair the dqblk. Don't
* output any warnings because it's perfectly possible to
......@@ -1440,7 +1444,7 @@ xfs_qm_dqiter_bufs(
while (blkcnt--) {
error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp,
XFS_FSB_TO_DADDR(mp, bno),
(int)XFS_QI_DQCHUNKLEN(mp), 0, &bp);
mp->m_quotainfo->qi_dqchunklen, 0, &bp);
if (error)
break;
......@@ -1450,7 +1454,7 @@ xfs_qm_dqiter_bufs(
* goto the next block.
*/
bno++;
firstid += XFS_QM_DQPERBLK(mp);
firstid += mp->m_quotainfo->qi_dqperchunk;
}
return error;
}
......@@ -1516,7 +1520,7 @@ xfs_qm_dqiterate(
continue;
firstid = (xfs_dqid_t) map[i].br_startoff *
XFS_QM_DQPERBLK(mp);
mp->m_quotainfo->qi_dqperchunk;
/*
* Do a read-ahead on the next extent.
*/
......@@ -1527,7 +1531,7 @@ xfs_qm_dqiterate(
while (rablkcnt--) {
xfs_baread(mp->m_ddev_targp,
XFS_FSB_TO_DADDR(mp, rablkno),
(int)XFS_QI_DQCHUNKLEN(mp));
mp->m_quotainfo->qi_dqchunklen);
rablkno++;
}
}
......@@ -1758,7 +1762,7 @@ xfs_qm_quotacheck(
lastino = 0;
flags = 0;
ASSERT(XFS_QI_UQIP(mp) || XFS_QI_GQIP(mp));
ASSERT(mp->m_quotainfo->qi_uquotaip || mp->m_quotainfo->qi_gquotaip);
ASSERT(XFS_IS_QUOTA_RUNNING(mp));
/*
......@@ -1774,15 +1778,19 @@ xfs_qm_quotacheck(
* their counters to zero. We need a clean slate.
* We don't log our changes till later.
*/
if ((uip = XFS_QI_UQIP(mp))) {
if ((error = xfs_qm_dqiterate(mp, uip, XFS_QMOPT_UQUOTA)))
uip = mp->m_quotainfo->qi_uquotaip;
if (uip) {
error = xfs_qm_dqiterate(mp, uip, XFS_QMOPT_UQUOTA);
if (error)
goto error_return;
flags |= XFS_UQUOTA_CHKD;
}
if ((gip = XFS_QI_GQIP(mp))) {
if ((error = xfs_qm_dqiterate(mp, gip, XFS_IS_GQUOTA_ON(mp) ?
XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA)))
gip = mp->m_quotainfo->qi_gquotaip;
if (gip) {
error = xfs_qm_dqiterate(mp, gip, XFS_IS_GQUOTA_ON(mp) ?
XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA);
if (error)
goto error_return;
flags |= XFS_OQUOTA_CHKD;
}
......@@ -1931,8 +1939,8 @@ xfs_qm_init_quotainos(
}
}
XFS_QI_UQIP(mp) = uip;
XFS_QI_GQIP(mp) = gip;
mp->m_quotainfo->qi_uquotaip = uip;
mp->m_quotainfo->qi_gquotaip = gip;
return 0;
}
......
......@@ -79,6 +79,7 @@ xfs_qm_scall_quotaoff(
xfs_mount_t *mp,
uint flags)
{
struct xfs_quotainfo *q = mp->m_quotainfo;
uint dqtype;
int error;
uint inactivate_flags;
......@@ -102,11 +103,8 @@ xfs_qm_scall_quotaoff(
* critical thing.
* If quotaoff, then we must be dealing with the root filesystem.
*/
ASSERT(mp->m_quotainfo);
if (mp->m_quotainfo)
mutex_lock(&(XFS_QI_QOFFLOCK(mp)));
ASSERT(mp->m_quotainfo);
ASSERT(q);
mutex_lock(&q->qi_quotaofflock);
/*
* If we're just turning off quota enforcement, change mp and go.
......@@ -117,7 +115,7 @@ xfs_qm_scall_quotaoff(
spin_lock(&mp->m_sb_lock);
mp->m_sb.sb_qflags = mp->m_qflags;
spin_unlock(&mp->m_sb_lock);
mutex_unlock(&(XFS_QI_QOFFLOCK(mp)));
mutex_unlock(&q->qi_quotaofflock);
/* XXX what to do if error ? Revert back to old vals incore ? */
error = xfs_qm_write_sb_changes(mp, XFS_SB_QFLAGS);
......@@ -150,10 +148,8 @@ xfs_qm_scall_quotaoff(
* Nothing to do? Don't complain. This happens when we're just
* turning off quota enforcement.
*/
if ((mp->m_qflags & flags) == 0) {
mutex_unlock(&(XFS_QI_QOFFLOCK(mp)));
return (0);
}
if ((mp->m_qflags & flags) == 0)
goto out_unlock;
/*
* Write the LI_QUOTAOFF log record, and do SB changes atomically,
......@@ -162,7 +158,7 @@ xfs_qm_scall_quotaoff(
*/
error = xfs_qm_log_quotaoff(mp, &qoffstart, flags);
if (error)
goto out_error;
goto out_unlock;
/*
* Next we clear the XFS_MOUNT_*DQ_ACTIVE bit(s) in the mount struct
......@@ -222,7 +218,7 @@ xfs_qm_scall_quotaoff(
if (error) {
/* We're screwed now. Shutdown is the only option. */
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
goto out_error;
goto out_unlock;
}
/*
......@@ -230,27 +226,26 @@ xfs_qm_scall_quotaoff(
*/
if (((flags & XFS_MOUNT_QUOTA_ALL) == XFS_MOUNT_QUOTA_SET1) ||
((flags & XFS_MOUNT_QUOTA_ALL) == XFS_MOUNT_QUOTA_SET2)) {
mutex_unlock(&(XFS_QI_QOFFLOCK(mp)));
mutex_unlock(&q->qi_quotaofflock);
xfs_qm_destroy_quotainfo(mp);
return (0);
}
/*
* Release our quotainode references, and vn_purge them,
* if we don't need them anymore.
* Release our quotainode references if we don't need them anymore.
*/
if ((dqtype & XFS_QMOPT_UQUOTA) && XFS_QI_UQIP(mp)) {
IRELE(XFS_QI_UQIP(mp));
XFS_QI_UQIP(mp) = NULL;
if ((dqtype & XFS_QMOPT_UQUOTA) && q->qi_uquotaip) {
IRELE(q->qi_uquotaip);
q->qi_uquotaip = NULL;
}
if ((dqtype & (XFS_QMOPT_GQUOTA|XFS_QMOPT_PQUOTA)) && XFS_QI_GQIP(mp)) {
IRELE(XFS_QI_GQIP(mp));
XFS_QI_GQIP(mp) = NULL;
if ((dqtype & (XFS_QMOPT_GQUOTA|XFS_QMOPT_PQUOTA)) && q->qi_gquotaip) {
IRELE(q->qi_gquotaip);
q->qi_gquotaip = NULL;
}
out_error:
mutex_unlock(&(XFS_QI_QOFFLOCK(mp)));
return (error);
out_unlock:
mutex_unlock(&q->qi_quotaofflock);
return error;
}
int
......@@ -379,9 +374,9 @@ xfs_qm_scall_quotaon(
/*
* Switch on quota enforcement in core.
*/
mutex_lock(&(XFS_QI_QOFFLOCK(mp)));
mutex_lock(&mp->m_quotainfo->qi_quotaofflock);
mp->m_qflags |= (flags & XFS_ALL_QUOTA_ENFD);
mutex_unlock(&(XFS_QI_QOFFLOCK(mp)));
mutex_unlock(&mp->m_quotainfo->qi_quotaofflock);