.. | .. |
---|
7 | 7 | #define __XFS_RMAP_H__ |
---|
8 | 8 | |
---|
9 | 9 | static inline void |
---|
10 | | -xfs_rmap_ag_owner( |
---|
11 | | - struct xfs_owner_info *oi, |
---|
12 | | - uint64_t owner) |
---|
13 | | -{ |
---|
14 | | - oi->oi_owner = owner; |
---|
15 | | - oi->oi_offset = 0; |
---|
16 | | - oi->oi_flags = 0; |
---|
17 | | -} |
---|
18 | | - |
---|
19 | | -static inline void |
---|
20 | 10 | xfs_rmap_ino_bmbt_owner( |
---|
21 | 11 | struct xfs_owner_info *oi, |
---|
22 | 12 | xfs_ino_t ino, |
---|
.. | .. |
---|
43 | 33 | oi->oi_flags |= XFS_OWNER_INFO_ATTR_FORK; |
---|
44 | 34 | } |
---|
45 | 35 | |
---|
46 | | -static inline void |
---|
47 | | -xfs_rmap_skip_owner_update( |
---|
48 | | - struct xfs_owner_info *oi) |
---|
49 | | -{ |
---|
50 | | - xfs_rmap_ag_owner(oi, XFS_RMAP_OWN_NULL); |
---|
51 | | -} |
---|
52 | | - |
---|
53 | 36 | static inline bool |
---|
54 | 37 | xfs_rmap_should_skip_owner_update( |
---|
55 | | - struct xfs_owner_info *oi) |
---|
| 38 | + const struct xfs_owner_info *oi) |
---|
56 | 39 | { |
---|
57 | 40 | return oi->oi_owner == XFS_RMAP_OWN_NULL; |
---|
58 | | -} |
---|
59 | | - |
---|
60 | | -static inline void |
---|
61 | | -xfs_rmap_any_owner_update( |
---|
62 | | - struct xfs_owner_info *oi) |
---|
63 | | -{ |
---|
64 | | - xfs_rmap_ag_owner(oi, XFS_RMAP_OWN_UNKNOWN); |
---|
65 | 41 | } |
---|
66 | 42 | |
---|
67 | 43 | /* Reverse mapping functions. */ |
---|
.. | .. |
---|
92 | 68 | if (offset & ~(XFS_RMAP_OFF_MASK | XFS_RMAP_OFF_FLAGS)) |
---|
93 | 69 | return -EFSCORRUPTED; |
---|
94 | 70 | irec->rm_offset = XFS_RMAP_OFF(offset); |
---|
| 71 | + irec->rm_flags = 0; |
---|
95 | 72 | if (offset & XFS_RMAP_OFF_ATTR_FORK) |
---|
96 | 73 | irec->rm_flags |= XFS_RMAP_ATTR_FORK; |
---|
97 | 74 | if (offset & XFS_RMAP_OFF_BMBT_BLOCK) |
---|
.. | .. |
---|
103 | 80 | |
---|
104 | 81 | static inline void |
---|
105 | 82 | xfs_owner_info_unpack( |
---|
106 | | - struct xfs_owner_info *oinfo, |
---|
107 | | - uint64_t *owner, |
---|
108 | | - uint64_t *offset, |
---|
109 | | - unsigned int *flags) |
---|
| 83 | + const struct xfs_owner_info *oinfo, |
---|
| 84 | + uint64_t *owner, |
---|
| 85 | + uint64_t *offset, |
---|
| 86 | + unsigned int *flags) |
---|
110 | 87 | { |
---|
111 | | - unsigned int r = 0; |
---|
| 88 | + unsigned int r = 0; |
---|
112 | 89 | |
---|
113 | 90 | *owner = oinfo->oi_owner; |
---|
114 | 91 | *offset = oinfo->oi_offset; |
---|
.. | .. |
---|
137 | 114 | |
---|
138 | 115 | int xfs_rmap_alloc(struct xfs_trans *tp, struct xfs_buf *agbp, |
---|
139 | 116 | xfs_agnumber_t agno, xfs_agblock_t bno, xfs_extlen_t len, |
---|
140 | | - struct xfs_owner_info *oinfo); |
---|
| 117 | + const struct xfs_owner_info *oinfo); |
---|
141 | 118 | int xfs_rmap_free(struct xfs_trans *tp, struct xfs_buf *agbp, |
---|
142 | 119 | xfs_agnumber_t agno, xfs_agblock_t bno, xfs_extlen_t len, |
---|
143 | | - struct xfs_owner_info *oinfo); |
---|
| 120 | + const struct xfs_owner_info *oinfo); |
---|
144 | 121 | |
---|
145 | 122 | int xfs_rmap_lookup_le(struct xfs_btree_cur *cur, xfs_agblock_t bno, |
---|
146 | 123 | xfs_extlen_t len, uint64_t owner, uint64_t offset, |
---|
.. | .. |
---|
185 | 162 | }; |
---|
186 | 163 | |
---|
187 | 164 | /* functions for updating the rmapbt based on bmbt map/unmap operations */ |
---|
188 | | -int xfs_rmap_map_extent(struct xfs_trans *tp, struct xfs_inode *ip, |
---|
| 165 | +void xfs_rmap_map_extent(struct xfs_trans *tp, struct xfs_inode *ip, |
---|
189 | 166 | int whichfork, struct xfs_bmbt_irec *imap); |
---|
190 | | -int xfs_rmap_unmap_extent(struct xfs_trans *tp, struct xfs_inode *ip, |
---|
| 167 | +void xfs_rmap_unmap_extent(struct xfs_trans *tp, struct xfs_inode *ip, |
---|
191 | 168 | int whichfork, struct xfs_bmbt_irec *imap); |
---|
192 | | -int xfs_rmap_convert_extent(struct xfs_mount *mp, struct xfs_trans *tp, |
---|
| 169 | +void xfs_rmap_convert_extent(struct xfs_mount *mp, struct xfs_trans *tp, |
---|
193 | 170 | struct xfs_inode *ip, int whichfork, |
---|
194 | 171 | struct xfs_bmbt_irec *imap); |
---|
195 | | -int xfs_rmap_alloc_extent(struct xfs_trans *tp, xfs_agnumber_t agno, |
---|
| 172 | +void xfs_rmap_alloc_extent(struct xfs_trans *tp, xfs_agnumber_t agno, |
---|
196 | 173 | xfs_agblock_t bno, xfs_extlen_t len, uint64_t owner); |
---|
197 | | -int xfs_rmap_free_extent(struct xfs_trans *tp, xfs_agnumber_t agno, |
---|
| 174 | +void xfs_rmap_free_extent(struct xfs_trans *tp, xfs_agnumber_t agno, |
---|
198 | 175 | xfs_agblock_t bno, xfs_extlen_t len, uint64_t owner); |
---|
199 | 176 | |
---|
200 | 177 | void xfs_rmap_finish_one_cleanup(struct xfs_trans *tp, |
---|
.. | .. |
---|
218 | 195 | int xfs_rmap_has_record(struct xfs_btree_cur *cur, xfs_agblock_t bno, |
---|
219 | 196 | xfs_extlen_t len, bool *exists); |
---|
220 | 197 | int xfs_rmap_record_exists(struct xfs_btree_cur *cur, xfs_agblock_t bno, |
---|
221 | | - xfs_extlen_t len, struct xfs_owner_info *oinfo, |
---|
| 198 | + xfs_extlen_t len, const struct xfs_owner_info *oinfo, |
---|
222 | 199 | bool *has_rmap); |
---|
223 | 200 | int xfs_rmap_has_other_keys(struct xfs_btree_cur *cur, xfs_agblock_t bno, |
---|
224 | | - xfs_extlen_t len, struct xfs_owner_info *oinfo, |
---|
| 201 | + xfs_extlen_t len, const struct xfs_owner_info *oinfo, |
---|
225 | 202 | bool *has_rmap); |
---|
226 | 203 | int xfs_rmap_map_raw(struct xfs_btree_cur *cur, struct xfs_rmap_irec *rmap); |
---|
227 | 204 | |
---|
| 205 | +extern const struct xfs_owner_info XFS_RMAP_OINFO_SKIP_UPDATE; |
---|
| 206 | +extern const struct xfs_owner_info XFS_RMAP_OINFO_ANY_OWNER; |
---|
| 207 | +extern const struct xfs_owner_info XFS_RMAP_OINFO_FS; |
---|
| 208 | +extern const struct xfs_owner_info XFS_RMAP_OINFO_LOG; |
---|
| 209 | +extern const struct xfs_owner_info XFS_RMAP_OINFO_AG; |
---|
| 210 | +extern const struct xfs_owner_info XFS_RMAP_OINFO_INOBT; |
---|
| 211 | +extern const struct xfs_owner_info XFS_RMAP_OINFO_INODES; |
---|
| 212 | +extern const struct xfs_owner_info XFS_RMAP_OINFO_REFC; |
---|
| 213 | +extern const struct xfs_owner_info XFS_RMAP_OINFO_COW; |
---|
| 214 | + |
---|
228 | 215 | #endif /* __XFS_RMAP_H__ */ |
---|