]>
Commit | Line | Data |
---|---|---|
6413a014 DW |
1 | /* |
2 | * Copyright (C) 2016 Oracle. All Rights Reserved. | |
3 | * | |
4 | * Author: Darrick J. Wong <darrick.wong@oracle.com> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version 2 | |
9 | * of the License, or (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it would be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write the Free Software Foundation, | |
18 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | */ | |
20 | #ifndef __XFS_BMAP_ITEM_H__ | |
21 | #define __XFS_BMAP_ITEM_H__ | |
22 | ||
23 | /* | |
24 | * There are (currently) two pairs of bmap btree redo item types: map & unmap. | |
25 | * The common abbreviations for these are BUI (bmap update intent) and BUD | |
26 | * (bmap update done). The redo item type is encoded in the flags field of | |
27 | * each xfs_map_extent. | |
28 | * | |
29 | * *I items should be recorded in the *first* of a series of rolled | |
30 | * transactions, and the *D items should be recorded in the same transaction | |
31 | * that records the associated bmbt updates. | |
32 | * | |
33 | * Should the system crash after the commit of the first transaction but | |
34 | * before the commit of the final transaction in a series, log recovery will | |
35 | * use the redo information recorded by the intent items to replay the | |
36 | * bmbt metadata updates in the non-first transaction. | |
37 | */ | |
38 | ||
39 | /* kernel only BUI/BUD definitions */ | |
40 | ||
41 | struct xfs_mount; | |
42 | struct kmem_zone; | |
43 | ||
44 | /* | |
45 | * Max number of extents in fast allocation path. | |
46 | */ | |
47 | #define XFS_BUI_MAX_FAST_EXTENTS 1 | |
48 | ||
49 | /* | |
50 | * Define BUI flag bits. Manipulated by set/clear/test_bit operators. | |
51 | */ | |
52 | #define XFS_BUI_RECOVERED 1 | |
53 | ||
54 | /* | |
55 | * This is the "bmap update intent" log item. It is used to log the fact that | |
56 | * some reverse mappings need to change. It is used in conjunction with the | |
57 | * "bmap update done" log item described below. | |
58 | * | |
59 | * These log items follow the same rules as struct xfs_efi_log_item; see the | |
60 | * comments about that structure (in xfs_extfree_item.h) for more details. | |
61 | */ | |
62 | struct xfs_bui_log_item { | |
63 | struct xfs_log_item bui_item; | |
64 | atomic_t bui_refcount; | |
65 | atomic_t bui_next_extent; | |
66 | unsigned long bui_flags; /* misc flags */ | |
67 | struct xfs_bui_log_format bui_format; | |
68 | }; | |
69 | ||
70 | static inline size_t | |
71 | xfs_bui_log_item_sizeof( | |
72 | unsigned int nr) | |
73 | { | |
74 | return offsetof(struct xfs_bui_log_item, bui_format) + | |
75 | xfs_bui_log_format_sizeof(nr); | |
76 | } | |
77 | ||
78 | /* | |
79 | * This is the "bmap update done" log item. It is used to log the fact that | |
80 | * some bmbt updates mentioned in an earlier bui item have been performed. | |
81 | */ | |
82 | struct xfs_bud_log_item { | |
83 | struct xfs_log_item bud_item; | |
84 | struct xfs_bui_log_item *bud_buip; | |
85 | struct xfs_bud_log_format bud_format; | |
86 | }; | |
87 | ||
88 | extern struct kmem_zone *xfs_bui_zone; | |
89 | extern struct kmem_zone *xfs_bud_zone; | |
90 | ||
91 | struct xfs_bui_log_item *xfs_bui_init(struct xfs_mount *); | |
92 | struct xfs_bud_log_item *xfs_bud_init(struct xfs_mount *, | |
93 | struct xfs_bui_log_item *); | |
94 | void xfs_bui_item_free(struct xfs_bui_log_item *); | |
95 | void xfs_bui_release(struct xfs_bui_log_item *); | |
96 | ||
97 | #endif /* __XFS_BMAP_ITEM_H__ */ |