aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_extfree_item.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-06-23 04:11:15 -0400
committerAlex Elder <aelder@sgi.com>2010-07-26 14:16:35 -0400
commit7bfa31d8e0f90b65ff23be94fca65ce261b43fc8 (patch)
treedbf7bfd8ce06baca8fd23aeac3c99fa73c07a8bb /fs/xfs/xfs_extfree_item.c
parent9412e3181c0ef82efc3d8e88d73e583ec10c34e9 (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/xfs_extfree_item.c')
-rw-r--r--fs/xfs/xfs_extfree_item.c226
1 files changed, 110 insertions, 116 deletions
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
index 6ac7e596c54c..61d83c64ed32 100644
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -32,18 +32,19 @@
32kmem_zone_t *xfs_efi_zone; 32kmem_zone_t *xfs_efi_zone;
33kmem_zone_t *xfs_efd_zone; 33kmem_zone_t *xfs_efd_zone;
34 34
35STATIC void xfs_efi_item_unlock(xfs_efi_log_item_t *); 35static inline struct xfs_efi_log_item *EFI_ITEM(struct xfs_log_item *lip)
36{
37 return container_of(lip, struct xfs_efi_log_item, efi_item);
38}
36 39
37void 40void
38xfs_efi_item_free(xfs_efi_log_item_t *efip) 41xfs_efi_item_free(
42 struct xfs_efi_log_item *efip)
39{ 43{
40 int nexts = efip->efi_format.efi_nextents; 44 if (efip->efi_format.efi_nextents > XFS_EFI_MAX_FAST_EXTENTS)
41
42 if (nexts > XFS_EFI_MAX_FAST_EXTENTS) {
43 kmem_free(efip); 45 kmem_free(efip);
44 } else { 46 else
45 kmem_zone_free(xfs_efi_zone, efip); 47 kmem_zone_free(xfs_efi_zone, efip);
46 }
47} 48}
48 49
49/* 50/*
@@ -51,9 +52,9 @@ xfs_efi_item_free(xfs_efi_log_item_t *efip)
51 * We only need 1 iovec for an efi item. It just logs the efi_log_format 52 * We only need 1 iovec for an efi item. It just logs the efi_log_format
52 * structure. 53 * structure.
53 */ 54 */
54/*ARGSUSED*/
55STATIC uint 55STATIC uint
56xfs_efi_item_size(xfs_efi_log_item_t *efip) 56xfs_efi_item_size(
57 struct xfs_log_item *lip)
57{ 58{
58 return 1; 59 return 1;
59} 60}
@@ -66,10 +67,12 @@ xfs_efi_item_size(xfs_efi_log_item_t *efip)
66 * slots in the efi item have been filled. 67 * slots in the efi item have been filled.
67 */ 68 */
68STATIC void 69STATIC void
69xfs_efi_item_format(xfs_efi_log_item_t *efip, 70xfs_efi_item_format(
70 xfs_log_iovec_t *log_vector) 71 struct xfs_log_item *lip,
72 struct xfs_log_iovec *log_vector)
71{ 73{
72 uint size; 74 struct xfs_efi_log_item *efip = EFI_ITEM(lip);
75 uint size;
73 76
74 ASSERT(efip->efi_next_extent == efip->efi_format.efi_nextents); 77 ASSERT(efip->efi_next_extent == efip->efi_format.efi_nextents);
75 78
@@ -79,7 +82,7 @@ xfs_efi_item_format(xfs_efi_log_item_t *efip,
79 size += (efip->efi_format.efi_nextents - 1) * sizeof(xfs_extent_t); 82 size += (efip->efi_format.efi_nextents - 1) * sizeof(xfs_extent_t);
80 efip->efi_format.efi_size = 1; 83 efip->efi_format.efi_size = 1;
81 84
82 log_vector->i_addr = (xfs_caddr_t)&(efip->efi_format); 85 log_vector->i_addr = (xfs_caddr_t)&efip->efi_format;
83 log_vector->i_len = size; 86 log_vector->i_len = size;
84 log_vector->i_type = XLOG_REG_TYPE_EFI_FORMAT; 87 log_vector->i_type = XLOG_REG_TYPE_EFI_FORMAT;
85 ASSERT(size >= sizeof(xfs_efi_log_format_t)); 88 ASSERT(size >= sizeof(xfs_efi_log_format_t));
@@ -89,14 +92,12 @@ xfs_efi_item_format(xfs_efi_log_item_t *efip,
89/* 92/*
90 * Pinning has no meaning for an efi item, so just return. 93 * Pinning has no meaning for an efi item, so just return.
91 */ 94 */
92/*ARGSUSED*/
93STATIC void 95STATIC void
94xfs_efi_item_pin(xfs_efi_log_item_t *efip) 96xfs_efi_item_pin(
97 struct xfs_log_item *lip)
95{ 98{
96 return;
97} 99}
98 100
99
100/* 101/*
101 * While EFIs cannot really be pinned, the unpin operation is the 102 * While EFIs cannot really be pinned, the unpin operation is the
102 * last place at which the EFI is manipulated during a transaction. 103 * last place at which the EFI is manipulated during a transaction.
@@ -104,14 +105,15 @@ xfs_efi_item_pin(xfs_efi_log_item_t *efip)
104 * free the EFI. 105 * free the EFI.
105 */ 106 */
106STATIC void 107STATIC void
107xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int remove) 108xfs_efi_item_unpin(
109 struct xfs_log_item *lip,
110 int remove)
108{ 111{
109 struct xfs_ail *ailp = efip->efi_item.li_ailp; 112 struct xfs_efi_log_item *efip = EFI_ITEM(lip);
113 struct xfs_ail *ailp = lip->li_ailp;
110 114
111 spin_lock(&ailp->xa_lock); 115 spin_lock(&ailp->xa_lock);
112 if (efip->efi_flags & XFS_EFI_CANCELED) { 116 if (efip->efi_flags & XFS_EFI_CANCELED) {
113 struct xfs_log_item *lip = &efip->efi_item;
114
115 if (remove) 117 if (remove)
116 xfs_trans_del_item(lip); 118 xfs_trans_del_item(lip);
117 119
@@ -131,9 +133,9 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int remove)
131 * XFS_ITEM_PINNED so that the caller will eventually flush the log. 133 * XFS_ITEM_PINNED so that the caller will eventually flush the log.
132 * This should help in getting the EFI out of the AIL. 134 * This should help in getting the EFI out of the AIL.
133 */ 135 */
134/*ARGSUSED*/
135STATIC uint 136STATIC uint
136xfs_efi_item_trylock(xfs_efi_log_item_t *efip) 137xfs_efi_item_trylock(
138 struct xfs_log_item *lip)
137{ 139{
138 return XFS_ITEM_PINNED; 140 return XFS_ITEM_PINNED;
139} 141}
@@ -141,13 +143,12 @@ xfs_efi_item_trylock(xfs_efi_log_item_t *efip)
141/* 143/*
142 * Efi items have no locking, so just return. 144 * Efi items have no locking, so just return.
143 */ 145 */
144/*ARGSUSED*/
145STATIC void 146STATIC void
146xfs_efi_item_unlock(xfs_efi_log_item_t *efip) 147xfs_efi_item_unlock(
148 struct xfs_log_item *lip)
147{ 149{
148 if (efip->efi_item.li_flags & XFS_LI_ABORTED) 150 if (lip->li_flags & XFS_LI_ABORTED)
149 xfs_efi_item_free(efip); 151 xfs_efi_item_free(EFI_ITEM(lip));
150 return;
151} 152}
152 153
153/* 154/*
@@ -156,9 +157,10 @@ xfs_efi_item_unlock(xfs_efi_log_item_t *efip)
156 * flag is not paid any attention here. Checking for that is delayed 157 * flag is not paid any attention here. Checking for that is delayed
157 * until the EFI is unpinned. 158 * until the EFI is unpinned.
158 */ 159 */
159/*ARGSUSED*/
160STATIC xfs_lsn_t 160STATIC xfs_lsn_t
161xfs_efi_item_committed(xfs_efi_log_item_t *efip, xfs_lsn_t lsn) 161xfs_efi_item_committed(
162 struct xfs_log_item *lip,
163 xfs_lsn_t lsn)
162{ 164{
163 return lsn; 165 return lsn;
164} 166}
@@ -168,11 +170,10 @@ xfs_efi_item_committed(xfs_efi_log_item_t *efip, xfs_lsn_t lsn)
168 * stuck waiting for all of its corresponding efd items to be 170 * stuck waiting for all of its corresponding efd items to be
169 * committed to disk. 171 * committed to disk.
170 */ 172 */
171/*ARGSUSED*/
172STATIC void 173STATIC void
173xfs_efi_item_push(xfs_efi_log_item_t *efip) 174xfs_efi_item_push(
175 struct xfs_log_item *lip)
174{ 176{
175 return;
176} 177}
177 178
178/* 179/*
@@ -182,59 +183,55 @@ xfs_efi_item_push(xfs_efi_log_item_t *efip)
182 * example, for inodes, the inode is locked throughout the extent freeing 183 * example, for inodes, the inode is locked throughout the extent freeing
183 * so the dependency should be recorded there. 184 * so the dependency should be recorded there.
184 */ 185 */
185/*ARGSUSED*/
186STATIC void 186STATIC void
187xfs_efi_item_committing(xfs_efi_log_item_t *efip, xfs_lsn_t lsn) 187xfs_efi_item_committing(
188 struct xfs_log_item *lip,
189 xfs_lsn_t lsn)
188{ 190{
189 return;
190} 191}
191 192
192/* 193/*
193 * This is the ops vector shared by all efi log items. 194 * This is the ops vector shared by all efi log items.
194 */ 195 */
195static struct xfs_item_ops xfs_efi_item_ops = { 196static struct xfs_item_ops xfs_efi_item_ops = {
196 .iop_size = (uint(*)(xfs_log_item_t*))xfs_efi_item_size, 197 .iop_size = xfs_efi_item_size,
197 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 198 .iop_format = xfs_efi_item_format,
198 xfs_efi_item_format, 199 .iop_pin = xfs_efi_item_pin,
199 .iop_pin = (void(*)(xfs_log_item_t*))xfs_efi_item_pin, 200 .iop_unpin = xfs_efi_item_unpin,
200 .iop_unpin = (void(*)(xfs_log_item_t*, int))xfs_efi_item_unpin, 201 .iop_trylock = xfs_efi_item_trylock,
201 .iop_trylock = (uint(*)(xfs_log_item_t*))xfs_efi_item_trylock, 202 .iop_unlock = xfs_efi_item_unlock,
202 .iop_unlock = (void(*)(xfs_log_item_t*))xfs_efi_item_unlock, 203 .iop_committed = xfs_efi_item_committed,
203 .iop_committed = (xfs_lsn_t(*)(xfs_log_item_t*, xfs_lsn_t)) 204 .iop_push = xfs_efi_item_push,
204 xfs_efi_item_committed, 205 .iop_committing = xfs_efi_item_committing
205 .iop_push = (void(*)(xfs_log_item_t*))xfs_efi_item_push,
206 .iop_pushbuf = NULL,
207 .iop_committing = (void(*)(xfs_log_item_t*, xfs_lsn_t))
208 xfs_efi_item_committing
209}; 206};
210 207
211 208
212/* 209/*
213 * Allocate and initialize an efi item with the given number of extents. 210 * Allocate and initialize an efi item with the given number of extents.
214 */ 211 */
215xfs_efi_log_item_t * 212struct xfs_efi_log_item *
216xfs_efi_init(xfs_mount_t *mp, 213xfs_efi_init(
217 uint nextents) 214 struct xfs_mount *mp,
215 uint nextents)
218 216
219{ 217{
220 xfs_efi_log_item_t *efip; 218 struct xfs_efi_log_item *efip;
221 uint size; 219 uint size;
222 220
223 ASSERT(nextents > 0); 221 ASSERT(nextents > 0);
224 if (nextents > XFS_EFI_MAX_FAST_EXTENTS) { 222 if (nextents > XFS_EFI_MAX_FAST_EXTENTS) {
225 size = (uint)(sizeof(xfs_efi_log_item_t) + 223 size = (uint)(sizeof(xfs_efi_log_item_t) +
226 ((nextents - 1) * sizeof(xfs_extent_t))); 224 ((nextents - 1) * sizeof(xfs_extent_t)));
227 efip = (xfs_efi_log_item_t*)kmem_zalloc(size, KM_SLEEP); 225 efip = kmem_zalloc(size, KM_SLEEP);
228 } else { 226 } else {
229 efip = (xfs_efi_log_item_t*)kmem_zone_zalloc(xfs_efi_zone, 227 efip = kmem_zone_zalloc(xfs_efi_zone, KM_SLEEP);
230 KM_SLEEP);
231 } 228 }
232 229
233 xfs_log_item_init(mp, &efip->efi_item, XFS_LI_EFI, &xfs_efi_item_ops); 230 xfs_log_item_init(mp, &efip->efi_item, XFS_LI_EFI, &xfs_efi_item_ops);
234 efip->efi_format.efi_nextents = nextents; 231 efip->efi_format.efi_nextents = nextents;
235 efip->efi_format.efi_id = (__psint_t)(void*)efip; 232 efip->efi_format.efi_id = (__psint_t)(void*)efip;
236 233
237 return (efip); 234 return efip;
238} 235}
239 236
240/* 237/*
@@ -327,16 +324,18 @@ xfs_efi_release(xfs_efi_log_item_t *efip,
327 } 324 }
328} 325}
329 326
330STATIC void 327static inline struct xfs_efd_log_item *EFD_ITEM(struct xfs_log_item *lip)
331xfs_efd_item_free(xfs_efd_log_item_t *efdp)
332{ 328{
333 int nexts = efdp->efd_format.efd_nextents; 329 return container_of(lip, struct xfs_efd_log_item, efd_item);
330}
334 331
335 if (nexts > XFS_EFD_MAX_FAST_EXTENTS) { 332STATIC void
333xfs_efd_item_free(struct xfs_efd_log_item *efdp)
334{
335 if (efdp->efd_format.efd_nextents > XFS_EFD_MAX_FAST_EXTENTS)
336 kmem_free(efdp); 336 kmem_free(efdp);
337 } else { 337 else
338 kmem_zone_free(xfs_efd_zone, efdp); 338 kmem_zone_free(xfs_efd_zone, efdp);
339 }
340} 339}
341 340
342/* 341/*
@@ -344,9 +343,9 @@ xfs_efd_item_free(xfs_efd_log_item_t *efdp)
344 * We only need 1 iovec for an efd item. It just logs the efd_log_format 343 * We only need 1 iovec for an efd item. It just logs the efd_log_format
345 * structure. 344 * structure.
346 */ 345 */
347/*ARGSUSED*/
348STATIC uint 346STATIC uint
349xfs_efd_item_size(xfs_efd_log_item_t *efdp) 347xfs_efd_item_size(
348 struct xfs_log_item *lip)
350{ 349{
351 return 1; 350 return 1;
352} 351}
@@ -359,10 +358,12 @@ xfs_efd_item_size(xfs_efd_log_item_t *efdp)
359 * slots in the efd item have been filled. 358 * slots in the efd item have been filled.
360 */ 359 */
361STATIC void 360STATIC void
362xfs_efd_item_format(xfs_efd_log_item_t *efdp, 361xfs_efd_item_format(
363 xfs_log_iovec_t *log_vector) 362 struct xfs_log_item *lip,
363 struct xfs_log_iovec *log_vector)
364{ 364{
365 uint size; 365 struct xfs_efd_log_item *efdp = EFD_ITEM(lip);
366 uint size;
366 367
367 ASSERT(efdp->efd_next_extent == efdp->efd_format.efd_nextents); 368 ASSERT(efdp->efd_next_extent == efdp->efd_format.efd_nextents);
368 369
@@ -372,41 +373,38 @@ xfs_efd_item_format(xfs_efd_log_item_t *efdp,
372 size += (efdp->efd_format.efd_nextents - 1) * sizeof(xfs_extent_t); 373 size += (efdp->efd_format.efd_nextents - 1) * sizeof(xfs_extent_t);
373 efdp->efd_format.efd_size = 1; 374 efdp->efd_format.efd_size = 1;
374 375
375 log_vector->i_addr = (xfs_caddr_t)&(efdp->efd_format); 376 log_vector->i_addr = (xfs_caddr_t)&efdp->efd_format;
376 log_vector->i_len = size; 377 log_vector->i_len = size;
377 log_vector->i_type = XLOG_REG_TYPE_EFD_FORMAT; 378 log_vector->i_type = XLOG_REG_TYPE_EFD_FORMAT;
378 ASSERT(size >= sizeof(xfs_efd_log_format_t)); 379 ASSERT(size >= sizeof(xfs_efd_log_format_t));
379} 380}
380 381
381
382/* 382/*
383 * Pinning has no meaning for an efd item, so just return. 383 * Pinning has no meaning for an efd item, so just return.
384 */ 384 */
385/*ARGSUSED*/
386STATIC void 385STATIC void
387xfs_efd_item_pin(xfs_efd_log_item_t *efdp) 386xfs_efd_item_pin(
387 struct xfs_log_item *lip)
388{ 388{
389 return;
390} 389}
391 390
392
393/* 391/*
394 * Since pinning has no meaning for an efd item, unpinning does 392 * Since pinning has no meaning for an efd item, unpinning does
395 * not either. 393 * not either.
396 */ 394 */
397/*ARGSUSED*/
398STATIC void 395STATIC void
399xfs_efd_item_unpin(xfs_efd_log_item_t *efdp, int remove) 396xfs_efd_item_unpin(
397 struct xfs_log_item *lip,
398 int remove)
400{ 399{
401 return;
402} 400}
403 401
404/* 402/*
405 * Efd items have no locking, so just return success. 403 * Efd items have no locking, so just return success.
406 */ 404 */
407/*ARGSUSED*/
408STATIC uint 405STATIC uint
409xfs_efd_item_trylock(xfs_efd_log_item_t *efdp) 406xfs_efd_item_trylock(
407 struct xfs_log_item *lip)
410{ 408{
411 return XFS_ITEM_LOCKED; 409 return XFS_ITEM_LOCKED;
412} 410}
@@ -415,13 +413,12 @@ xfs_efd_item_trylock(xfs_efd_log_item_t *efdp)
415 * Efd items have no locking or pushing, so return failure 413 * Efd items have no locking or pushing, so return failure
416 * so that the caller doesn't bother with us. 414 * so that the caller doesn't bother with us.
417 */ 415 */
418/*ARGSUSED*/
419STATIC void 416STATIC void
420xfs_efd_item_unlock(xfs_efd_log_item_t *efdp) 417xfs_efd_item_unlock(
418 struct xfs_log_item *lip)
421{ 419{
422 if (efdp->efd_item.li_flags & XFS_LI_ABORTED) 420 if (lip->li_flags & XFS_LI_ABORTED)
423 xfs_efd_item_free(efdp); 421 xfs_efd_item_free(EFD_ITEM(lip));
424 return;
425} 422}
426 423
427/* 424/*
@@ -431,15 +428,18 @@ xfs_efd_item_unlock(xfs_efd_log_item_t *efdp)
431 * return -1 to keep the transaction code from further referencing 428 * return -1 to keep the transaction code from further referencing
432 * this item. 429 * this item.
433 */ 430 */
434/*ARGSUSED*/
435STATIC xfs_lsn_t 431STATIC xfs_lsn_t
436xfs_efd_item_committed(xfs_efd_log_item_t *efdp, xfs_lsn_t lsn) 432xfs_efd_item_committed(
433 struct xfs_log_item *lip,
434 xfs_lsn_t lsn)
437{ 435{
436 struct xfs_efd_log_item *efdp = EFD_ITEM(lip);
437
438 /* 438 /*
439 * If we got a log I/O error, it's always the case that the LR with the 439 * If we got a log I/O error, it's always the case that the LR with the
440 * EFI got unpinned and freed before the EFD got aborted. 440 * EFI got unpinned and freed before the EFD got aborted.
441 */ 441 */
442 if ((efdp->efd_item.li_flags & XFS_LI_ABORTED) == 0) 442 if (!(lip->li_flags & XFS_LI_ABORTED))
443 xfs_efi_release(efdp->efd_efip, efdp->efd_format.efd_nextents); 443 xfs_efi_release(efdp->efd_efip, efdp->efd_format.efd_nextents);
444 444
445 xfs_efd_item_free(efdp); 445 xfs_efd_item_free(efdp);
@@ -450,11 +450,10 @@ xfs_efd_item_committed(xfs_efd_log_item_t *efdp, xfs_lsn_t lsn)
450 * There isn't much you can do to push on an efd item. It is simply 450 * There isn't much you can do to push on an efd item. It is simply
451 * stuck waiting for the log to be flushed to disk. 451 * stuck waiting for the log to be flushed to disk.
452 */ 452 */
453/*ARGSUSED*/
454STATIC void 453STATIC void
455xfs_efd_item_push(xfs_efd_log_item_t *efdp) 454xfs_efd_item_push(
455 struct xfs_log_item *lip)
456{ 456{
457 return;
458} 457}
459 458
460/* 459/*
@@ -464,53 +463,48 @@ xfs_efd_item_push(xfs_efd_log_item_t *efdp)
464 * example, for inodes, the inode is locked throughout the extent freeing 463 * example, for inodes, the inode is locked throughout the extent freeing
465 * so the dependency should be recorded there. 464 * so the dependency should be recorded there.
466 */ 465 */
467/*ARGSUSED*/
468STATIC void 466STATIC void
469xfs_efd_item_committing(xfs_efd_log_item_t *efip, xfs_lsn_t lsn) 467xfs_efd_item_committing(
468 struct xfs_log_item *lip,
469 xfs_lsn_t lsn)
470{ 470{
471 return;
472} 471}
473 472
474/* 473/*
475 * This is the ops vector shared by all efd log items. 474 * This is the ops vector shared by all efd log items.
476 */ 475 */
477static struct xfs_item_ops xfs_efd_item_ops = { 476static struct xfs_item_ops xfs_efd_item_ops = {
478 .iop_size = (uint(*)(xfs_log_item_t*))xfs_efd_item_size, 477 .iop_size = xfs_efd_item_size,
479 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 478 .iop_format = xfs_efd_item_format,
480 xfs_efd_item_format, 479 .iop_pin = xfs_efd_item_pin,
481 .iop_pin = (void(*)(xfs_log_item_t*))xfs_efd_item_pin, 480 .iop_unpin = xfs_efd_item_unpin,
482 .iop_unpin = (void(*)(xfs_log_item_t*, int))xfs_efd_item_unpin, 481 .iop_trylock = xfs_efd_item_trylock,
483 .iop_trylock = (uint(*)(xfs_log_item_t*))xfs_efd_item_trylock, 482 .iop_unlock = xfs_efd_item_unlock,
484 .iop_unlock = (void(*)(xfs_log_item_t*))xfs_efd_item_unlock, 483 .iop_committed = xfs_efd_item_committed,
485 .iop_committed = (xfs_lsn_t(*)(xfs_log_item_t*, xfs_lsn_t)) 484 .iop_push = xfs_efd_item_push,
486 xfs_efd_item_committed, 485 .iop_committing = xfs_efd_item_committing
487 .iop_push = (void(*)(xfs_log_item_t*))xfs_efd_item_push,
488 .iop_pushbuf = NULL,
489 .iop_committing = (void(*)(xfs_log_item_t*, xfs_lsn_t))
490 xfs_efd_item_committing
491}; 486};
492 487
493
494/* 488/*
495 * Allocate and initialize an efd item with the given number of extents. 489 * Allocate and initialize an efd item with the given number of extents.
496 */ 490 */
497xfs_efd_log_item_t * 491struct xfs_efd_log_item *
498xfs_efd_init(xfs_mount_t *mp, 492xfs_efd_init(
499 xfs_efi_log_item_t *efip, 493 struct xfs_mount *mp,
500 uint nextents) 494 struct xfs_efi_log_item *efip,
495 uint nextents)
501 496
502{ 497{
503 xfs_efd_log_item_t *efdp; 498 struct xfs_efd_log_item *efdp;
504 uint size; 499 uint size;
505 500
506 ASSERT(nextents > 0); 501 ASSERT(nextents > 0);
507 if (nextents > XFS_EFD_MAX_FAST_EXTENTS) { 502 if (nextents > XFS_EFD_MAX_FAST_EXTENTS) {
508 size = (uint)(sizeof(xfs_efd_log_item_t) + 503 size = (uint)(sizeof(xfs_efd_log_item_t) +
509 ((nextents - 1) * sizeof(xfs_extent_t))); 504 ((nextents - 1) * sizeof(xfs_extent_t)));
510 efdp = (xfs_efd_log_item_t*)kmem_zalloc(size, KM_SLEEP); 505 efdp = kmem_zalloc(size, KM_SLEEP);
511 } else { 506 } else {
512 efdp = (xfs_efd_log_item_t*)kmem_zone_zalloc(xfs_efd_zone, 507 efdp = kmem_zone_zalloc(xfs_efd_zone, KM_SLEEP);
513 KM_SLEEP);
514 } 508 }
515 509
516 xfs_log_item_init(mp, &efdp->efd_item, XFS_LI_EFD, &xfs_efd_item_ops); 510 xfs_log_item_init(mp, &efdp->efd_item, XFS_LI_EFD, &xfs_efd_item_ops);
@@ -518,5 +512,5 @@ xfs_efd_init(xfs_mount_t *mp,
518 efdp->efd_format.efd_nextents = nextents; 512 efdp->efd_format.efd_nextents = nextents;
519 efdp->efd_format.efd_efi_id = efip->efi_format.efi_id; 513 efdp->efd_format.efd_efi_id = efip->efi_format.efi_id;
520 514
521 return (efdp); 515 return efdp;
522} 516}