1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
8 #include "xfs_format.h"
9 #include "xfs_log_format.h"
10 #include "xfs_trans_resv.h"
12 #include "xfs_shared.h"
13 #include "xfs_mount.h"
14 #include "xfs_defer.h"
15 #include "xfs_trans.h"
16 #include "xfs_trans_priv.h"
17 #include "xfs_extfree_item.h"
19 #include "xfs_btree.h"
21 #include "xfs_alloc.h"
23 #include "xfs_trace.h"
24 #include "xfs_error.h"
25 #include "xfs_log_priv.h"
26 #include "xfs_log_recover.h"
28 struct kmem_cache *xfs_efi_cache;
29 struct kmem_cache *xfs_efd_cache;
31 static const struct xfs_item_ops xfs_efi_item_ops;
33 static inline struct xfs_efi_log_item *EFI_ITEM(struct xfs_log_item *lip)
35 return container_of(lip, struct xfs_efi_log_item, efi_item);
40 struct xfs_efi_log_item *efip)
42 kmem_free(efip->efi_item.li_lv_shadow);
43 if (efip->efi_format.efi_nextents > XFS_EFI_MAX_FAST_EXTENTS)
46 kmem_cache_free(xfs_efi_cache, efip);
50 * Freeing the efi requires that we remove it from the AIL if it has already
51 * been placed there. However, the EFI may not yet have been placed in the AIL
52 * when called by xfs_efi_release() from EFD processing due to the ordering of
53 * committed vs unpin operations in bulk insert operations. Hence the reference
54 * count to ensure only the last caller frees the EFI.
58 struct xfs_efi_log_item *efip)
60 ASSERT(atomic_read(&efip->efi_refcount) > 0);
61 if (atomic_dec_and_test(&efip->efi_refcount)) {
62 xfs_trans_ail_delete(&efip->efi_item, SHUTDOWN_LOG_IO_ERROR);
63 xfs_efi_item_free(efip);
68 * This returns the number of iovecs needed to log the given efi item.
69 * We only need 1 iovec for an efi item. It just logs the efi_log_format
74 struct xfs_efi_log_item *efip)
76 return sizeof(struct xfs_efi_log_format) +
77 (efip->efi_format.efi_nextents - 1) * sizeof(xfs_extent_t);
82 struct xfs_log_item *lip,
87 *nbytes += xfs_efi_item_sizeof(EFI_ITEM(lip));
91 * This is called to fill in the vector of log iovecs for the
92 * given efi log item. We use only 1 iovec, and we point that
93 * at the efi_log_format structure embedded in the efi item.
94 * It is at this point that we assert that all of the extent
95 * slots in the efi item have been filled.
99 struct xfs_log_item *lip,
100 struct xfs_log_vec *lv)
102 struct xfs_efi_log_item *efip = EFI_ITEM(lip);
103 struct xfs_log_iovec *vecp = NULL;
105 ASSERT(atomic_read(&efip->efi_next_extent) ==
106 efip->efi_format.efi_nextents);
108 efip->efi_format.efi_type = XFS_LI_EFI;
109 efip->efi_format.efi_size = 1;
111 xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_EFI_FORMAT,
113 xfs_efi_item_sizeof(efip));
118 * The unpin operation is the last place an EFI is manipulated in the log. It is
119 * either inserted in the AIL or aborted in the event of a log I/O error. In
120 * either case, the EFI transaction has been successfully committed to make it
121 * this far. Therefore, we expect whoever committed the EFI to either construct
122 * and commit the EFD or drop the EFD's reference in the event of error. Simply
123 * drop the log's EFI reference now that the log is done with it.
127 struct xfs_log_item *lip,
130 struct xfs_efi_log_item *efip = EFI_ITEM(lip);
131 xfs_efi_release(efip);
135 * The EFI has been either committed or aborted if the transaction has been
136 * cancelled. If the transaction was cancelled, an EFD isn't going to be
137 * constructed and thus we free the EFI here directly.
140 xfs_efi_item_release(
141 struct xfs_log_item *lip)
143 xfs_efi_release(EFI_ITEM(lip));
147 * Allocate and initialize an efi item with the given number of extents.
149 STATIC struct xfs_efi_log_item *
151 struct xfs_mount *mp,
155 struct xfs_efi_log_item *efip;
158 ASSERT(nextents > 0);
159 if (nextents > XFS_EFI_MAX_FAST_EXTENTS) {
160 size = (uint)(sizeof(struct xfs_efi_log_item) +
161 ((nextents - 1) * sizeof(xfs_extent_t)));
162 efip = kmem_zalloc(size, 0);
164 efip = kmem_cache_zalloc(xfs_efi_cache,
165 GFP_KERNEL | __GFP_NOFAIL);
168 xfs_log_item_init(mp, &efip->efi_item, XFS_LI_EFI, &xfs_efi_item_ops);
169 efip->efi_format.efi_nextents = nextents;
170 efip->efi_format.efi_id = (uintptr_t)(void *)efip;
171 atomic_set(&efip->efi_next_extent, 0);
172 atomic_set(&efip->efi_refcount, 2);
178 * Copy an EFI format buffer from the given buf, and into the destination
179 * EFI format structure.
180 * The given buffer can be in 32 bit or 64 bit form (which has different padding),
181 * one of which will be the native format for this kernel.
182 * It will handle the conversion of formats if necessary.
185 xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
187 xfs_efi_log_format_t *src_efi_fmt = buf->i_addr;
189 uint len = sizeof(xfs_efi_log_format_t) +
190 (src_efi_fmt->efi_nextents - 1) * sizeof(xfs_extent_t);
191 uint len32 = sizeof(xfs_efi_log_format_32_t) +
192 (src_efi_fmt->efi_nextents - 1) * sizeof(xfs_extent_32_t);
193 uint len64 = sizeof(xfs_efi_log_format_64_t) +
194 (src_efi_fmt->efi_nextents - 1) * sizeof(xfs_extent_64_t);
196 if (buf->i_len == len) {
197 memcpy((char *)dst_efi_fmt, (char*)src_efi_fmt, len);
199 } else if (buf->i_len == len32) {
200 xfs_efi_log_format_32_t *src_efi_fmt_32 = buf->i_addr;
202 dst_efi_fmt->efi_type = src_efi_fmt_32->efi_type;
203 dst_efi_fmt->efi_size = src_efi_fmt_32->efi_size;
204 dst_efi_fmt->efi_nextents = src_efi_fmt_32->efi_nextents;
205 dst_efi_fmt->efi_id = src_efi_fmt_32->efi_id;
206 for (i = 0; i < dst_efi_fmt->efi_nextents; i++) {
207 dst_efi_fmt->efi_extents[i].ext_start =
208 src_efi_fmt_32->efi_extents[i].ext_start;
209 dst_efi_fmt->efi_extents[i].ext_len =
210 src_efi_fmt_32->efi_extents[i].ext_len;
213 } else if (buf->i_len == len64) {
214 xfs_efi_log_format_64_t *src_efi_fmt_64 = buf->i_addr;
216 dst_efi_fmt->efi_type = src_efi_fmt_64->efi_type;
217 dst_efi_fmt->efi_size = src_efi_fmt_64->efi_size;
218 dst_efi_fmt->efi_nextents = src_efi_fmt_64->efi_nextents;
219 dst_efi_fmt->efi_id = src_efi_fmt_64->efi_id;
220 for (i = 0; i < dst_efi_fmt->efi_nextents; i++) {
221 dst_efi_fmt->efi_extents[i].ext_start =
222 src_efi_fmt_64->efi_extents[i].ext_start;
223 dst_efi_fmt->efi_extents[i].ext_len =
224 src_efi_fmt_64->efi_extents[i].ext_len;
228 XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL);
229 return -EFSCORRUPTED;
232 static inline struct xfs_efd_log_item *EFD_ITEM(struct xfs_log_item *lip)
234 return container_of(lip, struct xfs_efd_log_item, efd_item);
238 xfs_efd_item_free(struct xfs_efd_log_item *efdp)
240 kmem_free(efdp->efd_item.li_lv_shadow);
241 if (efdp->efd_format.efd_nextents > XFS_EFD_MAX_FAST_EXTENTS)
244 kmem_cache_free(xfs_efd_cache, efdp);
248 * This returns the number of iovecs needed to log the given efd item.
249 * We only need 1 iovec for an efd item. It just logs the efd_log_format
254 struct xfs_efd_log_item *efdp)
256 return sizeof(xfs_efd_log_format_t) +
257 (efdp->efd_format.efd_nextents - 1) * sizeof(xfs_extent_t);
262 struct xfs_log_item *lip,
267 *nbytes += xfs_efd_item_sizeof(EFD_ITEM(lip));
271 * This is called to fill in the vector of log iovecs for the
272 * given efd log item. We use only 1 iovec, and we point that
273 * at the efd_log_format structure embedded in the efd item.
274 * It is at this point that we assert that all of the extent
275 * slots in the efd item have been filled.
279 struct xfs_log_item *lip,
280 struct xfs_log_vec *lv)
282 struct xfs_efd_log_item *efdp = EFD_ITEM(lip);
283 struct xfs_log_iovec *vecp = NULL;
285 ASSERT(efdp->efd_next_extent == efdp->efd_format.efd_nextents);
287 efdp->efd_format.efd_type = XFS_LI_EFD;
288 efdp->efd_format.efd_size = 1;
290 xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_EFD_FORMAT,
292 xfs_efd_item_sizeof(efdp));
296 * The EFD is either committed or aborted if the transaction is cancelled. If
297 * the transaction is cancelled, drop our reference to the EFI and free the EFD.
300 xfs_efd_item_release(
301 struct xfs_log_item *lip)
303 struct xfs_efd_log_item *efdp = EFD_ITEM(lip);
305 xfs_efi_release(efdp->efd_efip);
306 xfs_efd_item_free(efdp);
309 static const struct xfs_item_ops xfs_efd_item_ops = {
310 .flags = XFS_ITEM_RELEASE_WHEN_COMMITTED,
311 .iop_size = xfs_efd_item_size,
312 .iop_format = xfs_efd_item_format,
313 .iop_release = xfs_efd_item_release,
317 * Allocate an "extent free done" log item that will hold nextents worth of
318 * extents. The caller must use all nextents extents, because we are not
319 * flexible about this at all.
321 static struct xfs_efd_log_item *
323 struct xfs_trans *tp,
324 struct xfs_efi_log_item *efip,
325 unsigned int nextents)
327 struct xfs_efd_log_item *efdp;
329 ASSERT(nextents > 0);
331 if (nextents > XFS_EFD_MAX_FAST_EXTENTS) {
332 efdp = kmem_zalloc(sizeof(struct xfs_efd_log_item) +
333 (nextents - 1) * sizeof(struct xfs_extent),
336 efdp = kmem_cache_zalloc(xfs_efd_cache,
337 GFP_KERNEL | __GFP_NOFAIL);
340 xfs_log_item_init(tp->t_mountp, &efdp->efd_item, XFS_LI_EFD,
342 efdp->efd_efip = efip;
343 efdp->efd_format.efd_nextents = nextents;
344 efdp->efd_format.efd_efi_id = efip->efi_format.efi_id;
346 xfs_trans_add_item(tp, &efdp->efd_item);
351 * Free an extent and log it to the EFD. Note that the transaction is marked
352 * dirty regardless of whether the extent free succeeds or fails to support the
353 * EFI/EFD lifecycle rules.
356 xfs_trans_free_extent(
357 struct xfs_trans *tp,
358 struct xfs_efd_log_item *efdp,
359 xfs_fsblock_t start_block,
360 xfs_extlen_t ext_len,
361 const struct xfs_owner_info *oinfo,
364 struct xfs_mount *mp = tp->t_mountp;
365 struct xfs_extent *extp;
367 xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, start_block);
368 xfs_agblock_t agbno = XFS_FSB_TO_AGBNO(mp,
372 trace_xfs_bmap_free_deferred(tp->t_mountp, agno, 0, agbno, ext_len);
374 error = __xfs_free_extent(tp, start_block, ext_len,
375 oinfo, XFS_AG_RESV_NONE, skip_discard);
377 * Mark the transaction dirty, even on error. This ensures the
378 * transaction is aborted, which:
380 * 1.) releases the EFI and frees the EFD
381 * 2.) shuts down the filesystem
383 tp->t_flags |= XFS_TRANS_DIRTY;
384 set_bit(XFS_LI_DIRTY, &efdp->efd_item.li_flags);
386 next_extent = efdp->efd_next_extent;
387 ASSERT(next_extent < efdp->efd_format.efd_nextents);
388 extp = &(efdp->efd_format.efd_extents[next_extent]);
389 extp->ext_start = start_block;
390 extp->ext_len = ext_len;
391 efdp->efd_next_extent++;
396 /* Sort bmap items by AG. */
398 xfs_extent_free_diff_items(
400 const struct list_head *a,
401 const struct list_head *b)
403 struct xfs_mount *mp = priv;
404 struct xfs_extent_free_item *ra;
405 struct xfs_extent_free_item *rb;
407 ra = container_of(a, struct xfs_extent_free_item, xefi_list);
408 rb = container_of(b, struct xfs_extent_free_item, xefi_list);
409 return XFS_FSB_TO_AGNO(mp, ra->xefi_startblock) -
410 XFS_FSB_TO_AGNO(mp, rb->xefi_startblock);
413 /* Log a free extent to the intent item. */
415 xfs_extent_free_log_item(
416 struct xfs_trans *tp,
417 struct xfs_efi_log_item *efip,
418 struct xfs_extent_free_item *free)
421 struct xfs_extent *extp;
423 tp->t_flags |= XFS_TRANS_DIRTY;
424 set_bit(XFS_LI_DIRTY, &efip->efi_item.li_flags);
427 * atomic_inc_return gives us the value after the increment;
428 * we want to use it as an array index so we need to subtract 1 from
431 next_extent = atomic_inc_return(&efip->efi_next_extent) - 1;
432 ASSERT(next_extent < efip->efi_format.efi_nextents);
433 extp = &efip->efi_format.efi_extents[next_extent];
434 extp->ext_start = free->xefi_startblock;
435 extp->ext_len = free->xefi_blockcount;
438 static struct xfs_log_item *
439 xfs_extent_free_create_intent(
440 struct xfs_trans *tp,
441 struct list_head *items,
445 struct xfs_mount *mp = tp->t_mountp;
446 struct xfs_efi_log_item *efip = xfs_efi_init(mp, count);
447 struct xfs_extent_free_item *free;
451 xfs_trans_add_item(tp, &efip->efi_item);
453 list_sort(mp, items, xfs_extent_free_diff_items);
454 list_for_each_entry(free, items, xefi_list)
455 xfs_extent_free_log_item(tp, efip, free);
456 return &efip->efi_item;
459 /* Get an EFD so we can process all the free extents. */
460 static struct xfs_log_item *
461 xfs_extent_free_create_done(
462 struct xfs_trans *tp,
463 struct xfs_log_item *intent,
466 return &xfs_trans_get_efd(tp, EFI_ITEM(intent), count)->efd_item;
469 /* Process a free extent. */
471 xfs_extent_free_finish_item(
472 struct xfs_trans *tp,
473 struct xfs_log_item *done,
474 struct list_head *item,
475 struct xfs_btree_cur **state)
477 struct xfs_owner_info oinfo = { };
478 struct xfs_extent_free_item *free;
481 free = container_of(item, struct xfs_extent_free_item, xefi_list);
482 oinfo.oi_owner = free->xefi_owner;
483 if (free->xefi_flags & XFS_EFI_ATTR_FORK)
484 oinfo.oi_flags |= XFS_OWNER_INFO_ATTR_FORK;
485 if (free->xefi_flags & XFS_EFI_BMBT_BLOCK)
486 oinfo.oi_flags |= XFS_OWNER_INFO_BMBT_BLOCK;
487 error = xfs_trans_free_extent(tp, EFD_ITEM(done),
488 free->xefi_startblock,
489 free->xefi_blockcount,
490 &oinfo, free->xefi_flags & XFS_EFI_SKIP_DISCARD);
491 kmem_cache_free(xfs_extfree_item_cache, free);
495 /* Abort all pending EFIs. */
497 xfs_extent_free_abort_intent(
498 struct xfs_log_item *intent)
500 xfs_efi_release(EFI_ITEM(intent));
503 /* Cancel a free extent. */
505 xfs_extent_free_cancel_item(
506 struct list_head *item)
508 struct xfs_extent_free_item *free;
510 free = container_of(item, struct xfs_extent_free_item, xefi_list);
511 kmem_cache_free(xfs_extfree_item_cache, free);
514 const struct xfs_defer_op_type xfs_extent_free_defer_type = {
515 .max_items = XFS_EFI_MAX_FAST_EXTENTS,
516 .create_intent = xfs_extent_free_create_intent,
517 .abort_intent = xfs_extent_free_abort_intent,
518 .create_done = xfs_extent_free_create_done,
519 .finish_item = xfs_extent_free_finish_item,
520 .cancel_item = xfs_extent_free_cancel_item,
524 * AGFL blocks are accounted differently in the reserve pools and are not
525 * inserted into the busy extent list.
528 xfs_agfl_free_finish_item(
529 struct xfs_trans *tp,
530 struct xfs_log_item *done,
531 struct list_head *item,
532 struct xfs_btree_cur **state)
534 struct xfs_owner_info oinfo = { };
535 struct xfs_mount *mp = tp->t_mountp;
536 struct xfs_efd_log_item *efdp = EFD_ITEM(done);
537 struct xfs_extent_free_item *free;
538 struct xfs_extent *extp;
539 struct xfs_buf *agbp;
545 free = container_of(item, struct xfs_extent_free_item, xefi_list);
546 ASSERT(free->xefi_blockcount == 1);
547 agno = XFS_FSB_TO_AGNO(mp, free->xefi_startblock);
548 agbno = XFS_FSB_TO_AGBNO(mp, free->xefi_startblock);
549 oinfo.oi_owner = free->xefi_owner;
551 trace_xfs_agfl_free_deferred(mp, agno, 0, agbno, free->xefi_blockcount);
553 error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
555 error = xfs_free_agfl_block(tp, agno, agbno, agbp, &oinfo);
558 * Mark the transaction dirty, even on error. This ensures the
559 * transaction is aborted, which:
561 * 1.) releases the EFI and frees the EFD
562 * 2.) shuts down the filesystem
564 tp->t_flags |= XFS_TRANS_DIRTY;
565 set_bit(XFS_LI_DIRTY, &efdp->efd_item.li_flags);
567 next_extent = efdp->efd_next_extent;
568 ASSERT(next_extent < efdp->efd_format.efd_nextents);
569 extp = &(efdp->efd_format.efd_extents[next_extent]);
570 extp->ext_start = free->xefi_startblock;
571 extp->ext_len = free->xefi_blockcount;
572 efdp->efd_next_extent++;
574 kmem_cache_free(xfs_extfree_item_cache, free);
578 /* sub-type with special handling for AGFL deferred frees */
579 const struct xfs_defer_op_type xfs_agfl_free_defer_type = {
580 .max_items = XFS_EFI_MAX_FAST_EXTENTS,
581 .create_intent = xfs_extent_free_create_intent,
582 .abort_intent = xfs_extent_free_abort_intent,
583 .create_done = xfs_extent_free_create_done,
584 .finish_item = xfs_agfl_free_finish_item,
585 .cancel_item = xfs_extent_free_cancel_item,
588 /* Is this recovered EFI ok? */
590 xfs_efi_validate_ext(
591 struct xfs_mount *mp,
592 struct xfs_extent *extp)
594 return xfs_verify_fsbext(mp, extp->ext_start, extp->ext_len);
598 * Process an extent free intent item that was recovered from
599 * the log. We need to free the extents that it describes.
602 xfs_efi_item_recover(
603 struct xfs_log_item *lip,
604 struct list_head *capture_list)
606 struct xfs_efi_log_item *efip = EFI_ITEM(lip);
607 struct xfs_mount *mp = lip->li_log->l_mp;
608 struct xfs_efd_log_item *efdp;
609 struct xfs_trans *tp;
610 struct xfs_extent *extp;
615 * First check the validity of the extents described by the
616 * EFI. If any are bad, then assume that all are bad and
619 for (i = 0; i < efip->efi_format.efi_nextents; i++) {
620 if (!xfs_efi_validate_ext(mp,
621 &efip->efi_format.efi_extents[i])) {
622 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
624 sizeof(efip->efi_format));
625 return -EFSCORRUPTED;
629 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp);
632 efdp = xfs_trans_get_efd(tp, efip, efip->efi_format.efi_nextents);
634 for (i = 0; i < efip->efi_format.efi_nextents; i++) {
635 extp = &efip->efi_format.efi_extents[i];
636 error = xfs_trans_free_extent(tp, efdp, extp->ext_start,
638 &XFS_RMAP_OINFO_ANY_OWNER, false);
639 if (error == -EFSCORRUPTED)
640 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
641 extp, sizeof(*extp));
647 return xfs_defer_ops_capture_and_commit(tp, capture_list);
650 xfs_trans_cancel(tp);
656 struct xfs_log_item *lip,
659 return EFI_ITEM(lip)->efi_format.efi_id == intent_id;
662 /* Relog an intent item to push the log tail forward. */
663 static struct xfs_log_item *
665 struct xfs_log_item *intent,
666 struct xfs_trans *tp)
668 struct xfs_efd_log_item *efdp;
669 struct xfs_efi_log_item *efip;
670 struct xfs_extent *extp;
673 count = EFI_ITEM(intent)->efi_format.efi_nextents;
674 extp = EFI_ITEM(intent)->efi_format.efi_extents;
676 tp->t_flags |= XFS_TRANS_DIRTY;
677 efdp = xfs_trans_get_efd(tp, EFI_ITEM(intent), count);
678 efdp->efd_next_extent = count;
679 memcpy(efdp->efd_format.efd_extents, extp, count * sizeof(*extp));
680 set_bit(XFS_LI_DIRTY, &efdp->efd_item.li_flags);
682 efip = xfs_efi_init(tp->t_mountp, count);
683 memcpy(efip->efi_format.efi_extents, extp, count * sizeof(*extp));
684 atomic_set(&efip->efi_next_extent, count);
685 xfs_trans_add_item(tp, &efip->efi_item);
686 set_bit(XFS_LI_DIRTY, &efip->efi_item.li_flags);
687 return &efip->efi_item;
690 static const struct xfs_item_ops xfs_efi_item_ops = {
691 .iop_size = xfs_efi_item_size,
692 .iop_format = xfs_efi_item_format,
693 .iop_unpin = xfs_efi_item_unpin,
694 .iop_release = xfs_efi_item_release,
695 .iop_recover = xfs_efi_item_recover,
696 .iop_match = xfs_efi_item_match,
697 .iop_relog = xfs_efi_item_relog,
701 * This routine is called to create an in-core extent free intent
702 * item from the efi format structure which was logged on disk.
703 * It allocates an in-core efi, copies the extents from the format
704 * structure into it, and adds the efi to the AIL with the given
708 xlog_recover_efi_commit_pass2(
710 struct list_head *buffer_list,
711 struct xlog_recover_item *item,
714 struct xfs_mount *mp = log->l_mp;
715 struct xfs_efi_log_item *efip;
716 struct xfs_efi_log_format *efi_formatp;
719 efi_formatp = item->ri_buf[0].i_addr;
721 efip = xfs_efi_init(mp, efi_formatp->efi_nextents);
722 error = xfs_efi_copy_format(&item->ri_buf[0], &efip->efi_format);
724 xfs_efi_item_free(efip);
727 atomic_set(&efip->efi_next_extent, efi_formatp->efi_nextents);
729 * Insert the intent into the AIL directly and drop one reference so
730 * that finishing or canceling the work will drop the other.
732 xfs_trans_ail_insert(log->l_ailp, &efip->efi_item, lsn);
733 xfs_efi_release(efip);
737 const struct xlog_recover_item_ops xlog_efi_item_ops = {
738 .item_type = XFS_LI_EFI,
739 .commit_pass2 = xlog_recover_efi_commit_pass2,
743 * This routine is called when an EFD format structure is found in a committed
744 * transaction in the log. Its purpose is to cancel the corresponding EFI if it
745 * was still in the log. To do this it searches the AIL for the EFI with an id
746 * equal to that in the EFD format structure. If we find it we drop the EFD
747 * reference, which removes the EFI from the AIL and frees it.
750 xlog_recover_efd_commit_pass2(
752 struct list_head *buffer_list,
753 struct xlog_recover_item *item,
756 struct xfs_efd_log_format *efd_formatp;
758 efd_formatp = item->ri_buf[0].i_addr;
759 ASSERT((item->ri_buf[0].i_len == (sizeof(xfs_efd_log_format_32_t) +
760 ((efd_formatp->efd_nextents - 1) * sizeof(xfs_extent_32_t)))) ||
761 (item->ri_buf[0].i_len == (sizeof(xfs_efd_log_format_64_t) +
762 ((efd_formatp->efd_nextents - 1) * sizeof(xfs_extent_64_t)))));
764 xlog_recover_release_intent(log, XFS_LI_EFI, efd_formatp->efd_efi_id);
768 const struct xlog_recover_item_ops xlog_efd_item_ops = {
769 .item_type = XFS_LI_EFD,
770 .commit_pass2 = xlog_recover_efd_commit_pass2,