/* * Efi items have no locking, so just return. */ STATIC void xfs_efi_item_unlock( struct xfs_log_item *lip) { if (lip->li_flags & XFS_LI_ABORTED) xfs_efi_item_free(EFI_ITEM(lip)); }
/* * The EFI is logged only once and cannot be moved in the log, so simply return * the lsn at which it's been logged. For bulk transaction committed * processing, the EFI may be processed but not yet unpinned prior to the EFD * being processed. Set the XFS_EFI_COMMITTED flag so this case can be detected * when processing the EFD. */ STATIC xfs_lsn_t xfs_efi_item_committed( struct xfs_log_item *lip, xfs_lsn_t lsn) { struct xfs_efi_log_item *efip = EFI_ITEM(lip); set_bit(XFS_EFI_COMMITTED, &efip->efi_flags); return lsn; }
/* * While EFIs cannot really be pinned, the unpin operation is the last place at * which the EFI is manipulated during a transaction. If we are being asked to * remove the EFI it's because the transaction has been cancelled and by * definition that means the EFI cannot be in the AIL so remove it from the * transaction and free it. Otherwise coordinate with xfs_efi_release() (via * XFS_EFI_COMMITTED) to determine who gets to free the EFI. */ STATIC void xfs_efi_item_unpin( struct xfs_log_item *lip, int remove) { struct xfs_efi_log_item *efip = EFI_ITEM(lip); if (remove) { ASSERT(!(lip->li_flags & XFS_LI_IN_AIL)); xfs_trans_del_item(lip); xfs_efi_item_free(efip); return; } __xfs_efi_release(efip); }
/* * This is called to fill in the vector of log iovecs for the * given efi log item. We use only 1 iovec, and we point that * at the efi_log_format structure embedded in the efi item. * It is at this point that we assert that all of the extent * slots in the efi item have been filled. */ STATIC void xfs_efi_item_format( struct xfs_log_item *lip, struct xfs_log_iovec *log_vector) { struct xfs_efi_log_item *efip = EFI_ITEM(lip); uint size; ASSERT(efip->efi_next_extent == efip->efi_format.efi_nextents); efip->efi_format.efi_type = XFS_LI_EFI; size = sizeof(xfs_efi_log_format_t); size += (efip->efi_format.efi_nextents - 1) * sizeof(xfs_extent_t); efip->efi_format.efi_size = 1; log_vector->i_addr = &efip->efi_format; log_vector->i_len = size; log_vector->i_type = XLOG_REG_TYPE_EFI_FORMAT; ASSERT(size >= sizeof(xfs_efi_log_format_t)); }
/* * While EFIs cannot really be pinned, the unpin operation is the * last place at which the EFI is manipulated during a transaction. * Here we coordinate with xfs_efi_cancel() to determine who gets to * free the EFI. */ STATIC void xfs_efi_item_unpin( struct xfs_log_item *lip, int remove) { struct xfs_efi_log_item *efip = EFI_ITEM(lip); struct xfs_ail *ailp = lip->li_ailp; spin_lock(&ailp->xa_lock); if (efip->efi_flags & XFS_EFI_CANCELED) { if (remove) xfs_trans_del_item(lip); /* xfs_trans_ail_delete() drops the AIL lock. */ xfs_trans_ail_delete(ailp, lip); xfs_efi_item_free(efip); } else { efip->efi_flags |= XFS_EFI_COMMITTED; spin_unlock(&ailp->xa_lock); } }