aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/quota
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/quota')
-rw-r--r--fs/xfs/quota/xfs_dquot.c12
-rw-r--r--fs/xfs/quota/xfs_dquot.h5
-rw-r--r--fs/xfs/quota/xfs_dquot_item.c27
-rw-r--r--fs/xfs/quota/xfs_qm.c20
-rw-r--r--fs/xfs/quota/xfs_qm.h6
-rw-r--r--fs/xfs/quota/xfs_qm_syscalls.c19
-rw-r--r--fs/xfs/quota/xfs_trans_dquot.c6
7 files changed, 39 insertions, 56 deletions
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c
index cfdd35ee9f7a..665babcca6a6 100644
--- a/fs/xfs/quota/xfs_dquot.c
+++ b/fs/xfs/quota/xfs_dquot.c
@@ -1209,7 +1209,6 @@ xfs_qm_dqflush(
1209 xfs_buf_t *bp; 1209 xfs_buf_t *bp;
1210 xfs_disk_dquot_t *ddqp; 1210 xfs_disk_dquot_t *ddqp;
1211 int error; 1211 int error;
1212 SPLDECL(s);
1213 1212
1214 ASSERT(XFS_DQ_IS_LOCKED(dqp)); 1213 ASSERT(XFS_DQ_IS_LOCKED(dqp));
1215 ASSERT(XFS_DQ_IS_FLUSH_LOCKED(dqp)); 1214 ASSERT(XFS_DQ_IS_FLUSH_LOCKED(dqp));
@@ -1270,9 +1269,9 @@ xfs_qm_dqflush(
1270 mp = dqp->q_mount; 1269 mp = dqp->q_mount;
1271 1270
1272 /* lsn is 64 bits */ 1271 /* lsn is 64 bits */
1273 AIL_LOCK(mp, s); 1272 spin_lock(&mp->m_ail_lock);
1274 dqp->q_logitem.qli_flush_lsn = dqp->q_logitem.qli_item.li_lsn; 1273 dqp->q_logitem.qli_flush_lsn = dqp->q_logitem.qli_item.li_lsn;
1275 AIL_UNLOCK(mp, s); 1274 spin_unlock(&mp->m_ail_lock);
1276 1275
1277 /* 1276 /*
1278 * Attach an iodone routine so that we can remove this dquot from the 1277 * Attach an iodone routine so that we can remove this dquot from the
@@ -1318,7 +1317,6 @@ xfs_qm_dqflush_done(
1318 xfs_dq_logitem_t *qip) 1317 xfs_dq_logitem_t *qip)
1319{ 1318{
1320 xfs_dquot_t *dqp; 1319 xfs_dquot_t *dqp;
1321 SPLDECL(s);
1322 1320
1323 dqp = qip->qli_dquot; 1321 dqp = qip->qli_dquot;
1324 1322
@@ -1333,15 +1331,15 @@ xfs_qm_dqflush_done(
1333 if ((qip->qli_item.li_flags & XFS_LI_IN_AIL) && 1331 if ((qip->qli_item.li_flags & XFS_LI_IN_AIL) &&
1334 qip->qli_item.li_lsn == qip->qli_flush_lsn) { 1332 qip->qli_item.li_lsn == qip->qli_flush_lsn) {
1335 1333
1336 AIL_LOCK(dqp->q_mount, s); 1334 spin_lock(&dqp->q_mount->m_ail_lock);
1337 /* 1335 /*
1338 * xfs_trans_delete_ail() drops the AIL lock. 1336 * xfs_trans_delete_ail() drops the AIL lock.
1339 */ 1337 */
1340 if (qip->qli_item.li_lsn == qip->qli_flush_lsn) 1338 if (qip->qli_item.li_lsn == qip->qli_flush_lsn)
1341 xfs_trans_delete_ail(dqp->q_mount, 1339 xfs_trans_delete_ail(dqp->q_mount,
1342 (xfs_log_item_t*)qip, s); 1340 (xfs_log_item_t*)qip);
1343 else 1341 else
1344 AIL_UNLOCK(dqp->q_mount, s); 1342 spin_unlock(&dqp->q_mount->m_ail_lock);
1345 } 1343 }
1346 1344
1347 /* 1345 /*
diff --git a/fs/xfs/quota/xfs_dquot.h b/fs/xfs/quota/xfs_dquot.h
index 78d3ab95c5fd..5c371a92e3e2 100644
--- a/fs/xfs/quota/xfs_dquot.h
+++ b/fs/xfs/quota/xfs_dquot.h
@@ -123,11 +123,6 @@ XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp)
123 vsema(&((dqp)->q_flock)); \ 123 vsema(&((dqp)->q_flock)); \
124 (dqp)->dq_flags &= ~(XFS_DQ_FLOCKED); } 124 (dqp)->dq_flags &= ~(XFS_DQ_FLOCKED); }
125 125
126#define XFS_DQ_PINLOCK(dqp) mutex_spinlock( \
127 &(XFS_DQ_TO_QINF(dqp)->qi_pinlock))
128#define XFS_DQ_PINUNLOCK(dqp, s) mutex_spinunlock( \
129 &(XFS_DQ_TO_QINF(dqp)->qi_pinlock), s)
130
131#define XFS_DQ_IS_FLUSH_LOCKED(dqp) (issemalocked(&((dqp)->q_flock))) 126#define XFS_DQ_IS_FLUSH_LOCKED(dqp) (issemalocked(&((dqp)->q_flock)))
132#define XFS_DQ_IS_ON_FREELIST(dqp) ((dqp)->dq_flnext != (dqp)) 127#define XFS_DQ_IS_ON_FREELIST(dqp) ((dqp)->dq_flnext != (dqp))
133#define XFS_DQ_IS_DIRTY(dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY) 128#define XFS_DQ_IS_DIRTY(dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY)
diff --git a/fs/xfs/quota/xfs_dquot_item.c b/fs/xfs/quota/xfs_dquot_item.c
index ddb61fe22a5c..1800e8d1f646 100644
--- a/fs/xfs/quota/xfs_dquot_item.c
+++ b/fs/xfs/quota/xfs_dquot_item.c
@@ -94,14 +94,13 @@ STATIC void
94xfs_qm_dquot_logitem_pin( 94xfs_qm_dquot_logitem_pin(
95 xfs_dq_logitem_t *logitem) 95 xfs_dq_logitem_t *logitem)
96{ 96{
97 unsigned long s;
98 xfs_dquot_t *dqp; 97 xfs_dquot_t *dqp;
99 98
100 dqp = logitem->qli_dquot; 99 dqp = logitem->qli_dquot;
101 ASSERT(XFS_DQ_IS_LOCKED(dqp)); 100 ASSERT(XFS_DQ_IS_LOCKED(dqp));
102 s = XFS_DQ_PINLOCK(dqp); 101 spin_lock(&(XFS_DQ_TO_QINF(dqp)->qi_pinlock));
103 dqp->q_pincount++; 102 dqp->q_pincount++;
104 XFS_DQ_PINUNLOCK(dqp, s); 103 spin_unlock(&(XFS_DQ_TO_QINF(dqp)->qi_pinlock));
105} 104}
106 105
107/* 106/*
@@ -115,17 +114,16 @@ xfs_qm_dquot_logitem_unpin(
115 xfs_dq_logitem_t *logitem, 114 xfs_dq_logitem_t *logitem,
116 int stale) 115 int stale)
117{ 116{
118 unsigned long s;
119 xfs_dquot_t *dqp; 117 xfs_dquot_t *dqp;
120 118
121 dqp = logitem->qli_dquot; 119 dqp = logitem->qli_dquot;
122 ASSERT(dqp->q_pincount > 0); 120 ASSERT(dqp->q_pincount > 0);
123 s = XFS_DQ_PINLOCK(dqp); 121 spin_lock(&(XFS_DQ_TO_QINF(dqp)->qi_pinlock));
124 dqp->q_pincount--; 122 dqp->q_pincount--;
125 if (dqp->q_pincount == 0) { 123 if (dqp->q_pincount == 0) {
126 sv_broadcast(&dqp->q_pinwait); 124 sv_broadcast(&dqp->q_pinwait);
127 } 125 }
128 XFS_DQ_PINUNLOCK(dqp, s); 126 spin_unlock(&(XFS_DQ_TO_QINF(dqp)->qi_pinlock));
129} 127}
130 128
131/* ARGSUSED */ 129/* ARGSUSED */
@@ -189,8 +187,6 @@ void
189xfs_qm_dqunpin_wait( 187xfs_qm_dqunpin_wait(
190 xfs_dquot_t *dqp) 188 xfs_dquot_t *dqp)
191{ 189{
192 SPLDECL(s);
193
194 ASSERT(XFS_DQ_IS_LOCKED(dqp)); 190 ASSERT(XFS_DQ_IS_LOCKED(dqp));
195 if (dqp->q_pincount == 0) { 191 if (dqp->q_pincount == 0) {
196 return; 192 return;
@@ -200,9 +196,9 @@ xfs_qm_dqunpin_wait(
200 * Give the log a push so we don't wait here too long. 196 * Give the log a push so we don't wait here too long.
201 */ 197 */
202 xfs_log_force(dqp->q_mount, (xfs_lsn_t)0, XFS_LOG_FORCE); 198 xfs_log_force(dqp->q_mount, (xfs_lsn_t)0, XFS_LOG_FORCE);
203 s = XFS_DQ_PINLOCK(dqp); 199 spin_lock(&(XFS_DQ_TO_QINF(dqp)->qi_pinlock));
204 if (dqp->q_pincount == 0) { 200 if (dqp->q_pincount == 0) {
205 XFS_DQ_PINUNLOCK(dqp, s); 201 spin_unlock(&(XFS_DQ_TO_QINF(dqp)->qi_pinlock));
206 return; 202 return;
207 } 203 }
208 sv_wait(&(dqp->q_pinwait), PINOD, 204 sv_wait(&(dqp->q_pinwait), PINOD,
@@ -216,8 +212,8 @@ xfs_qm_dqunpin_wait(
216 * If so, we want to push it out to help us take this item off the AIL as soon 212 * If so, we want to push it out to help us take this item off the AIL as soon
217 * as possible. 213 * as possible.
218 * 214 *
219 * We must not be holding the AIL_LOCK at this point. Calling incore() to 215 * We must not be holding the AIL lock at this point. Calling incore() to
220 * search the buffer cache can be a time consuming thing, and AIL_LOCK is a 216 * search the buffer cache can be a time consuming thing, and AIL lock is a
221 * spinlock. 217 * spinlock.
222 */ 218 */
223STATIC void 219STATIC void
@@ -322,7 +318,7 @@ xfs_qm_dquot_logitem_trylock(
322 * want to do that now since we might sleep in the device 318 * want to do that now since we might sleep in the device
323 * strategy routine. We also don't want to grab the buffer lock 319 * strategy routine. We also don't want to grab the buffer lock
324 * here because we'd like not to call into the buffer cache 320 * here because we'd like not to call into the buffer cache
325 * while holding the AIL_LOCK. 321 * while holding the AIL lock.
326 * Make sure to only return PUSHBUF if we set pushbuf_flag 322 * Make sure to only return PUSHBUF if we set pushbuf_flag
327 * ourselves. If someone else is doing it then we don't 323 * ourselves. If someone else is doing it then we don't
328 * want to go to the push routine and duplicate their efforts. 324 * want to go to the push routine and duplicate their efforts.
@@ -562,15 +558,14 @@ xfs_qm_qoffend_logitem_committed(
562 xfs_lsn_t lsn) 558 xfs_lsn_t lsn)
563{ 559{
564 xfs_qoff_logitem_t *qfs; 560 xfs_qoff_logitem_t *qfs;
565 SPLDECL(s);
566 561
567 qfs = qfe->qql_start_lip; 562 qfs = qfe->qql_start_lip;
568 AIL_LOCK(qfs->qql_item.li_mountp,s); 563 spin_lock(&qfs->qql_item.li_mountp->m_ail_lock);
569 /* 564 /*
570 * Delete the qoff-start logitem from the AIL. 565 * Delete the qoff-start logitem from the AIL.
571 * xfs_trans_delete_ail() drops the AIL lock. 566 * xfs_trans_delete_ail() drops the AIL lock.
572 */ 567 */
573 xfs_trans_delete_ail(qfs->qql_item.li_mountp, (xfs_log_item_t *)qfs, s); 568 xfs_trans_delete_ail(qfs->qql_item.li_mountp, (xfs_log_item_t *)qfs);
574 kmem_free(qfs, sizeof(xfs_qoff_logitem_t)); 569 kmem_free(qfs, sizeof(xfs_qoff_logitem_t));
575 kmem_free(qfe, sizeof(xfs_qoff_logitem_t)); 570 kmem_free(qfe, sizeof(xfs_qoff_logitem_t));
576 return (xfs_lsn_t)-1; 571 return (xfs_lsn_t)-1;
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index d488645f833d..1f3da5b8657b 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -310,7 +310,6 @@ xfs_qm_mount_quotas(
310 xfs_mount_t *mp, 310 xfs_mount_t *mp,
311 int mfsi_flags) 311 int mfsi_flags)
312{ 312{
313 unsigned long s;
314 int error = 0; 313 int error = 0;
315 uint sbf; 314 uint sbf;
316 315
@@ -367,13 +366,13 @@ xfs_qm_mount_quotas(
367 366
368 write_changes: 367 write_changes:
369 /* 368 /*
370 * We actually don't have to acquire the SB_LOCK at all. 369 * We actually don't have to acquire the m_sb_lock at all.
371 * This can only be called from mount, and that's single threaded. XXX 370 * This can only be called from mount, and that's single threaded. XXX
372 */ 371 */
373 s = XFS_SB_LOCK(mp); 372 spin_lock(&mp->m_sb_lock);
374 sbf = mp->m_sb.sb_qflags; 373 sbf = mp->m_sb.sb_qflags;
375 mp->m_sb.sb_qflags = mp->m_qflags & XFS_MOUNT_QUOTA_ALL; 374 mp->m_sb.sb_qflags = mp->m_qflags & XFS_MOUNT_QUOTA_ALL;
376 XFS_SB_UNLOCK(mp, s); 375 spin_unlock(&mp->m_sb_lock);
377 376
378 if (sbf != (mp->m_qflags & XFS_MOUNT_QUOTA_ALL)) { 377 if (sbf != (mp->m_qflags & XFS_MOUNT_QUOTA_ALL)) {
379 if (xfs_qm_write_sb_changes(mp, XFS_SB_QFLAGS)) { 378 if (xfs_qm_write_sb_changes(mp, XFS_SB_QFLAGS)) {
@@ -1139,7 +1138,7 @@ xfs_qm_init_quotainfo(
1139 return error; 1138 return error;
1140 } 1139 }
1141 1140
1142 spinlock_init(&qinf->qi_pinlock, "xfs_qinf_pin"); 1141 spin_lock_init(&qinf->qi_pinlock);
1143 xfs_qm_list_init(&qinf->qi_dqlist, "mpdqlist", 0); 1142 xfs_qm_list_init(&qinf->qi_dqlist, "mpdqlist", 0);
1144 qinf->qi_dqreclaims = 0; 1143 qinf->qi_dqreclaims = 0;
1145 1144
@@ -1370,7 +1369,6 @@ xfs_qm_qino_alloc(
1370{ 1369{
1371 xfs_trans_t *tp; 1370 xfs_trans_t *tp;
1372 int error; 1371 int error;
1373 unsigned long s;
1374 int committed; 1372 int committed;
1375 1373
1376 tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QINOCREATE); 1374 tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QINOCREATE);
@@ -1402,7 +1400,7 @@ xfs_qm_qino_alloc(
1402 * sbfields arg may contain fields other than *QUOTINO; 1400 * sbfields arg may contain fields other than *QUOTINO;
1403 * VERSIONNUM for example. 1401 * VERSIONNUM for example.
1404 */ 1402 */
1405 s = XFS_SB_LOCK(mp); 1403 spin_lock(&mp->m_sb_lock);
1406 if (flags & XFS_QMOPT_SBVERSION) { 1404 if (flags & XFS_QMOPT_SBVERSION) {
1407#if defined(DEBUG) && defined(XFS_LOUD_RECOVERY) 1405#if defined(DEBUG) && defined(XFS_LOUD_RECOVERY)
1408 unsigned oldv = mp->m_sb.sb_versionnum; 1406 unsigned oldv = mp->m_sb.sb_versionnum;
@@ -1429,7 +1427,7 @@ xfs_qm_qino_alloc(
1429 mp->m_sb.sb_uquotino = (*ip)->i_ino; 1427 mp->m_sb.sb_uquotino = (*ip)->i_ino;
1430 else 1428 else
1431 mp->m_sb.sb_gquotino = (*ip)->i_ino; 1429 mp->m_sb.sb_gquotino = (*ip)->i_ino;
1432 XFS_SB_UNLOCK(mp, s); 1430 spin_unlock(&mp->m_sb_lock);
1433 xfs_mod_sb(tp, sbfields); 1431 xfs_mod_sb(tp, sbfields);
1434 1432
1435 if ((error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES))) { 1433 if ((error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES))) {
@@ -1650,14 +1648,14 @@ xfs_qm_quotacheck_dqadjust(
1650 * Adjust the inode count and the block count to reflect this inode's 1648 * Adjust the inode count and the block count to reflect this inode's
1651 * resource usage. 1649 * resource usage.
1652 */ 1650 */
1653 be64_add(&dqp->q_core.d_icount, 1); 1651 be64_add_cpu(&dqp->q_core.d_icount, 1);
1654 dqp->q_res_icount++; 1652 dqp->q_res_icount++;
1655 if (nblks) { 1653 if (nblks) {
1656 be64_add(&dqp->q_core.d_bcount, nblks); 1654 be64_add_cpu(&dqp->q_core.d_bcount, nblks);
1657 dqp->q_res_bcount += nblks; 1655 dqp->q_res_bcount += nblks;
1658 } 1656 }
1659 if (rtblks) { 1657 if (rtblks) {
1660 be64_add(&dqp->q_core.d_rtbcount, rtblks); 1658 be64_add_cpu(&dqp->q_core.d_rtbcount, rtblks);
1661 dqp->q_res_rtbcount += rtblks; 1659 dqp->q_res_rtbcount += rtblks;
1662 } 1660 }
1663 1661
diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/quota/xfs_qm.h
index 23ccaa5fceaf..baf537c1c177 100644
--- a/fs/xfs/quota/xfs_qm.h
+++ b/fs/xfs/quota/xfs_qm.h
@@ -52,8 +52,8 @@ extern kmem_zone_t *qm_dqtrxzone;
52/* 52/*
53 * Dquot hashtable constants/threshold values. 53 * Dquot hashtable constants/threshold values.
54 */ 54 */
55#define XFS_QM_HASHSIZE_LOW (NBPP / sizeof(xfs_dqhash_t)) 55#define XFS_QM_HASHSIZE_LOW (PAGE_SIZE / sizeof(xfs_dqhash_t))
56#define XFS_QM_HASHSIZE_HIGH ((NBPP * 4) / sizeof(xfs_dqhash_t)) 56#define XFS_QM_HASHSIZE_HIGH ((PAGE_SIZE * 4) / sizeof(xfs_dqhash_t))
57 57
58/* 58/*
59 * This defines the unit of allocation of dquots. 59 * This defines the unit of allocation of dquots.
@@ -106,7 +106,7 @@ typedef struct xfs_qm {
106typedef struct xfs_quotainfo { 106typedef struct xfs_quotainfo {
107 xfs_inode_t *qi_uquotaip; /* user quota inode */ 107 xfs_inode_t *qi_uquotaip; /* user quota inode */
108 xfs_inode_t *qi_gquotaip; /* group quota inode */ 108 xfs_inode_t *qi_gquotaip; /* group quota inode */
109 lock_t qi_pinlock; /* dquot pinning mutex */ 109 spinlock_t qi_pinlock; /* dquot pinning lock */
110 xfs_dqlist_t qi_dqlist; /* all dquots in filesys */ 110 xfs_dqlist_t qi_dqlist; /* all dquots in filesys */
111 int qi_dqreclaims; /* a change here indicates 111 int qi_dqreclaims; /* a change here indicates
112 a removal in the dqlist */ 112 a removal in the dqlist */
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
index ad5579d4eac4..2cc5886cfe85 100644
--- a/fs/xfs/quota/xfs_qm_syscalls.c
+++ b/fs/xfs/quota/xfs_qm_syscalls.c
@@ -200,7 +200,6 @@ xfs_qm_scall_quotaoff(
200 boolean_t force) 200 boolean_t force)
201{ 201{
202 uint dqtype; 202 uint dqtype;
203 unsigned long s;
204 int error; 203 int error;
205 uint inactivate_flags; 204 uint inactivate_flags;
206 xfs_qoff_logitem_t *qoffstart; 205 xfs_qoff_logitem_t *qoffstart;
@@ -237,9 +236,9 @@ xfs_qm_scall_quotaoff(
237 if ((flags & XFS_ALL_QUOTA_ACCT) == 0) { 236 if ((flags & XFS_ALL_QUOTA_ACCT) == 0) {
238 mp->m_qflags &= ~(flags); 237 mp->m_qflags &= ~(flags);
239 238
240 s = XFS_SB_LOCK(mp); 239 spin_lock(&mp->m_sb_lock);
241 mp->m_sb.sb_qflags = mp->m_qflags; 240 mp->m_sb.sb_qflags = mp->m_qflags;
242 XFS_SB_UNLOCK(mp, s); 241 spin_unlock(&mp->m_sb_lock);
243 mutex_unlock(&(XFS_QI_QOFFLOCK(mp))); 242 mutex_unlock(&(XFS_QI_QOFFLOCK(mp)));
244 243
245 /* XXX what to do if error ? Revert back to old vals incore ? */ 244 /* XXX what to do if error ? Revert back to old vals incore ? */
@@ -415,7 +414,6 @@ xfs_qm_scall_quotaon(
415 uint flags) 414 uint flags)
416{ 415{
417 int error; 416 int error;
418 unsigned long s;
419 uint qf; 417 uint qf;
420 uint accflags; 418 uint accflags;
421 __int64_t sbflags; 419 __int64_t sbflags;
@@ -468,10 +466,10 @@ xfs_qm_scall_quotaon(
468 * Change sb_qflags on disk but not incore mp->qflags 466 * Change sb_qflags on disk but not incore mp->qflags
469 * if this is the root filesystem. 467 * if this is the root filesystem.
470 */ 468 */
471 s = XFS_SB_LOCK(mp); 469 spin_lock(&mp->m_sb_lock);
472 qf = mp->m_sb.sb_qflags; 470 qf = mp->m_sb.sb_qflags;
473 mp->m_sb.sb_qflags = qf | flags; 471 mp->m_sb.sb_qflags = qf | flags;
474 XFS_SB_UNLOCK(mp, s); 472 spin_unlock(&mp->m_sb_lock);
475 473
476 /* 474 /*
477 * There's nothing to change if it's the same. 475 * There's nothing to change if it's the same.
@@ -815,7 +813,6 @@ xfs_qm_log_quotaoff(
815{ 813{
816 xfs_trans_t *tp; 814 xfs_trans_t *tp;
817 int error; 815 int error;
818 unsigned long s;
819 xfs_qoff_logitem_t *qoffi=NULL; 816 xfs_qoff_logitem_t *qoffi=NULL;
820 uint oldsbqflag=0; 817 uint oldsbqflag=0;
821 818
@@ -832,10 +829,10 @@ xfs_qm_log_quotaoff(
832 qoffi = xfs_trans_get_qoff_item(tp, NULL, flags & XFS_ALL_QUOTA_ACCT); 829 qoffi = xfs_trans_get_qoff_item(tp, NULL, flags & XFS_ALL_QUOTA_ACCT);
833 xfs_trans_log_quotaoff_item(tp, qoffi); 830 xfs_trans_log_quotaoff_item(tp, qoffi);
834 831
835 s = XFS_SB_LOCK(mp); 832 spin_lock(&mp->m_sb_lock);
836 oldsbqflag = mp->m_sb.sb_qflags; 833 oldsbqflag = mp->m_sb.sb_qflags;
837 mp->m_sb.sb_qflags = (mp->m_qflags & ~(flags)) & XFS_MOUNT_QUOTA_ALL; 834 mp->m_sb.sb_qflags = (mp->m_qflags & ~(flags)) & XFS_MOUNT_QUOTA_ALL;
838 XFS_SB_UNLOCK(mp, s); 835 spin_unlock(&mp->m_sb_lock);
839 836
840 xfs_mod_sb(tp, XFS_SB_QFLAGS); 837 xfs_mod_sb(tp, XFS_SB_QFLAGS);
841 838
@@ -854,9 +851,9 @@ error0:
854 * No one else is modifying sb_qflags, so this is OK. 851 * No one else is modifying sb_qflags, so this is OK.
855 * We still hold the quotaofflock. 852 * We still hold the quotaofflock.
856 */ 853 */
857 s = XFS_SB_LOCK(mp); 854 spin_lock(&mp->m_sb_lock);
858 mp->m_sb.sb_qflags = oldsbqflag; 855 mp->m_sb.sb_qflags = oldsbqflag;
859 XFS_SB_UNLOCK(mp, s); 856 spin_unlock(&mp->m_sb_lock);
860 } 857 }
861 *qoffstartp = qoffi; 858 *qoffstartp = qoffi;
862 return (error); 859 return (error);
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c
index 7de6874bf1b8..f441f836ca8b 100644
--- a/fs/xfs/quota/xfs_trans_dquot.c
+++ b/fs/xfs/quota/xfs_trans_dquot.c
@@ -421,13 +421,13 @@ xfs_trans_apply_dquot_deltas(
421 (xfs_qcnt_t) -qtrx->qt_icount_delta); 421 (xfs_qcnt_t) -qtrx->qt_icount_delta);
422#endif 422#endif
423 if (totalbdelta) 423 if (totalbdelta)
424 be64_add(&d->d_bcount, (xfs_qcnt_t)totalbdelta); 424 be64_add_cpu(&d->d_bcount, (xfs_qcnt_t)totalbdelta);
425 425
426 if (qtrx->qt_icount_delta) 426 if (qtrx->qt_icount_delta)
427 be64_add(&d->d_icount, (xfs_qcnt_t)qtrx->qt_icount_delta); 427 be64_add_cpu(&d->d_icount, (xfs_qcnt_t)qtrx->qt_icount_delta);
428 428
429 if (totalrtbdelta) 429 if (totalrtbdelta)
430 be64_add(&d->d_rtbcount, (xfs_qcnt_t)totalrtbdelta); 430 be64_add_cpu(&d->d_rtbcount, (xfs_qcnt_t)totalrtbdelta);
431 431
432 /* 432 /*
433 * Get any default limits in use. 433 * Get any default limits in use.