diff options
-rw-r--r-- | fs/xfs/quota/xfs_dquot.c | 6 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_dquot.h | 4 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_dquot_item.c | 37 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.c | 2 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.h | 1 |
5 files changed, 16 insertions, 34 deletions
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c index f2705f2fd43c..d3f4fbbe2480 100644 --- a/fs/xfs/quota/xfs_dquot.c +++ b/fs/xfs/quota/xfs_dquot.c | |||
@@ -101,7 +101,7 @@ xfs_qm_dqinit( | |||
101 | if (brandnewdquot) { | 101 | if (brandnewdquot) { |
102 | dqp->dq_flnext = dqp->dq_flprev = dqp; | 102 | dqp->dq_flnext = dqp->dq_flprev = dqp; |
103 | mutex_init(&dqp->q_qlock); | 103 | mutex_init(&dqp->q_qlock); |
104 | sv_init(&dqp->q_pinwait, SV_DEFAULT, "pdq"); | 104 | init_waitqueue_head(&dqp->q_pinwait); |
105 | 105 | ||
106 | /* | 106 | /* |
107 | * Because we want to use a counting completion, complete | 107 | * Because we want to use a counting completion, complete |
@@ -131,7 +131,7 @@ xfs_qm_dqinit( | |||
131 | dqp->q_res_bcount = 0; | 131 | dqp->q_res_bcount = 0; |
132 | dqp->q_res_icount = 0; | 132 | dqp->q_res_icount = 0; |
133 | dqp->q_res_rtbcount = 0; | 133 | dqp->q_res_rtbcount = 0; |
134 | dqp->q_pincount = 0; | 134 | atomic_set(&dqp->q_pincount, 0); |
135 | dqp->q_hash = NULL; | 135 | dqp->q_hash = NULL; |
136 | ASSERT(dqp->dq_flnext == dqp->dq_flprev); | 136 | ASSERT(dqp->dq_flnext == dqp->dq_flprev); |
137 | 137 | ||
@@ -1489,7 +1489,7 @@ xfs_qm_dqpurge( | |||
1489 | "xfs_qm_dqpurge: dquot %p flush failed", dqp); | 1489 | "xfs_qm_dqpurge: dquot %p flush failed", dqp); |
1490 | xfs_dqflock(dqp); | 1490 | xfs_dqflock(dqp); |
1491 | } | 1491 | } |
1492 | ASSERT(dqp->q_pincount == 0); | 1492 | ASSERT(atomic_read(&dqp->q_pincount) == 0); |
1493 | ASSERT(XFS_FORCED_SHUTDOWN(mp) || | 1493 | ASSERT(XFS_FORCED_SHUTDOWN(mp) || |
1494 | !(dqp->q_logitem.qli_item.li_flags & XFS_LI_IN_AIL)); | 1494 | !(dqp->q_logitem.qli_item.li_flags & XFS_LI_IN_AIL)); |
1495 | 1495 | ||
diff --git a/fs/xfs/quota/xfs_dquot.h b/fs/xfs/quota/xfs_dquot.h index 8958d0faf8d3..7e455337e2ba 100644 --- a/fs/xfs/quota/xfs_dquot.h +++ b/fs/xfs/quota/xfs_dquot.h | |||
@@ -83,8 +83,8 @@ typedef struct xfs_dquot { | |||
83 | xfs_qcnt_t q_res_rtbcount;/* total realtime blks used+reserved */ | 83 | xfs_qcnt_t q_res_rtbcount;/* total realtime blks used+reserved */ |
84 | mutex_t q_qlock; /* quota lock */ | 84 | mutex_t q_qlock; /* quota lock */ |
85 | struct completion q_flush; /* flush completion queue */ | 85 | struct completion q_flush; /* flush completion queue */ |
86 | uint q_pincount; /* pin count for this dquot */ | 86 | atomic_t q_pincount; /* dquot pin count */ |
87 | sv_t q_pinwait; /* sync var for pinning */ | 87 | wait_queue_head_t q_pinwait; /* dquot pinning wait queue */ |
88 | #ifdef XFS_DQUOT_TRACE | 88 | #ifdef XFS_DQUOT_TRACE |
89 | struct ktrace *q_trace; /* trace header structure */ | 89 | struct ktrace *q_trace; /* trace header structure */ |
90 | #endif | 90 | #endif |
diff --git a/fs/xfs/quota/xfs_dquot_item.c b/fs/xfs/quota/xfs_dquot_item.c index f028644caa5e..e33f8646418b 100644 --- a/fs/xfs/quota/xfs_dquot_item.c +++ b/fs/xfs/quota/xfs_dquot_item.c | |||
@@ -88,25 +88,22 @@ xfs_qm_dquot_logitem_format( | |||
88 | 88 | ||
89 | /* | 89 | /* |
90 | * Increment the pin count of the given dquot. | 90 | * Increment the pin count of the given dquot. |
91 | * This value is protected by pinlock spinlock in the xQM structure. | ||
92 | */ | 91 | */ |
93 | STATIC void | 92 | STATIC void |
94 | xfs_qm_dquot_logitem_pin( | 93 | xfs_qm_dquot_logitem_pin( |
95 | xfs_dq_logitem_t *logitem) | 94 | xfs_dq_logitem_t *logitem) |
96 | { | 95 | { |
97 | xfs_dquot_t *dqp; | 96 | xfs_dquot_t *dqp = logitem->qli_dquot; |
98 | 97 | ||
99 | dqp = logitem->qli_dquot; | ||
100 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); | 98 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); |
101 | spin_lock(&(XFS_DQ_TO_QINF(dqp)->qi_pinlock)); | 99 | atomic_inc(dqp->q_pincount); |
102 | dqp->q_pincount++; | ||
103 | spin_unlock(&(XFS_DQ_TO_QINF(dqp)->qi_pinlock)); | ||
104 | } | 100 | } |
105 | 101 | ||
106 | /* | 102 | /* |
107 | * Decrement the pin count of the given dquot, and wake up | 103 | * Decrement the pin count of the given dquot, and wake up |
108 | * anyone in xfs_dqwait_unpin() if the count goes to 0. The | 104 | * anyone in xfs_dqwait_unpin() if the count goes to 0. The |
109 | * dquot must have been previously pinned with a call to xfs_dqpin(). | 105 | * dquot must have been previously pinned with a call to |
106 | * xfs_qm_dquot_logitem_pin(). | ||
110 | */ | 107 | */ |
111 | /* ARGSUSED */ | 108 | /* ARGSUSED */ |
112 | STATIC void | 109 | STATIC void |
@@ -114,16 +111,11 @@ xfs_qm_dquot_logitem_unpin( | |||
114 | xfs_dq_logitem_t *logitem, | 111 | xfs_dq_logitem_t *logitem, |
115 | int stale) | 112 | int stale) |
116 | { | 113 | { |
117 | xfs_dquot_t *dqp; | 114 | xfs_dquot_t *dqp = logitem->qli_dquot; |
118 | 115 | ||
119 | dqp = logitem->qli_dquot; | 116 | ASSERT(atomic_read(&dqp->q_pincount) > 0); |
120 | ASSERT(dqp->q_pincount > 0); | 117 | if (atomic_dec_and_test(&dqp->q_pincount)) |
121 | spin_lock(&(XFS_DQ_TO_QINF(dqp)->qi_pinlock)); | 118 | wake_up(&dqp->q_pinwait); |
122 | dqp->q_pincount--; | ||
123 | if (dqp->q_pincount == 0) { | ||
124 | sv_broadcast(&dqp->q_pinwait); | ||
125 | } | ||
126 | spin_unlock(&(XFS_DQ_TO_QINF(dqp)->qi_pinlock)); | ||
127 | } | 119 | } |
128 | 120 | ||
129 | /* ARGSUSED */ | 121 | /* ARGSUSED */ |
@@ -193,21 +185,14 @@ xfs_qm_dqunpin_wait( | |||
193 | xfs_dquot_t *dqp) | 185 | xfs_dquot_t *dqp) |
194 | { | 186 | { |
195 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); | 187 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); |
196 | if (dqp->q_pincount == 0) { | 188 | if (atomic_read(&dqp->q_pincount) == 0) |
197 | return; | 189 | return; |
198 | } | ||
199 | 190 | ||
200 | /* | 191 | /* |
201 | * Give the log a push so we don't wait here too long. | 192 | * Give the log a push so we don't wait here too long. |
202 | */ | 193 | */ |
203 | xfs_log_force(dqp->q_mount, (xfs_lsn_t)0, XFS_LOG_FORCE); | 194 | xfs_log_force(dqp->q_mount, (xfs_lsn_t)0, XFS_LOG_FORCE); |
204 | spin_lock(&(XFS_DQ_TO_QINF(dqp)->qi_pinlock)); | 195 | wait_event(dqp->q_pinwait, (atomic_read(&dqp->q_pincount) == 0)); |
205 | if (dqp->q_pincount == 0) { | ||
206 | spin_unlock(&(XFS_DQ_TO_QINF(dqp)->qi_pinlock)); | ||
207 | return; | ||
208 | } | ||
209 | sv_wait(&(dqp->q_pinwait), PINOD, | ||
210 | &(XFS_DQ_TO_QINF(dqp)->qi_pinlock), s); | ||
211 | } | 196 | } |
212 | 197 | ||
213 | /* | 198 | /* |
@@ -310,7 +295,7 @@ xfs_qm_dquot_logitem_trylock( | |||
310 | uint retval; | 295 | uint retval; |
311 | 296 | ||
312 | dqp = qip->qli_dquot; | 297 | dqp = qip->qli_dquot; |
313 | if (dqp->q_pincount > 0) | 298 | if (atomic_read(&dqp->q_pincount) > 0) |
314 | return (XFS_ITEM_PINNED); | 299 | return (XFS_ITEM_PINNED); |
315 | 300 | ||
316 | if (! xfs_qm_dqlock_nowait(dqp)) | 301 | if (! xfs_qm_dqlock_nowait(dqp)) |
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index df0ffef9775a..270f775974e2 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c | |||
@@ -1137,7 +1137,6 @@ xfs_qm_init_quotainfo( | |||
1137 | return error; | 1137 | return error; |
1138 | } | 1138 | } |
1139 | 1139 | ||
1140 | spin_lock_init(&qinf->qi_pinlock); | ||
1141 | xfs_qm_list_init(&qinf->qi_dqlist, "mpdqlist", 0); | 1140 | xfs_qm_list_init(&qinf->qi_dqlist, "mpdqlist", 0); |
1142 | qinf->qi_dqreclaims = 0; | 1141 | qinf->qi_dqreclaims = 0; |
1143 | 1142 | ||
@@ -1234,7 +1233,6 @@ xfs_qm_destroy_quotainfo( | |||
1234 | */ | 1233 | */ |
1235 | xfs_qm_rele_quotafs_ref(mp); | 1234 | xfs_qm_rele_quotafs_ref(mp); |
1236 | 1235 | ||
1237 | spinlock_destroy(&qi->qi_pinlock); | ||
1238 | xfs_qm_list_destroy(&qi->qi_dqlist); | 1236 | xfs_qm_list_destroy(&qi->qi_dqlist); |
1239 | 1237 | ||
1240 | if (qi->qi_uquotaip) { | 1238 | if (qi->qi_uquotaip) { |
diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/quota/xfs_qm.h index 44f25349e478..4f2de9771728 100644 --- a/fs/xfs/quota/xfs_qm.h +++ b/fs/xfs/quota/xfs_qm.h | |||
@@ -106,7 +106,6 @@ typedef struct xfs_qm { | |||
106 | typedef struct xfs_quotainfo { | 106 | typedef 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 | spinlock_t qi_pinlock; /* dquot pinning lock */ | ||
110 | xfs_dqlist_t qi_dqlist; /* all dquots in filesys */ | 109 | xfs_dqlist_t qi_dqlist; /* all dquots in filesys */ |
111 | int qi_dqreclaims; /* a change here indicates | 110 | int qi_dqreclaims; /* a change here indicates |
112 | a removal in the dqlist */ | 111 | a removal in the dqlist */ |