65 lines · c
1/* SPDX-License-Identifier: GPL-2.0-or-later */2/*3 * Copyright (c) 2020-2024 Oracle. All Rights Reserved.4 * Author: Darrick J. Wong <djwong@kernel.org>5 */6#ifndef __XFS_EXCHMAPS_ITEM_H__7#define __XFS_EXCHMAPS_ITEM_H__8 9/*10 * The file mapping exchange intent item helps us exchange multiple file11 * mappings between two inode forks. It does this by tracking the range of12 * file block offsets that still need to be exchanged, and relogs as progress13 * happens.14 *15 * *I items should be recorded in the *first* of a series of rolled16 * transactions, and the *D items should be recorded in the same transaction17 * that records the associated bmbt updates.18 *19 * Should the system crash after the commit of the first transaction but20 * before the commit of the final transaction in a series, log recovery will21 * use the redo information recorded by the intent items to replay the22 * rest of the mapping exchanges.23 */24 25/* kernel only XMI/XMD definitions */26 27struct xfs_mount;28struct kmem_cache;29 30/*31 * This is the incore file mapping exchange intent log item. It is used to log32 * the fact that we are exchanging mappings between two files. It is used in33 * conjunction with the incore file mapping exchange done log item described34 * below.35 *36 * These log items follow the same rules as struct xfs_efi_log_item; see the37 * comments about that structure (in xfs_extfree_item.h) for more details.38 */39struct xfs_xmi_log_item {40 struct xfs_log_item xmi_item;41 atomic_t xmi_refcount;42 struct xfs_xmi_log_format xmi_format;43};44 45/*46 * This is the incore file mapping exchange done log item. It is used to log47 * the fact that an exchange mentioned in an earlier xmi item have been48 * performed.49 */50struct xfs_xmd_log_item {51 struct xfs_log_item xmd_item;52 struct xfs_xmi_log_item *xmd_intent_log_item;53 struct xfs_xmd_log_format xmd_format;54};55 56extern struct kmem_cache *xfs_xmi_cache;57extern struct kmem_cache *xfs_xmd_cache;58 59struct xfs_exchmaps_intent;60 61void xfs_exchmaps_defer_add(struct xfs_trans *tp,62 struct xfs_exchmaps_intent *xmi);63 64#endif /* __XFS_EXCHMAPS_ITEM_H__ */65