Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0+
0002 /*
0003  * Copyright (C) 2016 Oracle.  All Rights Reserved.
0004  * Author: Darrick J. Wong <darrick.wong@oracle.com>
0005  */
0006 #ifndef __XFS_RMAP_ITEM_H__
0007 #define __XFS_RMAP_ITEM_H__
0008 
0009 /*
0010  * There are (currently) three pairs of rmap btree redo item types: map, unmap,
0011  * and convert.  The common abbreviations for these are RUI (rmap update
0012  * intent) and RUD (rmap update done).  The redo item type is encoded in the
0013  * flags field of each xfs_map_extent.
0014  *
0015  * *I items should be recorded in the *first* of a series of rolled
0016  * transactions, and the *D items should be recorded in the same transaction
0017  * that records the associated rmapbt updates.  Typically, the first
0018  * transaction will record a bmbt update, followed by some number of
0019  * transactions containing rmapbt updates, and finally transactions with any
0020  * bnobt/cntbt updates.
0021  *
0022  * Should the system crash after the commit of the first transaction but
0023  * before the commit of the final transaction in a series, log recovery will
0024  * use the redo information recorded by the intent items to replay the
0025  * (rmapbt/bnobt/cntbt) metadata updates in the non-first transaction.
0026  */
0027 
0028 /* kernel only RUI/RUD definitions */
0029 
0030 struct xfs_mount;
0031 struct kmem_cache;
0032 
0033 /*
0034  * Max number of extents in fast allocation path.
0035  */
0036 #define XFS_RUI_MAX_FAST_EXTENTS    16
0037 
0038 /*
0039  * This is the "rmap update intent" log item.  It is used to log the fact that
0040  * some reverse mappings need to change.  It is used in conjunction with the
0041  * "rmap update done" log item described below.
0042  *
0043  * These log items follow the same rules as struct xfs_efi_log_item; see the
0044  * comments about that structure (in xfs_extfree_item.h) for more details.
0045  */
0046 struct xfs_rui_log_item {
0047     struct xfs_log_item     rui_item;
0048     atomic_t            rui_refcount;
0049     atomic_t            rui_next_extent;
0050     struct xfs_rui_log_format   rui_format;
0051 };
0052 
0053 static inline size_t
0054 xfs_rui_log_item_sizeof(
0055     unsigned int        nr)
0056 {
0057     return offsetof(struct xfs_rui_log_item, rui_format) +
0058             xfs_rui_log_format_sizeof(nr);
0059 }
0060 
0061 /*
0062  * This is the "rmap update done" log item.  It is used to log the fact that
0063  * some rmapbt updates mentioned in an earlier rui item have been performed.
0064  */
0065 struct xfs_rud_log_item {
0066     struct xfs_log_item     rud_item;
0067     struct xfs_rui_log_item     *rud_ruip;
0068     struct xfs_rud_log_format   rud_format;
0069 };
0070 
0071 extern struct kmem_cache    *xfs_rui_cache;
0072 extern struct kmem_cache    *xfs_rud_cache;
0073 
0074 #endif  /* __XFS_RMAP_ITEM_H__ */