diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-06-23 04:11:15 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-07-26 14:16:35 -0400 |
commit | 7bfa31d8e0f90b65ff23be94fca65ce261b43fc8 (patch) | |
tree | dbf7bfd8ce06baca8fd23aeac3c99fa73c07a8bb /fs/xfs/quota | |
parent | 9412e3181c0ef82efc3d8e88d73e583ec10c34e9 (diff) |
xfs: give xfs_item_ops methods the correct prototypes
Stop the function pointer casting madness and give all the xfs_item_ops the
correct prototypes.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/quota')
-rw-r--r-- | fs/xfs/quota/xfs_dquot_item.c | 268 |
1 files changed, 119 insertions, 149 deletions
diff --git a/fs/xfs/quota/xfs_dquot_item.c b/fs/xfs/quota/xfs_dquot_item.c index fa2b6744937e..cd86bc317d59 100644 --- a/fs/xfs/quota/xfs_dquot_item.c +++ b/fs/xfs/quota/xfs_dquot_item.c | |||
@@ -37,18 +37,22 @@ | |||
37 | #include "xfs_trans_priv.h" | 37 | #include "xfs_trans_priv.h" |
38 | #include "xfs_qm.h" | 38 | #include "xfs_qm.h" |
39 | 39 | ||
40 | static inline struct xfs_dq_logitem *DQUOT_ITEM(struct xfs_log_item *lip) | ||
41 | { | ||
42 | return container_of(lip, struct xfs_dq_logitem, qli_item); | ||
43 | } | ||
44 | |||
40 | /* | 45 | /* |
41 | * returns the number of iovecs needed to log the given dquot item. | 46 | * returns the number of iovecs needed to log the given dquot item. |
42 | */ | 47 | */ |
43 | /* ARGSUSED */ | ||
44 | STATIC uint | 48 | STATIC uint |
45 | xfs_qm_dquot_logitem_size( | 49 | xfs_qm_dquot_logitem_size( |
46 | xfs_dq_logitem_t *logitem) | 50 | struct xfs_log_item *lip) |
47 | { | 51 | { |
48 | /* | 52 | /* |
49 | * we need only two iovecs, one for the format, one for the real thing | 53 | * we need only two iovecs, one for the format, one for the real thing |
50 | */ | 54 | */ |
51 | return (2); | 55 | return 2; |
52 | } | 56 | } |
53 | 57 | ||
54 | /* | 58 | /* |
@@ -56,22 +60,21 @@ xfs_qm_dquot_logitem_size( | |||
56 | */ | 60 | */ |
57 | STATIC void | 61 | STATIC void |
58 | xfs_qm_dquot_logitem_format( | 62 | xfs_qm_dquot_logitem_format( |
59 | xfs_dq_logitem_t *logitem, | 63 | struct xfs_log_item *lip, |
60 | xfs_log_iovec_t *logvec) | 64 | struct xfs_log_iovec *logvec) |
61 | { | 65 | { |
62 | ASSERT(logitem); | 66 | struct xfs_dq_logitem *qlip = DQUOT_ITEM(lip); |
63 | ASSERT(logitem->qli_dquot); | ||
64 | 67 | ||
65 | logvec->i_addr = (xfs_caddr_t)&logitem->qli_format; | 68 | logvec->i_addr = (xfs_caddr_t)&qlip->qli_format; |
66 | logvec->i_len = sizeof(xfs_dq_logformat_t); | 69 | logvec->i_len = sizeof(xfs_dq_logformat_t); |
67 | logvec->i_type = XLOG_REG_TYPE_QFORMAT; | 70 | logvec->i_type = XLOG_REG_TYPE_QFORMAT; |
68 | logvec++; | 71 | logvec++; |
69 | logvec->i_addr = (xfs_caddr_t)&logitem->qli_dquot->q_core; | 72 | logvec->i_addr = (xfs_caddr_t)&qlip->qli_dquot->q_core; |
70 | logvec->i_len = sizeof(xfs_disk_dquot_t); | 73 | logvec->i_len = sizeof(xfs_disk_dquot_t); |
71 | logvec->i_type = XLOG_REG_TYPE_DQUOT; | 74 | logvec->i_type = XLOG_REG_TYPE_DQUOT; |
72 | 75 | ||
73 | ASSERT(2 == logitem->qli_item.li_desc->lid_size); | 76 | ASSERT(2 == lip->li_desc->lid_size); |
74 | logitem->qli_format.qlf_size = 2; | 77 | qlip->qli_format.qlf_size = 2; |
75 | 78 | ||
76 | } | 79 | } |
77 | 80 | ||
@@ -80,9 +83,9 @@ xfs_qm_dquot_logitem_format( | |||
80 | */ | 83 | */ |
81 | STATIC void | 84 | STATIC void |
82 | xfs_qm_dquot_logitem_pin( | 85 | xfs_qm_dquot_logitem_pin( |
83 | xfs_dq_logitem_t *logitem) | 86 | struct xfs_log_item *lip) |
84 | { | 87 | { |
85 | xfs_dquot_t *dqp = logitem->qli_dquot; | 88 | struct xfs_dquot *dqp = DQUOT_ITEM(lip)->qli_dquot; |
86 | 89 | ||
87 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); | 90 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); |
88 | atomic_inc(&dqp->q_pincount); | 91 | atomic_inc(&dqp->q_pincount); |
@@ -94,13 +97,12 @@ xfs_qm_dquot_logitem_pin( | |||
94 | * dquot must have been previously pinned with a call to | 97 | * dquot must have been previously pinned with a call to |
95 | * xfs_qm_dquot_logitem_pin(). | 98 | * xfs_qm_dquot_logitem_pin(). |
96 | */ | 99 | */ |
97 | /* ARGSUSED */ | ||
98 | STATIC void | 100 | STATIC void |
99 | xfs_qm_dquot_logitem_unpin( | 101 | xfs_qm_dquot_logitem_unpin( |
100 | xfs_dq_logitem_t *logitem, | 102 | struct xfs_log_item *lip, |
101 | int remove) | 103 | int remove) |
102 | { | 104 | { |
103 | xfs_dquot_t *dqp = logitem->qli_dquot; | 105 | struct xfs_dquot *dqp = DQUOT_ITEM(lip)->qli_dquot; |
104 | 106 | ||
105 | ASSERT(atomic_read(&dqp->q_pincount) > 0); | 107 | ASSERT(atomic_read(&dqp->q_pincount) > 0); |
106 | if (atomic_dec_and_test(&dqp->q_pincount)) | 108 | if (atomic_dec_and_test(&dqp->q_pincount)) |
@@ -115,12 +117,10 @@ xfs_qm_dquot_logitem_unpin( | |||
115 | */ | 117 | */ |
116 | STATIC void | 118 | STATIC void |
117 | xfs_qm_dquot_logitem_push( | 119 | xfs_qm_dquot_logitem_push( |
118 | xfs_dq_logitem_t *logitem) | 120 | struct xfs_log_item *lip) |
119 | { | 121 | { |
120 | xfs_dquot_t *dqp; | 122 | struct xfs_dquot *dqp = DQUOT_ITEM(lip)->qli_dquot; |
121 | int error; | 123 | int error; |
122 | |||
123 | dqp = logitem->qli_dquot; | ||
124 | 124 | ||
125 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); | 125 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); |
126 | ASSERT(!completion_done(&dqp->q_flush)); | 126 | ASSERT(!completion_done(&dqp->q_flush)); |
@@ -142,27 +142,25 @@ xfs_qm_dquot_logitem_push( | |||
142 | xfs_dqunlock(dqp); | 142 | xfs_dqunlock(dqp); |
143 | } | 143 | } |
144 | 144 | ||
145 | /*ARGSUSED*/ | ||
146 | STATIC xfs_lsn_t | 145 | STATIC xfs_lsn_t |
147 | xfs_qm_dquot_logitem_committed( | 146 | xfs_qm_dquot_logitem_committed( |
148 | xfs_dq_logitem_t *l, | 147 | struct xfs_log_item *lip, |
149 | xfs_lsn_t lsn) | 148 | xfs_lsn_t lsn) |
150 | { | 149 | { |
151 | /* | 150 | /* |
152 | * We always re-log the entire dquot when it becomes dirty, | 151 | * We always re-log the entire dquot when it becomes dirty, |
153 | * so, the latest copy _is_ the only one that matters. | 152 | * so, the latest copy _is_ the only one that matters. |
154 | */ | 153 | */ |
155 | return (lsn); | 154 | return lsn; |
156 | } | 155 | } |
157 | 156 | ||
158 | |||
159 | /* | 157 | /* |
160 | * This is called to wait for the given dquot to be unpinned. | 158 | * This is called to wait for the given dquot to be unpinned. |
161 | * Most of these pin/unpin routines are plagiarized from inode code. | 159 | * Most of these pin/unpin routines are plagiarized from inode code. |
162 | */ | 160 | */ |
163 | void | 161 | void |
164 | xfs_qm_dqunpin_wait( | 162 | xfs_qm_dqunpin_wait( |
165 | xfs_dquot_t *dqp) | 163 | struct xfs_dquot *dqp) |
166 | { | 164 | { |
167 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); | 165 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); |
168 | if (atomic_read(&dqp->q_pincount) == 0) | 166 | if (atomic_read(&dqp->q_pincount) == 0) |
@@ -188,13 +186,12 @@ xfs_qm_dqunpin_wait( | |||
188 | */ | 186 | */ |
189 | STATIC void | 187 | STATIC void |
190 | xfs_qm_dquot_logitem_pushbuf( | 188 | xfs_qm_dquot_logitem_pushbuf( |
191 | xfs_dq_logitem_t *qip) | 189 | struct xfs_log_item *lip) |
192 | { | 190 | { |
193 | xfs_dquot_t *dqp; | 191 | struct xfs_dq_logitem *qlip = DQUOT_ITEM(lip); |
194 | xfs_mount_t *mp; | 192 | struct xfs_dquot *dqp = qlip->qli_dquot; |
195 | xfs_buf_t *bp; | 193 | struct xfs_buf *bp; |
196 | 194 | ||
197 | dqp = qip->qli_dquot; | ||
198 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); | 195 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); |
199 | 196 | ||
200 | /* | 197 | /* |
@@ -202,22 +199,20 @@ xfs_qm_dquot_logitem_pushbuf( | |||
202 | * inode flush completed and the inode was taken off the AIL. | 199 | * inode flush completed and the inode was taken off the AIL. |
203 | * So, just get out. | 200 | * So, just get out. |
204 | */ | 201 | */ |
205 | if (completion_done(&dqp->q_flush) || | 202 | if (completion_done(&dqp->q_flush) || |
206 | ((qip->qli_item.li_flags & XFS_LI_IN_AIL) == 0)) { | 203 | !(lip->li_flags & XFS_LI_IN_AIL)) { |
207 | xfs_dqunlock(dqp); | 204 | xfs_dqunlock(dqp); |
208 | return; | 205 | return; |
209 | } | 206 | } |
210 | mp = dqp->q_mount; | 207 | |
211 | bp = xfs_incore(mp->m_ddev_targp, qip->qli_format.qlf_blkno, | 208 | bp = xfs_incore(dqp->q_mount->m_ddev_targp, qlip->qli_format.qlf_blkno, |
212 | mp->m_quotainfo->qi_dqchunklen, XBF_TRYLOCK); | 209 | dqp->q_mount->m_quotainfo->qi_dqchunklen, XBF_TRYLOCK); |
213 | xfs_dqunlock(dqp); | 210 | xfs_dqunlock(dqp); |
214 | if (!bp) | 211 | if (!bp) |
215 | return; | 212 | return; |
216 | if (XFS_BUF_ISDELAYWRITE(bp)) | 213 | if (XFS_BUF_ISDELAYWRITE(bp)) |
217 | xfs_buf_delwri_promote(bp); | 214 | xfs_buf_delwri_promote(bp); |
218 | xfs_buf_relse(bp); | 215 | xfs_buf_relse(bp); |
219 | return; | ||
220 | |||
221 | } | 216 | } |
222 | 217 | ||
223 | /* | 218 | /* |
@@ -232,15 +227,14 @@ xfs_qm_dquot_logitem_pushbuf( | |||
232 | */ | 227 | */ |
233 | STATIC uint | 228 | STATIC uint |
234 | xfs_qm_dquot_logitem_trylock( | 229 | xfs_qm_dquot_logitem_trylock( |
235 | xfs_dq_logitem_t *qip) | 230 | struct xfs_log_item *lip) |
236 | { | 231 | { |
237 | xfs_dquot_t *dqp; | 232 | struct xfs_dquot *dqp = DQUOT_ITEM(lip)->qli_dquot; |
238 | 233 | ||
239 | dqp = qip->qli_dquot; | ||
240 | if (atomic_read(&dqp->q_pincount) > 0) | 234 | if (atomic_read(&dqp->q_pincount) > 0) |
241 | return XFS_ITEM_PINNED; | 235 | return XFS_ITEM_PINNED; |
242 | 236 | ||
243 | if (! xfs_qm_dqlock_nowait(dqp)) | 237 | if (!xfs_qm_dqlock_nowait(dqp)) |
244 | return XFS_ITEM_LOCKED; | 238 | return XFS_ITEM_LOCKED; |
245 | 239 | ||
246 | if (!xfs_dqflock_nowait(dqp)) { | 240 | if (!xfs_dqflock_nowait(dqp)) { |
@@ -251,11 +245,10 @@ xfs_qm_dquot_logitem_trylock( | |||
251 | return XFS_ITEM_PUSHBUF; | 245 | return XFS_ITEM_PUSHBUF; |
252 | } | 246 | } |
253 | 247 | ||
254 | ASSERT(qip->qli_item.li_flags & XFS_LI_IN_AIL); | 248 | ASSERT(lip->li_flags & XFS_LI_IN_AIL); |
255 | return XFS_ITEM_SUCCESS; | 249 | return XFS_ITEM_SUCCESS; |
256 | } | 250 | } |
257 | 251 | ||
258 | |||
259 | /* | 252 | /* |
260 | * Unlock the dquot associated with the log item. | 253 | * Unlock the dquot associated with the log item. |
261 | * Clear the fields of the dquot and dquot log item that | 254 | * Clear the fields of the dquot and dquot log item that |
@@ -264,12 +257,10 @@ xfs_qm_dquot_logitem_trylock( | |||
264 | */ | 257 | */ |
265 | STATIC void | 258 | STATIC void |
266 | xfs_qm_dquot_logitem_unlock( | 259 | xfs_qm_dquot_logitem_unlock( |
267 | xfs_dq_logitem_t *ql) | 260 | struct xfs_log_item *lip) |
268 | { | 261 | { |
269 | xfs_dquot_t *dqp; | 262 | struct xfs_dquot *dqp = DQUOT_ITEM(lip)->qli_dquot; |
270 | 263 | ||
271 | ASSERT(ql != NULL); | ||
272 | dqp = ql->qli_dquot; | ||
273 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); | 264 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); |
274 | 265 | ||
275 | /* | 266 | /* |
@@ -286,41 +277,32 @@ xfs_qm_dquot_logitem_unlock( | |||
286 | xfs_dqunlock(dqp); | 277 | xfs_dqunlock(dqp); |
287 | } | 278 | } |
288 | 279 | ||
289 | |||
290 | /* | 280 | /* |
291 | * this needs to stamp an lsn into the dquot, I think. | 281 | * this needs to stamp an lsn into the dquot, I think. |
292 | * rpc's that look at user dquot's would then have to | 282 | * rpc's that look at user dquot's would then have to |
293 | * push on the dependency recorded in the dquot | 283 | * push on the dependency recorded in the dquot |
294 | */ | 284 | */ |
295 | /* ARGSUSED */ | ||
296 | STATIC void | 285 | STATIC void |
297 | xfs_qm_dquot_logitem_committing( | 286 | xfs_qm_dquot_logitem_committing( |
298 | xfs_dq_logitem_t *l, | 287 | struct xfs_log_item *lip, |
299 | xfs_lsn_t lsn) | 288 | xfs_lsn_t lsn) |
300 | { | 289 | { |
301 | return; | ||
302 | } | 290 | } |
303 | 291 | ||
304 | |||
305 | /* | 292 | /* |
306 | * This is the ops vector for dquots | 293 | * This is the ops vector for dquots |
307 | */ | 294 | */ |
308 | static struct xfs_item_ops xfs_dquot_item_ops = { | 295 | static struct xfs_item_ops xfs_dquot_item_ops = { |
309 | .iop_size = (uint(*)(xfs_log_item_t*))xfs_qm_dquot_logitem_size, | 296 | .iop_size = xfs_qm_dquot_logitem_size, |
310 | .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) | 297 | .iop_format = xfs_qm_dquot_logitem_format, |
311 | xfs_qm_dquot_logitem_format, | 298 | .iop_pin = xfs_qm_dquot_logitem_pin, |
312 | .iop_pin = (void(*)(xfs_log_item_t*))xfs_qm_dquot_logitem_pin, | 299 | .iop_unpin = xfs_qm_dquot_logitem_unpin, |
313 | .iop_unpin = (void(*)(xfs_log_item_t*, int))xfs_qm_dquot_logitem_unpin, | 300 | .iop_trylock = xfs_qm_dquot_logitem_trylock, |
314 | .iop_trylock = (uint(*)(xfs_log_item_t*)) | 301 | .iop_unlock = xfs_qm_dquot_logitem_unlock, |
315 | xfs_qm_dquot_logitem_trylock, | 302 | .iop_committed = xfs_qm_dquot_logitem_committed, |
316 | .iop_unlock = (void(*)(xfs_log_item_t*))xfs_qm_dquot_logitem_unlock, | 303 | .iop_push = xfs_qm_dquot_logitem_push, |
317 | .iop_committed = (xfs_lsn_t(*)(xfs_log_item_t*, xfs_lsn_t)) | 304 | .iop_pushbuf = xfs_qm_dquot_logitem_pushbuf, |
318 | xfs_qm_dquot_logitem_committed, | 305 | .iop_committing = xfs_qm_dquot_logitem_committing |
319 | .iop_push = (void(*)(xfs_log_item_t*))xfs_qm_dquot_logitem_push, | ||
320 | .iop_pushbuf = (void(*)(xfs_log_item_t*)) | ||
321 | xfs_qm_dquot_logitem_pushbuf, | ||
322 | .iop_committing = (void(*)(xfs_log_item_t*, xfs_lsn_t)) | ||
323 | xfs_qm_dquot_logitem_committing | ||
324 | }; | 306 | }; |
325 | 307 | ||
326 | /* | 308 | /* |
@@ -330,10 +312,9 @@ static struct xfs_item_ops xfs_dquot_item_ops = { | |||
330 | */ | 312 | */ |
331 | void | 313 | void |
332 | xfs_qm_dquot_logitem_init( | 314 | xfs_qm_dquot_logitem_init( |
333 | struct xfs_dquot *dqp) | 315 | struct xfs_dquot *dqp) |
334 | { | 316 | { |
335 | xfs_dq_logitem_t *lp; | 317 | struct xfs_dq_logitem *lp = &dqp->q_logitem; |
336 | lp = &dqp->q_logitem; | ||
337 | 318 | ||
338 | xfs_log_item_init(dqp->q_mount, &lp->qli_item, XFS_LI_DQUOT, | 319 | xfs_log_item_init(dqp->q_mount, &lp->qli_item, XFS_LI_DQUOT, |
339 | &xfs_dquot_item_ops); | 320 | &xfs_dquot_item_ops); |
@@ -354,16 +335,22 @@ xfs_qm_dquot_logitem_init( | |||
354 | 335 | ||
355 | /*------------------ QUOTAOFF LOG ITEMS -------------------*/ | 336 | /*------------------ QUOTAOFF LOG ITEMS -------------------*/ |
356 | 337 | ||
338 | static inline struct xfs_qoff_logitem *QOFF_ITEM(struct xfs_log_item *lip) | ||
339 | { | ||
340 | return container_of(lip, struct xfs_qoff_logitem, qql_item); | ||
341 | } | ||
342 | |||
343 | |||
357 | /* | 344 | /* |
358 | * This returns the number of iovecs needed to log the given quotaoff item. | 345 | * This returns the number of iovecs needed to log the given quotaoff item. |
359 | * We only need 1 iovec for an quotaoff item. It just logs the | 346 | * We only need 1 iovec for an quotaoff item. It just logs the |
360 | * quotaoff_log_format structure. | 347 | * quotaoff_log_format structure. |
361 | */ | 348 | */ |
362 | /*ARGSUSED*/ | ||
363 | STATIC uint | 349 | STATIC uint |
364 | xfs_qm_qoff_logitem_size(xfs_qoff_logitem_t *qf) | 350 | xfs_qm_qoff_logitem_size( |
351 | struct xfs_log_item *lip) | ||
365 | { | 352 | { |
366 | return (1); | 353 | return 1; |
367 | } | 354 | } |
368 | 355 | ||
369 | /* | 356 | /* |
@@ -374,46 +361,46 @@ xfs_qm_qoff_logitem_size(xfs_qoff_logitem_t *qf) | |||
374 | * slots in the quotaoff item have been filled. | 361 | * slots in the quotaoff item have been filled. |
375 | */ | 362 | */ |
376 | STATIC void | 363 | STATIC void |
377 | xfs_qm_qoff_logitem_format(xfs_qoff_logitem_t *qf, | 364 | xfs_qm_qoff_logitem_format( |
378 | xfs_log_iovec_t *log_vector) | 365 | struct xfs_log_item *lip, |
366 | struct xfs_log_iovec *log_vector) | ||
379 | { | 367 | { |
380 | ASSERT(qf->qql_format.qf_type == XFS_LI_QUOTAOFF); | 368 | struct xfs_qoff_logitem *qflip = QOFF_ITEM(lip); |
381 | 369 | ||
382 | log_vector->i_addr = (xfs_caddr_t)&(qf->qql_format); | 370 | ASSERT(qflip->qql_format.qf_type == XFS_LI_QUOTAOFF); |
371 | |||
372 | log_vector->i_addr = (xfs_caddr_t)&(qflip->qql_format); | ||
383 | log_vector->i_len = sizeof(xfs_qoff_logitem_t); | 373 | log_vector->i_len = sizeof(xfs_qoff_logitem_t); |
384 | log_vector->i_type = XLOG_REG_TYPE_QUOTAOFF; | 374 | log_vector->i_type = XLOG_REG_TYPE_QUOTAOFF; |
385 | qf->qql_format.qf_size = 1; | 375 | qflip->qql_format.qf_size = 1; |
386 | } | 376 | } |
387 | 377 | ||
388 | |||
389 | /* | 378 | /* |
390 | * Pinning has no meaning for an quotaoff item, so just return. | 379 | * Pinning has no meaning for an quotaoff item, so just return. |
391 | */ | 380 | */ |
392 | /*ARGSUSED*/ | ||
393 | STATIC void | 381 | STATIC void |
394 | xfs_qm_qoff_logitem_pin(xfs_qoff_logitem_t *qf) | 382 | xfs_qm_qoff_logitem_pin( |
383 | struct xfs_log_item *lip) | ||
395 | { | 384 | { |
396 | return; | ||
397 | } | 385 | } |
398 | 386 | ||
399 | |||
400 | /* | 387 | /* |
401 | * Since pinning has no meaning for an quotaoff item, unpinning does | 388 | * Since pinning has no meaning for an quotaoff item, unpinning does |
402 | * not either. | 389 | * not either. |
403 | */ | 390 | */ |
404 | /*ARGSUSED*/ | ||
405 | STATIC void | 391 | STATIC void |
406 | xfs_qm_qoff_logitem_unpin(xfs_qoff_logitem_t *qf, int remove) | 392 | xfs_qm_qoff_logitem_unpin( |
393 | struct xfs_log_item *lip, | ||
394 | int remove) | ||
407 | { | 395 | { |
408 | return; | ||
409 | } | 396 | } |
410 | 397 | ||
411 | /* | 398 | /* |
412 | * Quotaoff items have no locking, so just return success. | 399 | * Quotaoff items have no locking, so just return success. |
413 | */ | 400 | */ |
414 | /*ARGSUSED*/ | ||
415 | STATIC uint | 401 | STATIC uint |
416 | xfs_qm_qoff_logitem_trylock(xfs_qoff_logitem_t *qf) | 402 | xfs_qm_qoff_logitem_trylock( |
403 | struct xfs_log_item *lip) | ||
417 | { | 404 | { |
418 | return XFS_ITEM_LOCKED; | 405 | return XFS_ITEM_LOCKED; |
419 | } | 406 | } |
@@ -422,53 +409,51 @@ xfs_qm_qoff_logitem_trylock(xfs_qoff_logitem_t *qf) | |||
422 | * Quotaoff items have no locking or pushing, so return failure | 409 | * Quotaoff items have no locking or pushing, so return failure |
423 | * so that the caller doesn't bother with us. | 410 | * so that the caller doesn't bother with us. |
424 | */ | 411 | */ |
425 | /*ARGSUSED*/ | ||
426 | STATIC void | 412 | STATIC void |
427 | xfs_qm_qoff_logitem_unlock(xfs_qoff_logitem_t *qf) | 413 | xfs_qm_qoff_logitem_unlock( |
414 | struct xfs_log_item *lip) | ||
428 | { | 415 | { |
429 | return; | ||
430 | } | 416 | } |
431 | 417 | ||
432 | /* | 418 | /* |
433 | * The quotaoff-start-item is logged only once and cannot be moved in the log, | 419 | * The quotaoff-start-item is logged only once and cannot be moved in the log, |
434 | * so simply return the lsn at which it's been logged. | 420 | * so simply return the lsn at which it's been logged. |
435 | */ | 421 | */ |
436 | /*ARGSUSED*/ | ||
437 | STATIC xfs_lsn_t | 422 | STATIC xfs_lsn_t |
438 | xfs_qm_qoff_logitem_committed(xfs_qoff_logitem_t *qf, xfs_lsn_t lsn) | 423 | xfs_qm_qoff_logitem_committed( |
424 | struct xfs_log_item *lip, | ||
425 | xfs_lsn_t lsn) | ||
439 | { | 426 | { |
440 | return (lsn); | 427 | return lsn; |
441 | } | 428 | } |
442 | 429 | ||
443 | /* | 430 | /* |
444 | * There isn't much you can do to push on an quotaoff item. It is simply | 431 | * There isn't much you can do to push on an quotaoff item. It is simply |
445 | * stuck waiting for the log to be flushed to disk. | 432 | * stuck waiting for the log to be flushed to disk. |
446 | */ | 433 | */ |
447 | /*ARGSUSED*/ | ||
448 | STATIC void | 434 | STATIC void |
449 | xfs_qm_qoff_logitem_push(xfs_qoff_logitem_t *qf) | 435 | xfs_qm_qoff_logitem_push( |
436 | struct xfs_log_item *lip) | ||
450 | { | 437 | { |
451 | return; | ||
452 | } | 438 | } |
453 | 439 | ||
454 | 440 | ||
455 | /*ARGSUSED*/ | ||
456 | STATIC xfs_lsn_t | 441 | STATIC xfs_lsn_t |
457 | xfs_qm_qoffend_logitem_committed( | 442 | xfs_qm_qoffend_logitem_committed( |
458 | xfs_qoff_logitem_t *qfe, | 443 | struct xfs_log_item *lip, |
459 | xfs_lsn_t lsn) | 444 | xfs_lsn_t lsn) |
460 | { | 445 | { |
461 | xfs_qoff_logitem_t *qfs; | 446 | struct xfs_qoff_logitem *qfe = QOFF_ITEM(lip); |
462 | struct xfs_ail *ailp; | 447 | struct xfs_qoff_logitem *qfs = qfe->qql_start_lip; |
448 | struct xfs_ail *ailp = qfs->qql_item.li_ailp; | ||
463 | 449 | ||
464 | qfs = qfe->qql_start_lip; | ||
465 | ailp = qfs->qql_item.li_ailp; | ||
466 | spin_lock(&ailp->xa_lock); | ||
467 | /* | 450 | /* |
468 | * Delete the qoff-start logitem from the AIL. | 451 | * Delete the qoff-start logitem from the AIL. |
469 | * xfs_trans_ail_delete() drops the AIL lock. | 452 | * xfs_trans_ail_delete() drops the AIL lock. |
470 | */ | 453 | */ |
454 | spin_lock(&ailp->xa_lock); | ||
471 | xfs_trans_ail_delete(ailp, (xfs_log_item_t *)qfs); | 455 | xfs_trans_ail_delete(ailp, (xfs_log_item_t *)qfs); |
456 | |||
472 | kmem_free(qfs); | 457 | kmem_free(qfs); |
473 | kmem_free(qfe); | 458 | kmem_free(qfe); |
474 | return (xfs_lsn_t)-1; | 459 | return (xfs_lsn_t)-1; |
@@ -488,67 +473,52 @@ xfs_qm_qoffend_logitem_committed( | |||
488 | * (truly makes the quotaoff irrevocable). If we do something else, | 473 | * (truly makes the quotaoff irrevocable). If we do something else, |
489 | * then maybe we don't need two. | 474 | * then maybe we don't need two. |
490 | */ | 475 | */ |
491 | /* ARGSUSED */ | ||
492 | STATIC void | ||
493 | xfs_qm_qoff_logitem_committing(xfs_qoff_logitem_t *qip, xfs_lsn_t commit_lsn) | ||
494 | { | ||
495 | return; | ||
496 | } | ||
497 | |||
498 | /* ARGSUSED */ | ||
499 | STATIC void | 476 | STATIC void |
500 | xfs_qm_qoffend_logitem_committing(xfs_qoff_logitem_t *qip, xfs_lsn_t commit_lsn) | 477 | xfs_qm_qoff_logitem_committing( |
478 | struct xfs_log_item *lip, | ||
479 | xfs_lsn_t commit_lsn) | ||
501 | { | 480 | { |
502 | return; | ||
503 | } | 481 | } |
504 | 482 | ||
505 | static struct xfs_item_ops xfs_qm_qoffend_logitem_ops = { | 483 | static struct xfs_item_ops xfs_qm_qoffend_logitem_ops = { |
506 | .iop_size = (uint(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_size, | 484 | .iop_size = xfs_qm_qoff_logitem_size, |
507 | .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) | 485 | .iop_format = xfs_qm_qoff_logitem_format, |
508 | xfs_qm_qoff_logitem_format, | 486 | .iop_pin = xfs_qm_qoff_logitem_pin, |
509 | .iop_pin = (void(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_pin, | 487 | .iop_unpin = xfs_qm_qoff_logitem_unpin, |
510 | .iop_unpin = (void(*)(xfs_log_item_t*, int))xfs_qm_qoff_logitem_unpin, | 488 | .iop_trylock = xfs_qm_qoff_logitem_trylock, |
511 | .iop_trylock = (uint(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_trylock, | 489 | .iop_unlock = xfs_qm_qoff_logitem_unlock, |
512 | .iop_unlock = (void(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_unlock, | 490 | .iop_committed = xfs_qm_qoffend_logitem_committed, |
513 | .iop_committed = (xfs_lsn_t(*)(xfs_log_item_t*, xfs_lsn_t)) | 491 | .iop_push = xfs_qm_qoff_logitem_push, |
514 | xfs_qm_qoffend_logitem_committed, | 492 | .iop_committing = xfs_qm_qoff_logitem_committing |
515 | .iop_push = (void(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_push, | ||
516 | .iop_pushbuf = NULL, | ||
517 | .iop_committing = (void(*)(xfs_log_item_t*, xfs_lsn_t)) | ||
518 | xfs_qm_qoffend_logitem_committing | ||
519 | }; | 493 | }; |
520 | 494 | ||
521 | /* | 495 | /* |
522 | * This is the ops vector shared by all quotaoff-start log items. | 496 | * This is the ops vector shared by all quotaoff-start log items. |
523 | */ | 497 | */ |
524 | static struct xfs_item_ops xfs_qm_qoff_logitem_ops = { | 498 | static struct xfs_item_ops xfs_qm_qoff_logitem_ops = { |
525 | .iop_size = (uint(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_size, | 499 | .iop_size = xfs_qm_qoff_logitem_size, |
526 | .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) | 500 | .iop_format = xfs_qm_qoff_logitem_format, |
527 | xfs_qm_qoff_logitem_format, | 501 | .iop_pin = xfs_qm_qoff_logitem_pin, |
528 | .iop_pin = (void(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_pin, | 502 | .iop_unpin = xfs_qm_qoff_logitem_unpin, |
529 | .iop_unpin = (void(*)(xfs_log_item_t*, int))xfs_qm_qoff_logitem_unpin, | 503 | .iop_trylock = xfs_qm_qoff_logitem_trylock, |
530 | .iop_trylock = (uint(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_trylock, | 504 | .iop_unlock = xfs_qm_qoff_logitem_unlock, |
531 | .iop_unlock = (void(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_unlock, | 505 | .iop_committed = xfs_qm_qoff_logitem_committed, |
532 | .iop_committed = (xfs_lsn_t(*)(xfs_log_item_t*, xfs_lsn_t)) | 506 | .iop_push = xfs_qm_qoff_logitem_push, |
533 | xfs_qm_qoff_logitem_committed, | 507 | .iop_committing = xfs_qm_qoff_logitem_committing |
534 | .iop_push = (void(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_push, | ||
535 | .iop_pushbuf = NULL, | ||
536 | .iop_committing = (void(*)(xfs_log_item_t*, xfs_lsn_t)) | ||
537 | xfs_qm_qoff_logitem_committing | ||
538 | }; | 508 | }; |
539 | 509 | ||
540 | /* | 510 | /* |
541 | * Allocate and initialize an quotaoff item of the correct quota type(s). | 511 | * Allocate and initialize an quotaoff item of the correct quota type(s). |
542 | */ | 512 | */ |
543 | xfs_qoff_logitem_t * | 513 | struct xfs_qoff_logitem * |
544 | xfs_qm_qoff_logitem_init( | 514 | xfs_qm_qoff_logitem_init( |
545 | struct xfs_mount *mp, | 515 | struct xfs_mount *mp, |
546 | xfs_qoff_logitem_t *start, | 516 | struct xfs_qoff_logitem *start, |
547 | uint flags) | 517 | uint flags) |
548 | { | 518 | { |
549 | xfs_qoff_logitem_t *qf; | 519 | struct xfs_qoff_logitem *qf; |
550 | 520 | ||
551 | qf = (xfs_qoff_logitem_t*) kmem_zalloc(sizeof(xfs_qoff_logitem_t), KM_SLEEP); | 521 | qf = kmem_zalloc(sizeof(struct xfs_qoff_logitem), KM_SLEEP); |
552 | 522 | ||
553 | xfs_log_item_init(mp, &qf->qql_item, XFS_LI_QUOTAOFF, start ? | 523 | xfs_log_item_init(mp, &qf->qql_item, XFS_LI_QUOTAOFF, start ? |
554 | &xfs_qm_qoffend_logitem_ops : &xfs_qm_qoff_logitem_ops); | 524 | &xfs_qm_qoffend_logitem_ops : &xfs_qm_qoff_logitem_ops); |
@@ -556,5 +526,5 @@ xfs_qm_qoff_logitem_init( | |||
556 | qf->qql_format.qf_type = XFS_LI_QUOTAOFF; | 526 | qf->qql_format.qf_type = XFS_LI_QUOTAOFF; |
557 | qf->qql_format.qf_flags = flags; | 527 | qf->qql_format.qf_flags = flags; |
558 | qf->qql_start_lip = start; | 528 | qf->qql_start_lip = start; |
559 | return (qf); | 529 | return qf; |
560 | } | 530 | } |