10b61f8a4SDave Chinner // SPDX-License-Identifier: GPL-2.0+ 26413a014SDarrick J. Wong /* 36413a014SDarrick J. Wong * Copyright (C) 2016 Oracle. All Rights Reserved. 46413a014SDarrick J. Wong * Author: Darrick J. Wong <darrick.wong@oracle.com> 56413a014SDarrick J. Wong */ 66413a014SDarrick J. Wong #ifndef __XFS_BMAP_ITEM_H__ 76413a014SDarrick J. Wong #define __XFS_BMAP_ITEM_H__ 86413a014SDarrick J. Wong 96413a014SDarrick J. Wong /* 106413a014SDarrick J. Wong * There are (currently) two pairs of bmap btree redo item types: map & unmap. 116413a014SDarrick J. Wong * The common abbreviations for these are BUI (bmap update intent) and BUD 126413a014SDarrick J. Wong * (bmap update done). The redo item type is encoded in the flags field of 136413a014SDarrick J. Wong * each xfs_map_extent. 146413a014SDarrick J. Wong * 156413a014SDarrick J. Wong * *I items should be recorded in the *first* of a series of rolled 166413a014SDarrick J. Wong * transactions, and the *D items should be recorded in the same transaction 176413a014SDarrick J. Wong * that records the associated bmbt updates. 186413a014SDarrick J. Wong * 196413a014SDarrick J. Wong * Should the system crash after the commit of the first transaction but 206413a014SDarrick J. Wong * before the commit of the final transaction in a series, log recovery will 216413a014SDarrick J. Wong * use the redo information recorded by the intent items to replay the 226413a014SDarrick J. Wong * bmbt metadata updates in the non-first transaction. 236413a014SDarrick J. Wong */ 246413a014SDarrick J. Wong 256413a014SDarrick J. Wong /* kernel only BUI/BUD definitions */ 266413a014SDarrick J. Wong 276413a014SDarrick J. Wong struct xfs_mount; 28e7720afaSDarrick J. Wong struct kmem_cache; 296413a014SDarrick J. Wong 306413a014SDarrick J. Wong /* 316413a014SDarrick J. Wong * Max number of extents in fast allocation path. 326413a014SDarrick J. Wong */ 336413a014SDarrick J. Wong #define XFS_BUI_MAX_FAST_EXTENTS 1 346413a014SDarrick J. Wong 356413a014SDarrick J. Wong /* 366413a014SDarrick J. Wong * This is the "bmap update intent" log item. It is used to log the fact that 376413a014SDarrick J. Wong * some reverse mappings need to change. It is used in conjunction with the 386413a014SDarrick J. Wong * "bmap update done" log item described below. 396413a014SDarrick J. Wong * 406413a014SDarrick J. Wong * These log items follow the same rules as struct xfs_efi_log_item; see the 416413a014SDarrick J. Wong * comments about that structure (in xfs_extfree_item.h) for more details. 426413a014SDarrick J. Wong */ 436413a014SDarrick J. Wong struct xfs_bui_log_item { 446413a014SDarrick J. Wong struct xfs_log_item bui_item; 456413a014SDarrick J. Wong atomic_t bui_refcount; 466413a014SDarrick J. Wong atomic_t bui_next_extent; 476413a014SDarrick J. Wong struct xfs_bui_log_format bui_format; 486413a014SDarrick J. Wong }; 496413a014SDarrick J. Wong 506413a014SDarrick J. Wong static inline size_t xfs_bui_log_item_sizeof(unsigned int nr)516413a014SDarrick J. Wongxfs_bui_log_item_sizeof( 526413a014SDarrick J. Wong unsigned int nr) 536413a014SDarrick J. Wong { 546413a014SDarrick J. Wong return offsetof(struct xfs_bui_log_item, bui_format) + 556413a014SDarrick J. Wong xfs_bui_log_format_sizeof(nr); 566413a014SDarrick J. Wong } 576413a014SDarrick J. Wong 586413a014SDarrick J. Wong /* 596413a014SDarrick J. Wong * This is the "bmap update done" log item. It is used to log the fact that 606413a014SDarrick J. Wong * some bmbt updates mentioned in an earlier bui item have been performed. 616413a014SDarrick J. Wong */ 626413a014SDarrick J. Wong struct xfs_bud_log_item { 636413a014SDarrick J. Wong struct xfs_log_item bud_item; 646413a014SDarrick J. Wong struct xfs_bui_log_item *bud_buip; 656413a014SDarrick J. Wong struct xfs_bud_log_format bud_format; 666413a014SDarrick J. Wong }; 676413a014SDarrick J. Wong 68*182696fbSDarrick J. Wong extern struct kmem_cache *xfs_bui_cache; 69*182696fbSDarrick J. Wong extern struct kmem_cache *xfs_bud_cache; 706413a014SDarrick J. Wong 716413a014SDarrick J. Wong #endif /* __XFS_BMAP_ITEM_H__ */ 72