blob: f48cc9a7cd5a919f40d2e8dcf76f6aad61f08085 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#include "xfs.h"
Nathan Scotta844f452005-11-02 14:38:42 +110033#include "xfs_fs.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include "xfs_types.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#include "xfs_log.h"
Nathan Scotta844f452005-11-02 14:38:42 +110036#include "xfs_inum.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070037#include "xfs_trans.h"
38#include "xfs_buf_item.h"
39#include "xfs_sb.h"
40#include "xfs_dir.h"
41#include "xfs_dmapi.h"
42#include "xfs_mount.h"
43#include "xfs_trans_priv.h"
44#include "xfs_extfree_item.h"
45
46
47kmem_zone_t *xfs_efi_zone;
48kmem_zone_t *xfs_efd_zone;
49
50STATIC void xfs_efi_item_unlock(xfs_efi_log_item_t *);
51STATIC void xfs_efi_item_abort(xfs_efi_log_item_t *);
52STATIC void xfs_efd_item_abort(xfs_efd_log_item_t *);
53
54
Christoph Hellwig7d795ca2005-06-21 15:41:19 +100055void
56xfs_efi_item_free(xfs_efi_log_item_t *efip)
57{
58 int nexts = efip->efi_format.efi_nextents;
59
60 if (nexts > XFS_EFI_MAX_FAST_EXTENTS) {
61 kmem_free(efip, sizeof(xfs_efi_log_item_t) +
62 (nexts - 1) * sizeof(xfs_extent_t));
63 } else {
64 kmem_zone_free(xfs_efi_zone, efip);
65 }
66}
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
68/*
69 * This returns the number of iovecs needed to log the given efi item.
70 * We only need 1 iovec for an efi item. It just logs the efi_log_format
71 * structure.
72 */
73/*ARGSUSED*/
74STATIC uint
75xfs_efi_item_size(xfs_efi_log_item_t *efip)
76{
77 return 1;
78}
79
80/*
81 * This is called to fill in the vector of log iovecs for the
82 * given efi log item. We use only 1 iovec, and we point that
83 * at the efi_log_format structure embedded in the efi item.
84 * It is at this point that we assert that all of the extent
85 * slots in the efi item have been filled.
86 */
87STATIC void
88xfs_efi_item_format(xfs_efi_log_item_t *efip,
89 xfs_log_iovec_t *log_vector)
90{
91 uint size;
92
93 ASSERT(efip->efi_next_extent == efip->efi_format.efi_nextents);
94
95 efip->efi_format.efi_type = XFS_LI_EFI;
96
97 size = sizeof(xfs_efi_log_format_t);
98 size += (efip->efi_format.efi_nextents - 1) * sizeof(xfs_extent_t);
99 efip->efi_format.efi_size = 1;
100
101 log_vector->i_addr = (xfs_caddr_t)&(efip->efi_format);
102 log_vector->i_len = size;
Tim Shimmin7e9c6392005-09-02 16:42:05 +1000103 XLOG_VEC_SET_TYPE(log_vector, XLOG_REG_TYPE_EFI_FORMAT);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104 ASSERT(size >= sizeof(xfs_efi_log_format_t));
105}
106
107
108/*
109 * Pinning has no meaning for an efi item, so just return.
110 */
111/*ARGSUSED*/
112STATIC void
113xfs_efi_item_pin(xfs_efi_log_item_t *efip)
114{
115 return;
116}
117
118
119/*
120 * While EFIs cannot really be pinned, the unpin operation is the
121 * last place at which the EFI is manipulated during a transaction.
122 * Here we coordinate with xfs_efi_cancel() to determine who gets to
123 * free the EFI.
124 */
125/*ARGSUSED*/
126STATIC void
127xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
128{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129 xfs_mount_t *mp;
130 SPLDECL(s);
131
132 mp = efip->efi_item.li_mountp;
133 AIL_LOCK(mp, s);
134 if (efip->efi_flags & XFS_EFI_CANCELED) {
135 /*
136 * xfs_trans_delete_ail() drops the AIL lock.
137 */
138 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s);
Christoph Hellwig7d795ca2005-06-21 15:41:19 +1000139 xfs_efi_item_free(efip);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140 } else {
141 efip->efi_flags |= XFS_EFI_COMMITTED;
142 AIL_UNLOCK(mp, s);
143 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144}
145
146/*
147 * like unpin only we have to also clear the xaction descriptor
148 * pointing the log item if we free the item. This routine duplicates
149 * unpin because efi_flags is protected by the AIL lock. Freeing
150 * the descriptor and then calling unpin would force us to drop the AIL
151 * lock which would open up a race condition.
152 */
153STATIC void
154xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp)
155{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156 xfs_mount_t *mp;
157 xfs_log_item_desc_t *lidp;
158 SPLDECL(s);
159
160 mp = efip->efi_item.li_mountp;
161 AIL_LOCK(mp, s);
162 if (efip->efi_flags & XFS_EFI_CANCELED) {
163 /*
164 * free the xaction descriptor pointing to this item
165 */
166 lidp = xfs_trans_find_item(tp, (xfs_log_item_t *) efip);
167 xfs_trans_free_item(tp, lidp);
168 /*
169 * pull the item off the AIL.
170 * xfs_trans_delete_ail() drops the AIL lock.
171 */
172 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s);
Christoph Hellwig7d795ca2005-06-21 15:41:19 +1000173 xfs_efi_item_free(efip);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174 } else {
175 efip->efi_flags |= XFS_EFI_COMMITTED;
176 AIL_UNLOCK(mp, s);
177 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178}
179
180/*
181 * Efi items have no locking or pushing. However, since EFIs are
182 * pulled from the AIL when their corresponding EFDs are committed
183 * to disk, their situation is very similar to being pinned. Return
184 * XFS_ITEM_PINNED so that the caller will eventually flush the log.
185 * This should help in getting the EFI out of the AIL.
186 */
187/*ARGSUSED*/
188STATIC uint
189xfs_efi_item_trylock(xfs_efi_log_item_t *efip)
190{
191 return XFS_ITEM_PINNED;
192}
193
194/*
195 * Efi items have no locking, so just return.
196 */
197/*ARGSUSED*/
198STATIC void
199xfs_efi_item_unlock(xfs_efi_log_item_t *efip)
200{
201 if (efip->efi_item.li_flags & XFS_LI_ABORTED)
202 xfs_efi_item_abort(efip);
203 return;
204}
205
206/*
207 * The EFI is logged only once and cannot be moved in the log, so
208 * simply return the lsn at which it's been logged. The canceled
209 * flag is not paid any attention here. Checking for that is delayed
210 * until the EFI is unpinned.
211 */
212/*ARGSUSED*/
213STATIC xfs_lsn_t
214xfs_efi_item_committed(xfs_efi_log_item_t *efip, xfs_lsn_t lsn)
215{
216 return lsn;
217}
218
219/*
220 * This is called when the transaction logging the EFI is aborted.
221 * Free up the EFI and return. No need to clean up the slot for
222 * the item in the transaction. That was done by the unpin code
223 * which is called prior to this routine in the abort/fs-shutdown path.
224 */
225STATIC void
226xfs_efi_item_abort(xfs_efi_log_item_t *efip)
227{
Christoph Hellwig7d795ca2005-06-21 15:41:19 +1000228 xfs_efi_item_free(efip);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229}
230
231/*
232 * There isn't much you can do to push on an efi item. It is simply
233 * stuck waiting for all of its corresponding efd items to be
234 * committed to disk.
235 */
236/*ARGSUSED*/
237STATIC void
238xfs_efi_item_push(xfs_efi_log_item_t *efip)
239{
240 return;
241}
242
243/*
244 * The EFI dependency tracking op doesn't do squat. It can't because
245 * it doesn't know where the free extent is coming from. The dependency
246 * tracking has to be handled by the "enclosing" metadata object. For
247 * example, for inodes, the inode is locked throughout the extent freeing
248 * so the dependency should be recorded there.
249 */
250/*ARGSUSED*/
251STATIC void
252xfs_efi_item_committing(xfs_efi_log_item_t *efip, xfs_lsn_t lsn)
253{
254 return;
255}
256
257/*
258 * This is the ops vector shared by all efi log items.
259 */
Christoph Hellwigba0f32d2005-06-21 15:36:52 +1000260STATIC struct xfs_item_ops xfs_efi_item_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261 .iop_size = (uint(*)(xfs_log_item_t*))xfs_efi_item_size,
262 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*))
263 xfs_efi_item_format,
264 .iop_pin = (void(*)(xfs_log_item_t*))xfs_efi_item_pin,
265 .iop_unpin = (void(*)(xfs_log_item_t*, int))xfs_efi_item_unpin,
266 .iop_unpin_remove = (void(*)(xfs_log_item_t*, xfs_trans_t *))
267 xfs_efi_item_unpin_remove,
268 .iop_trylock = (uint(*)(xfs_log_item_t*))xfs_efi_item_trylock,
269 .iop_unlock = (void(*)(xfs_log_item_t*))xfs_efi_item_unlock,
270 .iop_committed = (xfs_lsn_t(*)(xfs_log_item_t*, xfs_lsn_t))
271 xfs_efi_item_committed,
272 .iop_push = (void(*)(xfs_log_item_t*))xfs_efi_item_push,
273 .iop_abort = (void(*)(xfs_log_item_t*))xfs_efi_item_abort,
274 .iop_pushbuf = NULL,
275 .iop_committing = (void(*)(xfs_log_item_t*, xfs_lsn_t))
276 xfs_efi_item_committing
277};
278
279
280/*
281 * Allocate and initialize an efi item with the given number of extents.
282 */
283xfs_efi_log_item_t *
284xfs_efi_init(xfs_mount_t *mp,
285 uint nextents)
286
287{
288 xfs_efi_log_item_t *efip;
289 uint size;
290
291 ASSERT(nextents > 0);
292 if (nextents > XFS_EFI_MAX_FAST_EXTENTS) {
293 size = (uint)(sizeof(xfs_efi_log_item_t) +
294 ((nextents - 1) * sizeof(xfs_extent_t)));
295 efip = (xfs_efi_log_item_t*)kmem_zalloc(size, KM_SLEEP);
296 } else {
297 efip = (xfs_efi_log_item_t*)kmem_zone_zalloc(xfs_efi_zone,
298 KM_SLEEP);
299 }
300
301 efip->efi_item.li_type = XFS_LI_EFI;
302 efip->efi_item.li_ops = &xfs_efi_item_ops;
303 efip->efi_item.li_mountp = mp;
304 efip->efi_format.efi_nextents = nextents;
305 efip->efi_format.efi_id = (__psint_t)(void*)efip;
306
307 return (efip);
308}
309
310/*
311 * This is called by the efd item code below to release references to
312 * the given efi item. Each efd calls this with the number of
313 * extents that it has logged, and when the sum of these reaches
314 * the total number of extents logged by this efi item we can free
315 * the efi item.
316 *
317 * Freeing the efi item requires that we remove it from the AIL.
318 * We'll use the AIL lock to protect our counters as well as
319 * the removal from the AIL.
320 */
321void
322xfs_efi_release(xfs_efi_log_item_t *efip,
323 uint nextents)
324{
325 xfs_mount_t *mp;
326 int extents_left;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327 SPLDECL(s);
328
329 mp = efip->efi_item.li_mountp;
330 ASSERT(efip->efi_next_extent > 0);
331 ASSERT(efip->efi_flags & XFS_EFI_COMMITTED);
332
333 AIL_LOCK(mp, s);
334 ASSERT(efip->efi_next_extent >= nextents);
335 efip->efi_next_extent -= nextents;
336 extents_left = efip->efi_next_extent;
337 if (extents_left == 0) {
338 /*
339 * xfs_trans_delete_ail() drops the AIL lock.
340 */
341 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s);
Christoph Hellwig7d795ca2005-06-21 15:41:19 +1000342 xfs_efi_item_free(efip);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343 } else {
344 AIL_UNLOCK(mp, s);
345 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346}
347
348/*
349 * This is called when the transaction that should be committing the
350 * EFD corresponding to the given EFI is aborted. The committed and
351 * canceled flags are used to coordinate the freeing of the EFI and
352 * the references by the transaction that committed it.
353 */
354STATIC void
355xfs_efi_cancel(
356 xfs_efi_log_item_t *efip)
357{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358 xfs_mount_t *mp;
359 SPLDECL(s);
360
361 mp = efip->efi_item.li_mountp;
362 AIL_LOCK(mp, s);
363 if (efip->efi_flags & XFS_EFI_COMMITTED) {
364 /*
365 * xfs_trans_delete_ail() drops the AIL lock.
366 */
367 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s);
Christoph Hellwig7d795ca2005-06-21 15:41:19 +1000368 xfs_efi_item_free(efip);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369 } else {
370 efip->efi_flags |= XFS_EFI_CANCELED;
371 AIL_UNLOCK(mp, s);
372 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373}
374
Christoph Hellwig7d795ca2005-06-21 15:41:19 +1000375STATIC void
376xfs_efd_item_free(xfs_efd_log_item_t *efdp)
377{
378 int nexts = efdp->efd_format.efd_nextents;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379
Christoph Hellwig7d795ca2005-06-21 15:41:19 +1000380 if (nexts > XFS_EFD_MAX_FAST_EXTENTS) {
381 kmem_free(efdp, sizeof(xfs_efd_log_item_t) +
382 (nexts - 1) * sizeof(xfs_extent_t));
383 } else {
384 kmem_zone_free(xfs_efd_zone, efdp);
385 }
386}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387
388/*
389 * This returns the number of iovecs needed to log the given efd item.
390 * We only need 1 iovec for an efd item. It just logs the efd_log_format
391 * structure.
392 */
393/*ARGSUSED*/
394STATIC uint
395xfs_efd_item_size(xfs_efd_log_item_t *efdp)
396{
397 return 1;
398}
399
400/*
401 * This is called to fill in the vector of log iovecs for the
402 * given efd log item. We use only 1 iovec, and we point that
403 * at the efd_log_format structure embedded in the efd item.
404 * It is at this point that we assert that all of the extent
405 * slots in the efd item have been filled.
406 */
407STATIC void
408xfs_efd_item_format(xfs_efd_log_item_t *efdp,
409 xfs_log_iovec_t *log_vector)
410{
411 uint size;
412
413 ASSERT(efdp->efd_next_extent == efdp->efd_format.efd_nextents);
414
415 efdp->efd_format.efd_type = XFS_LI_EFD;
416
417 size = sizeof(xfs_efd_log_format_t);
418 size += (efdp->efd_format.efd_nextents - 1) * sizeof(xfs_extent_t);
419 efdp->efd_format.efd_size = 1;
420
421 log_vector->i_addr = (xfs_caddr_t)&(efdp->efd_format);
422 log_vector->i_len = size;
Tim Shimmin7e9c6392005-09-02 16:42:05 +1000423 XLOG_VEC_SET_TYPE(log_vector, XLOG_REG_TYPE_EFD_FORMAT);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 ASSERT(size >= sizeof(xfs_efd_log_format_t));
425}
426
427
428/*
429 * Pinning has no meaning for an efd item, so just return.
430 */
431/*ARGSUSED*/
432STATIC void
433xfs_efd_item_pin(xfs_efd_log_item_t *efdp)
434{
435 return;
436}
437
438
439/*
440 * Since pinning has no meaning for an efd item, unpinning does
441 * not either.
442 */
443/*ARGSUSED*/
444STATIC void
445xfs_efd_item_unpin(xfs_efd_log_item_t *efdp, int stale)
446{
447 return;
448}
449
450/*ARGSUSED*/
451STATIC void
452xfs_efd_item_unpin_remove(xfs_efd_log_item_t *efdp, xfs_trans_t *tp)
453{
454 return;
455}
456
457/*
458 * Efd items have no locking, so just return success.
459 */
460/*ARGSUSED*/
461STATIC uint
462xfs_efd_item_trylock(xfs_efd_log_item_t *efdp)
463{
464 return XFS_ITEM_LOCKED;
465}
466
467/*
468 * Efd items have no locking or pushing, so return failure
469 * so that the caller doesn't bother with us.
470 */
471/*ARGSUSED*/
472STATIC void
473xfs_efd_item_unlock(xfs_efd_log_item_t *efdp)
474{
475 if (efdp->efd_item.li_flags & XFS_LI_ABORTED)
476 xfs_efd_item_abort(efdp);
477 return;
478}
479
480/*
481 * When the efd item is committed to disk, all we need to do
482 * is delete our reference to our partner efi item and then
483 * free ourselves. Since we're freeing ourselves we must
484 * return -1 to keep the transaction code from further referencing
485 * this item.
486 */
487/*ARGSUSED*/
488STATIC xfs_lsn_t
489xfs_efd_item_committed(xfs_efd_log_item_t *efdp, xfs_lsn_t lsn)
490{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700491 /*
492 * If we got a log I/O error, it's always the case that the LR with the
493 * EFI got unpinned and freed before the EFD got aborted.
494 */
495 if ((efdp->efd_item.li_flags & XFS_LI_ABORTED) == 0)
496 xfs_efi_release(efdp->efd_efip, efdp->efd_format.efd_nextents);
497
Christoph Hellwig7d795ca2005-06-21 15:41:19 +1000498 xfs_efd_item_free(efdp);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499 return (xfs_lsn_t)-1;
500}
501
502/*
503 * The transaction of which this EFD is a part has been aborted.
504 * Inform its companion EFI of this fact and then clean up after
505 * ourselves. No need to clean up the slot for the item in the
506 * transaction. That was done by the unpin code which is called
507 * prior to this routine in the abort/fs-shutdown path.
508 */
509STATIC void
510xfs_efd_item_abort(xfs_efd_log_item_t *efdp)
511{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700512 /*
513 * If we got a log I/O error, it's always the case that the LR with the
514 * EFI got unpinned and freed before the EFD got aborted. So don't
515 * reference the EFI at all in that case.
516 */
517 if ((efdp->efd_item.li_flags & XFS_LI_ABORTED) == 0)
518 xfs_efi_cancel(efdp->efd_efip);
519
Christoph Hellwig7d795ca2005-06-21 15:41:19 +1000520 xfs_efd_item_free(efdp);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700521}
522
523/*
524 * There isn't much you can do to push on an efd item. It is simply
525 * stuck waiting for the log to be flushed to disk.
526 */
527/*ARGSUSED*/
528STATIC void
529xfs_efd_item_push(xfs_efd_log_item_t *efdp)
530{
531 return;
532}
533
534/*
535 * The EFD dependency tracking op doesn't do squat. It can't because
536 * it doesn't know where the free extent is coming from. The dependency
537 * tracking has to be handled by the "enclosing" metadata object. For
538 * example, for inodes, the inode is locked throughout the extent freeing
539 * so the dependency should be recorded there.
540 */
541/*ARGSUSED*/
542STATIC void
543xfs_efd_item_committing(xfs_efd_log_item_t *efip, xfs_lsn_t lsn)
544{
545 return;
546}
547
548/*
549 * This is the ops vector shared by all efd log items.
550 */
Christoph Hellwigba0f32d2005-06-21 15:36:52 +1000551STATIC struct xfs_item_ops xfs_efd_item_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700552 .iop_size = (uint(*)(xfs_log_item_t*))xfs_efd_item_size,
553 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*))
554 xfs_efd_item_format,
555 .iop_pin = (void(*)(xfs_log_item_t*))xfs_efd_item_pin,
556 .iop_unpin = (void(*)(xfs_log_item_t*, int))xfs_efd_item_unpin,
557 .iop_unpin_remove = (void(*)(xfs_log_item_t*, xfs_trans_t*))
558 xfs_efd_item_unpin_remove,
559 .iop_trylock = (uint(*)(xfs_log_item_t*))xfs_efd_item_trylock,
560 .iop_unlock = (void(*)(xfs_log_item_t*))xfs_efd_item_unlock,
561 .iop_committed = (xfs_lsn_t(*)(xfs_log_item_t*, xfs_lsn_t))
562 xfs_efd_item_committed,
563 .iop_push = (void(*)(xfs_log_item_t*))xfs_efd_item_push,
564 .iop_abort = (void(*)(xfs_log_item_t*))xfs_efd_item_abort,
565 .iop_pushbuf = NULL,
566 .iop_committing = (void(*)(xfs_log_item_t*, xfs_lsn_t))
567 xfs_efd_item_committing
568};
569
570
571/*
572 * Allocate and initialize an efd item with the given number of extents.
573 */
574xfs_efd_log_item_t *
575xfs_efd_init(xfs_mount_t *mp,
576 xfs_efi_log_item_t *efip,
577 uint nextents)
578
579{
580 xfs_efd_log_item_t *efdp;
581 uint size;
582
583 ASSERT(nextents > 0);
584 if (nextents > XFS_EFD_MAX_FAST_EXTENTS) {
585 size = (uint)(sizeof(xfs_efd_log_item_t) +
586 ((nextents - 1) * sizeof(xfs_extent_t)));
587 efdp = (xfs_efd_log_item_t*)kmem_zalloc(size, KM_SLEEP);
588 } else {
589 efdp = (xfs_efd_log_item_t*)kmem_zone_zalloc(xfs_efd_zone,
590 KM_SLEEP);
591 }
592
593 efdp->efd_item.li_type = XFS_LI_EFD;
594 efdp->efd_item.li_ops = &xfs_efd_item_ops;
595 efdp->efd_item.li_mountp = mp;
596 efdp->efd_efip = efip;
597 efdp->efd_format.efd_nextents = nextents;
598 efdp->efd_format.efd_efi_id = efip->efi_format.efi_id;
599
600 return (efdp);
601}