diff options
Diffstat (limited to 'fs/xfs/xfs_bmap_btree.h')
-rw-r--r-- | fs/xfs/xfs_bmap_btree.h | 644 |
1 files changed, 168 insertions, 476 deletions
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h index 2cf4fe45cbcb..e095a2d344ae 100644 --- a/fs/xfs/xfs_bmap_btree.h +++ b/fs/xfs/xfs_bmap_btree.h | |||
@@ -1,33 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000,2002-2004 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000,2002-2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
15 | * otherwise, applies only to this software file. Patent licenses, if | ||
16 | * any, provided herein do not apply to combinations of this program with | ||
17 | * other software, or any other product whatsoever. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License along | ||
20 | * with this program; if not, write the Free Software Foundation, Inc., 59 | ||
21 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
22 | * | ||
23 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, | ||
24 | * Mountain View, CA 94043, or: | ||
25 | * | ||
26 | * http://www.sgi.com | ||
27 | * | ||
28 | * For further information regarding this notice, see: | ||
29 | * | ||
30 | * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ | ||
31 | */ | 17 | */ |
32 | #ifndef __XFS_BMAP_BTREE_H__ | 18 | #ifndef __XFS_BMAP_BTREE_H__ |
33 | #define __XFS_BMAP_BTREE_H__ | 19 | #define __XFS_BMAP_BTREE_H__ |
@@ -42,10 +28,9 @@ struct xfs_inode; | |||
42 | /* | 28 | /* |
43 | * Bmap root header, on-disk form only. | 29 | * Bmap root header, on-disk form only. |
44 | */ | 30 | */ |
45 | typedef struct xfs_bmdr_block | 31 | typedef struct xfs_bmdr_block { |
46 | { | 32 | __be16 bb_level; /* 0 is a leaf */ |
47 | __uint16_t bb_level; /* 0 is a leaf */ | 33 | __be16 bb_numrecs; /* current # of data records */ |
48 | __uint16_t bb_numrecs; /* current # of data records */ | ||
49 | } xfs_bmdr_block_t; | 34 | } xfs_bmdr_block_t; |
50 | 35 | ||
51 | /* | 36 | /* |
@@ -114,31 +99,31 @@ typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t; | |||
114 | (((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS) | 99 | (((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS) |
115 | #define DSTARTBLOCKMASK \ | 100 | #define DSTARTBLOCKMASK \ |
116 | (((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS) | 101 | (((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS) |
117 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_ISNULLSTARTBLOCK) | 102 | |
118 | int isnullstartblock(xfs_fsblock_t x); | ||
119 | #define ISNULLSTARTBLOCK(x) isnullstartblock(x) | 103 | #define ISNULLSTARTBLOCK(x) isnullstartblock(x) |
120 | #else | 104 | static inline int isnullstartblock(xfs_fsblock_t x) |
121 | #define ISNULLSTARTBLOCK(x) (((x) & STARTBLOCKMASK) == STARTBLOCKMASK) | 105 | { |
122 | #endif | 106 | return ((x) & STARTBLOCKMASK) == STARTBLOCKMASK; |
123 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_ISNULLDSTARTBLOCK) | 107 | } |
124 | int isnulldstartblock(xfs_dfsbno_t x); | 108 | |
125 | #define ISNULLDSTARTBLOCK(x) isnulldstartblock(x) | 109 | #define ISNULLDSTARTBLOCK(x) isnulldstartblock(x) |
126 | #else | 110 | static inline int isnulldstartblock(xfs_dfsbno_t x) |
127 | #define ISNULLDSTARTBLOCK(x) (((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK) | 111 | { |
128 | #endif | 112 | return ((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK; |
129 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_NULLSTARTBLOCK) | 113 | } |
130 | xfs_fsblock_t nullstartblock(int k); | 114 | |
131 | #define NULLSTARTBLOCK(k) nullstartblock(k) | 115 | #define NULLSTARTBLOCK(k) nullstartblock(k) |
132 | #else | 116 | static inline xfs_fsblock_t nullstartblock(int k) |
133 | #define NULLSTARTBLOCK(k) \ | 117 | { |
134 | ((ASSERT(k < (1 << STARTBLOCKVALBITS))), (STARTBLOCKMASK | (k))) | 118 | ASSERT(k < (1 << STARTBLOCKVALBITS)); |
135 | #endif | 119 | return STARTBLOCKMASK | (k); |
136 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_STARTBLOCKVAL) | 120 | } |
137 | xfs_filblks_t startblockval(xfs_fsblock_t x); | 121 | |
138 | #define STARTBLOCKVAL(x) startblockval(x) | 122 | #define STARTBLOCKVAL(x) startblockval(x) |
139 | #else | 123 | static inline xfs_filblks_t startblockval(xfs_fsblock_t x) |
140 | #define STARTBLOCKVAL(x) ((xfs_filblks_t)((x) & ~STARTBLOCKMASK)) | 124 | { |
141 | #endif | 125 | return (xfs_filblks_t)((x) & ~STARTBLOCKMASK); |
126 | } | ||
142 | 127 | ||
143 | /* | 128 | /* |
144 | * Possible extent formats. | 129 | * Possible extent formats. |
@@ -159,14 +144,9 @@ typedef enum { | |||
159 | /* | 144 | /* |
160 | * Extent state and extent format macros. | 145 | * Extent state and extent format macros. |
161 | */ | 146 | */ |
162 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_EXTFMT_INODE ) | 147 | #define XFS_EXTFMT_INODE(x) \ |
163 | xfs_exntfmt_t xfs_extfmt_inode(struct xfs_inode *ip); | 148 | (XFS_SB_VERSION_HASEXTFLGBIT(&((x)->i_mount->m_sb)) ? \ |
164 | #define XFS_EXTFMT_INODE(x) xfs_extfmt_inode(x) | 149 | XFS_EXTFMT_HASSTATE : XFS_EXTFMT_NOSTATE) |
165 | #else | ||
166 | #define XFS_EXTFMT_INODE(x) \ | ||
167 | (XFS_SB_VERSION_HASEXTFLGBIT(&((x)->i_mount->m_sb)) ? \ | ||
168 | XFS_EXTFMT_HASSTATE : XFS_EXTFMT_NOSTATE) | ||
169 | #endif | ||
170 | #define ISUNWRITTEN(x) ((x)->br_state == XFS_EXT_UNWRITTEN) | 150 | #define ISUNWRITTEN(x) ((x)->br_state == XFS_EXT_UNWRITTEN) |
171 | 151 | ||
172 | /* | 152 | /* |
@@ -192,248 +172,110 @@ typedef xfs_dfsbno_t xfs_bmbt_ptr_t, xfs_bmdr_ptr_t; /* btree pointer type */ | |||
192 | /* btree block header type */ | 172 | /* btree block header type */ |
193 | typedef struct xfs_btree_lblock xfs_bmbt_block_t; | 173 | typedef struct xfs_btree_lblock xfs_bmbt_block_t; |
194 | 174 | ||
195 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_BMBT_BLOCK) | 175 | #define XFS_BUF_TO_BMBT_BLOCK(bp) ((xfs_bmbt_block_t *)XFS_BUF_PTR(bp)) |
196 | xfs_bmbt_block_t *xfs_buf_to_bmbt_block(struct xfs_buf *bp); | ||
197 | #define XFS_BUF_TO_BMBT_BLOCK(bp) xfs_buf_to_bmbt_block(bp) | ||
198 | #else | ||
199 | #define XFS_BUF_TO_BMBT_BLOCK(bp) ((xfs_bmbt_block_t *)(XFS_BUF_PTR(bp))) | ||
200 | #endif | ||
201 | 176 | ||
202 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_RBLOCK_DSIZE) | 177 | #define XFS_BMAP_IBLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog) |
203 | int xfs_bmap_rblock_dsize(int lev, struct xfs_btree_cur *cur); | 178 | #define XFS_BMAP_RBLOCK_DSIZE(lev,cur) ((cur)->bc_private.b.forksize) |
204 | #define XFS_BMAP_RBLOCK_DSIZE(lev,cur) xfs_bmap_rblock_dsize(lev,cur) | 179 | #define XFS_BMAP_RBLOCK_ISIZE(lev,cur) \ |
205 | #else | ||
206 | #define XFS_BMAP_RBLOCK_DSIZE(lev,cur) ((cur)->bc_private.b.forksize) | ||
207 | #endif | ||
208 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_RBLOCK_ISIZE) | ||
209 | int xfs_bmap_rblock_isize(int lev, struct xfs_btree_cur *cur); | ||
210 | #define XFS_BMAP_RBLOCK_ISIZE(lev,cur) xfs_bmap_rblock_isize(lev,cur) | ||
211 | #else | ||
212 | #define XFS_BMAP_RBLOCK_ISIZE(lev,cur) \ | ||
213 | ((int)XFS_IFORK_PTR((cur)->bc_private.b.ip, \ | 180 | ((int)XFS_IFORK_PTR((cur)->bc_private.b.ip, \ |
214 | (cur)->bc_private.b.whichfork)->if_broot_bytes) | 181 | (cur)->bc_private.b.whichfork)->if_broot_bytes) |
215 | #endif | ||
216 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_IBLOCK_SIZE) | ||
217 | int xfs_bmap_iblock_size(int lev, struct xfs_btree_cur *cur); | ||
218 | #define XFS_BMAP_IBLOCK_SIZE(lev,cur) xfs_bmap_iblock_size(lev,cur) | ||
219 | #else | ||
220 | #define XFS_BMAP_IBLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog) | ||
221 | #endif | ||
222 | 182 | ||
223 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_DSIZE) | 183 | #define XFS_BMAP_BLOCK_DSIZE(lev,cur) \ |
224 | int xfs_bmap_block_dsize(int lev, struct xfs_btree_cur *cur); | 184 | (((lev) == (cur)->bc_nlevels - 1 ? \ |
225 | #define XFS_BMAP_BLOCK_DSIZE(lev,cur) xfs_bmap_block_dsize(lev,cur) | 185 | XFS_BMAP_RBLOCK_DSIZE(lev,cur) : XFS_BMAP_IBLOCK_SIZE(lev,cur))) |
226 | #else | 186 | #define XFS_BMAP_BLOCK_ISIZE(lev,cur) \ |
227 | #define XFS_BMAP_BLOCK_DSIZE(lev,cur) \ | 187 | (((lev) == (cur)->bc_nlevels - 1 ? \ |
228 | ((lev) == (cur)->bc_nlevels - 1 ? \ | 188 | XFS_BMAP_RBLOCK_ISIZE(lev,cur) : XFS_BMAP_IBLOCK_SIZE(lev,cur))) |
229 | XFS_BMAP_RBLOCK_DSIZE(lev,cur) : \ | ||
230 | XFS_BMAP_IBLOCK_SIZE(lev,cur)) | ||
231 | #endif | ||
232 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_ISIZE) | ||
233 | int xfs_bmap_block_isize(int lev, struct xfs_btree_cur *cur); | ||
234 | #define XFS_BMAP_BLOCK_ISIZE(lev,cur) xfs_bmap_block_isize(lev,cur) | ||
235 | #else | ||
236 | #define XFS_BMAP_BLOCK_ISIZE(lev,cur) \ | ||
237 | ((lev) == (cur)->bc_nlevels - 1 ? \ | ||
238 | XFS_BMAP_RBLOCK_ISIZE(lev,cur) : \ | ||
239 | XFS_BMAP_IBLOCK_SIZE(lev,cur)) | ||
240 | #endif | ||
241 | 189 | ||
242 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_DMAXRECS) | ||
243 | int xfs_bmap_block_dmaxrecs(int lev, struct xfs_btree_cur *cur); | ||
244 | #define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) xfs_bmap_block_dmaxrecs(lev,cur) | ||
245 | #else | ||
246 | #define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) \ | 190 | #define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) \ |
247 | ((lev) == (cur)->bc_nlevels - 1 ? \ | 191 | (((lev) == (cur)->bc_nlevels - 1 ? \ |
248 | XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \ | 192 | XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \ |
249 | xfs_bmdr, (lev) == 0) : \ | 193 | xfs_bmdr, (lev) == 0) : \ |
250 | ((cur)->bc_mp->m_bmap_dmxr[(lev) != 0])) | 194 | ((cur)->bc_mp->m_bmap_dmxr[(lev) != 0]))) |
251 | #endif | ||
252 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_IMAXRECS) | ||
253 | int xfs_bmap_block_imaxrecs(int lev, struct xfs_btree_cur *cur); | ||
254 | #define XFS_BMAP_BLOCK_IMAXRECS(lev,cur) xfs_bmap_block_imaxrecs(lev,cur) | ||
255 | #else | ||
256 | #define XFS_BMAP_BLOCK_IMAXRECS(lev,cur) \ | 195 | #define XFS_BMAP_BLOCK_IMAXRECS(lev,cur) \ |
257 | ((lev) == (cur)->bc_nlevels - 1 ? \ | 196 | (((lev) == (cur)->bc_nlevels - 1 ? \ |
258 | XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur), \ | 197 | XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur),\ |
259 | xfs_bmbt, (lev) == 0) : \ | 198 | xfs_bmbt, (lev) == 0) : \ |
260 | ((cur)->bc_mp->m_bmap_dmxr[(lev) != 0])) | 199 | ((cur)->bc_mp->m_bmap_dmxr[(lev) != 0]))) |
261 | #endif | ||
262 | 200 | ||
263 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_DMINRECS) | ||
264 | int xfs_bmap_block_dminrecs(int lev, struct xfs_btree_cur *cur); | ||
265 | #define XFS_BMAP_BLOCK_DMINRECS(lev,cur) xfs_bmap_block_dminrecs(lev,cur) | ||
266 | #else | ||
267 | #define XFS_BMAP_BLOCK_DMINRECS(lev,cur) \ | 201 | #define XFS_BMAP_BLOCK_DMINRECS(lev,cur) \ |
268 | ((lev) == (cur)->bc_nlevels - 1 ? \ | 202 | (((lev) == (cur)->bc_nlevels - 1 ? \ |
269 | XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \ | 203 | XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur),\ |
270 | xfs_bmdr, (lev) == 0) : \ | 204 | xfs_bmdr, (lev) == 0) : \ |
271 | ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0])) | 205 | ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0]))) |
272 | #endif | ||
273 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_IMINRECS) | ||
274 | int xfs_bmap_block_iminrecs(int lev, struct xfs_btree_cur *cur); | ||
275 | #define XFS_BMAP_BLOCK_IMINRECS(lev,cur) xfs_bmap_block_iminrecs(lev,cur) | ||
276 | #else | ||
277 | #define XFS_BMAP_BLOCK_IMINRECS(lev,cur) \ | 206 | #define XFS_BMAP_BLOCK_IMINRECS(lev,cur) \ |
278 | ((lev) == (cur)->bc_nlevels - 1 ? \ | 207 | (((lev) == (cur)->bc_nlevels - 1 ? \ |
279 | XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur), \ | 208 | XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur),\ |
280 | xfs_bmbt, (lev) == 0) : \ | 209 | xfs_bmbt, (lev) == 0) : \ |
281 | ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0])) | 210 | ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0]))) |
282 | #endif | 211 | |
283 | 212 | #define XFS_BMAP_REC_DADDR(bb,i,cur) \ | |
284 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_REC_DADDR) | 213 | (XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_DSIZE( \ |
285 | xfs_bmbt_rec_t * | 214 | be16_to_cpu((bb)->bb_level), cur), \ |
286 | xfs_bmap_rec_daddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur); | 215 | xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \ |
287 | #define XFS_BMAP_REC_DADDR(bb,i,cur) xfs_bmap_rec_daddr(bb,i,cur) | 216 | be16_to_cpu((bb)->bb_level), cur))) |
288 | #else | 217 | #define XFS_BMAP_REC_IADDR(bb,i,cur) \ |
289 | #define XFS_BMAP_REC_DADDR(bb,i,cur) \ | 218 | (XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_ISIZE( \ |
290 | XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_DSIZE( \ | 219 | be16_to_cpu((bb)->bb_level), cur), \ |
291 | INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \ | 220 | xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \ |
292 | xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \ | 221 | be16_to_cpu((bb)->bb_level), cur))) |
293 | INT_GET((bb)->bb_level, ARCH_CONVERT), cur)) | 222 | |
294 | #endif | 223 | #define XFS_BMAP_KEY_DADDR(bb,i,cur) \ |
295 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_REC_IADDR) | 224 | (XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_DSIZE( \ |
296 | xfs_bmbt_rec_t * | 225 | be16_to_cpu((bb)->bb_level), cur), \ |
297 | xfs_bmap_rec_iaddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur); | 226 | xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \ |
298 | #define XFS_BMAP_REC_IADDR(bb,i,cur) xfs_bmap_rec_iaddr(bb,i,cur) | 227 | be16_to_cpu((bb)->bb_level), cur))) |
299 | #else | 228 | #define XFS_BMAP_KEY_IADDR(bb,i,cur) \ |
300 | #define XFS_BMAP_REC_IADDR(bb,i,cur) \ | 229 | (XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_ISIZE( \ |
301 | XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_ISIZE( \ | 230 | be16_to_cpu((bb)->bb_level), cur), \ |
302 | INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \ | 231 | xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \ |
303 | xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \ | 232 | be16_to_cpu((bb)->bb_level), cur))) |
304 | INT_GET((bb)->bb_level, ARCH_CONVERT), cur)) | 233 | |
305 | #endif | 234 | #define XFS_BMAP_PTR_DADDR(bb,i,cur) \ |
306 | 235 | (XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_DSIZE( \ | |
307 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_KEY_DADDR) | 236 | be16_to_cpu((bb)->bb_level), cur), \ |
308 | xfs_bmbt_key_t * | 237 | xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \ |
309 | xfs_bmap_key_daddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur); | 238 | be16_to_cpu((bb)->bb_level), cur))) |
310 | #define XFS_BMAP_KEY_DADDR(bb,i,cur) xfs_bmap_key_daddr(bb,i,cur) | 239 | #define XFS_BMAP_PTR_IADDR(bb,i,cur) \ |
311 | #else | 240 | (XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_ISIZE( \ |
312 | #define XFS_BMAP_KEY_DADDR(bb,i,cur) \ | 241 | be16_to_cpu((bb)->bb_level), cur), \ |
313 | XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_DSIZE( \ | 242 | xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \ |
314 | INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \ | 243 | be16_to_cpu((bb)->bb_level), cur))) |
315 | xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \ | ||
316 | INT_GET((bb)->bb_level, ARCH_CONVERT), cur)) | ||
317 | #endif | ||
318 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_KEY_IADDR) | ||
319 | xfs_bmbt_key_t * | ||
320 | xfs_bmap_key_iaddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur); | ||
321 | #define XFS_BMAP_KEY_IADDR(bb,i,cur) xfs_bmap_key_iaddr(bb,i,cur) | ||
322 | #else | ||
323 | #define XFS_BMAP_KEY_IADDR(bb,i,cur) \ | ||
324 | XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_ISIZE( \ | ||
325 | INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \ | ||
326 | xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \ | ||
327 | INT_GET((bb)->bb_level, ARCH_CONVERT), cur)) | ||
328 | #endif | ||
329 | |||
330 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_PTR_DADDR) | ||
331 | xfs_bmbt_ptr_t * | ||
332 | xfs_bmap_ptr_daddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur); | ||
333 | #define XFS_BMAP_PTR_DADDR(bb,i,cur) xfs_bmap_ptr_daddr(bb,i,cur) | ||
334 | #else | ||
335 | #define XFS_BMAP_PTR_DADDR(bb,i,cur) \ | ||
336 | XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_DSIZE( \ | ||
337 | INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \ | ||
338 | xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \ | ||
339 | INT_GET((bb)->bb_level, ARCH_CONVERT), cur)) | ||
340 | #endif | ||
341 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_PTR_IADDR) | ||
342 | xfs_bmbt_ptr_t * | ||
343 | xfs_bmap_ptr_iaddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur); | ||
344 | #define XFS_BMAP_PTR_IADDR(bb,i,cur) xfs_bmap_ptr_iaddr(bb,i,cur) | ||
345 | #else | ||
346 | #define XFS_BMAP_PTR_IADDR(bb,i,cur) \ | ||
347 | XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_ISIZE( \ | ||
348 | INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \ | ||
349 | xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \ | ||
350 | INT_GET((bb)->bb_level, ARCH_CONVERT), cur)) | ||
351 | #endif | ||
352 | 244 | ||
353 | /* | 245 | /* |
354 | * These are to be used when we know the size of the block and | 246 | * These are to be used when we know the size of the block and |
355 | * we don't have a cursor. | 247 | * we don't have a cursor. |
356 | */ | 248 | */ |
357 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_REC_ADDR) | ||
358 | xfs_bmbt_rec_t *xfs_bmap_broot_rec_addr(xfs_bmbt_block_t *bb, int i, int sz); | ||
359 | #define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) xfs_bmap_broot_rec_addr(bb,i,sz) | ||
360 | #else | ||
361 | #define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) \ | 249 | #define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) \ |
362 | XFS_BTREE_REC_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)) | 250 | (XFS_BTREE_REC_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz))) |
363 | #endif | ||
364 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_KEY_ADDR) | ||
365 | xfs_bmbt_key_t *xfs_bmap_broot_key_addr(xfs_bmbt_block_t *bb, int i, int sz); | ||
366 | #define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) xfs_bmap_broot_key_addr(bb,i,sz) | ||
367 | #else | ||
368 | #define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) \ | 251 | #define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) \ |
369 | XFS_BTREE_KEY_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)) | 252 | (XFS_BTREE_KEY_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz))) |
370 | #endif | ||
371 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_PTR_ADDR) | ||
372 | xfs_bmbt_ptr_t *xfs_bmap_broot_ptr_addr(xfs_bmbt_block_t *bb, int i, int sz); | ||
373 | #define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) xfs_bmap_broot_ptr_addr(bb,i,sz) | ||
374 | #else | ||
375 | #define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) \ | 253 | #define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) \ |
376 | XFS_BTREE_PTR_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)) | 254 | (XFS_BTREE_PTR_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz))) |
377 | #endif | 255 | |
256 | #define XFS_BMAP_BROOT_NUMRECS(bb) be16_to_cpu((bb)->bb_numrecs) | ||
257 | #define XFS_BMAP_BROOT_MAXRECS(sz) XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0) | ||
378 | 258 | ||
379 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_NUMRECS) | ||
380 | int xfs_bmap_broot_numrecs(xfs_bmdr_block_t *bb); | ||
381 | #define XFS_BMAP_BROOT_NUMRECS(bb) xfs_bmap_broot_numrecs(bb) | ||
382 | #else | ||
383 | #define XFS_BMAP_BROOT_NUMRECS(bb) (INT_GET((bb)->bb_numrecs, ARCH_CONVERT)) | ||
384 | #endif | ||
385 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_MAXRECS) | ||
386 | int xfs_bmap_broot_maxrecs(int sz); | ||
387 | #define XFS_BMAP_BROOT_MAXRECS(sz) xfs_bmap_broot_maxrecs(sz) | ||
388 | #else | ||
389 | #define XFS_BMAP_BROOT_MAXRECS(sz) XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0) | ||
390 | #endif | ||
391 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_SPACE_CALC) | ||
392 | int xfs_bmap_broot_space_calc(int nrecs); | ||
393 | #define XFS_BMAP_BROOT_SPACE_CALC(nrecs) xfs_bmap_broot_space_calc(nrecs) | ||
394 | #else | ||
395 | #define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \ | 259 | #define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \ |
396 | ((int)(sizeof(xfs_bmbt_block_t) + \ | 260 | (int)(sizeof(xfs_bmbt_block_t) + \ |
397 | ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))) | 261 | ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t)))) |
398 | #endif | 262 | |
399 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_SPACE) | ||
400 | int xfs_bmap_broot_space(xfs_bmdr_block_t *bb); | ||
401 | #define XFS_BMAP_BROOT_SPACE(bb) xfs_bmap_broot_space(bb) | ||
402 | #else | ||
403 | #define XFS_BMAP_BROOT_SPACE(bb) \ | 263 | #define XFS_BMAP_BROOT_SPACE(bb) \ |
404 | XFS_BMAP_BROOT_SPACE_CALC(INT_GET((bb)->bb_numrecs, ARCH_CONVERT)) | 264 | (XFS_BMAP_BROOT_SPACE_CALC(be16_to_cpu((bb)->bb_numrecs))) |
405 | #endif | 265 | #define XFS_BMDR_SPACE_CALC(nrecs) \ |
406 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMDR_SPACE_CALC) | 266 | (int)(sizeof(xfs_bmdr_block_t) + \ |
407 | int xfs_bmdr_space_calc(int nrecs); | 267 | ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t)))) |
408 | #define XFS_BMDR_SPACE_CALC(nrecs) xfs_bmdr_space_calc(nrecs) | ||
409 | #else | ||
410 | #define XFS_BMDR_SPACE_CALC(nrecs) \ | ||
411 | ((int)(sizeof(xfs_bmdr_block_t) + \ | ||
412 | ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))) | ||
413 | #endif | ||
414 | 268 | ||
415 | /* | 269 | /* |
416 | * Maximum number of bmap btree levels. | 270 | * Maximum number of bmap btree levels. |
417 | */ | 271 | */ |
418 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BM_MAXLEVELS) | 272 | #define XFS_BM_MAXLEVELS(mp,w) ((mp)->m_bm_maxlevels[(w)]) |
419 | int xfs_bm_maxlevels(struct xfs_mount *mp, int w); | ||
420 | #define XFS_BM_MAXLEVELS(mp,w) xfs_bm_maxlevels(mp,w) | ||
421 | #else | ||
422 | #define XFS_BM_MAXLEVELS(mp,w) ((mp)->m_bm_maxlevels[w]) | ||
423 | #endif | ||
424 | 273 | ||
425 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_SANITY_CHECK) | 274 | #define XFS_BMAP_SANITY_CHECK(mp,bb,level) \ |
426 | int xfs_bmap_sanity_check(struct xfs_mount *mp, xfs_bmbt_block_t *bb, | 275 | (be32_to_cpu((bb)->bb_magic) == XFS_BMAP_MAGIC && \ |
427 | int level); | 276 | be16_to_cpu((bb)->bb_level) == level && \ |
428 | #define XFS_BMAP_SANITY_CHECK(mp,bb,level) \ | 277 | be16_to_cpu((bb)->bb_numrecs) > 0 && \ |
429 | xfs_bmap_sanity_check(mp,bb,level) | 278 | be16_to_cpu((bb)->bb_numrecs) <= (mp)->m_bmap_dmxr[(level) != 0]) |
430 | #else | ||
431 | #define XFS_BMAP_SANITY_CHECK(mp,bb,level) \ | ||
432 | (INT_GET((bb)->bb_magic, ARCH_CONVERT) == XFS_BMAP_MAGIC && \ | ||
433 | INT_GET((bb)->bb_level, ARCH_CONVERT) == level && \ | ||
434 | INT_GET((bb)->bb_numrecs, ARCH_CONVERT) > 0 && \ | ||
435 | INT_GET((bb)->bb_numrecs, ARCH_CONVERT) <= (mp)->m_bmap_dmxr[(level) != 0]) | ||
436 | #endif | ||
437 | 279 | ||
438 | 280 | ||
439 | #ifdef __KERNEL__ | 281 | #ifdef __KERNEL__ |
@@ -459,234 +301,84 @@ extern ktrace_t *xfs_bmbt_trace_buf; | |||
459 | /* | 301 | /* |
460 | * Prototypes for xfs_bmap.c to call. | 302 | * Prototypes for xfs_bmap.c to call. |
461 | */ | 303 | */ |
462 | 304 | extern void xfs_bmdr_to_bmbt(xfs_bmdr_block_t *, int, xfs_bmbt_block_t *, int); | |
463 | void | 305 | extern int xfs_bmbt_decrement(struct xfs_btree_cur *, int, int *); |
464 | xfs_bmdr_to_bmbt( | 306 | extern int xfs_bmbt_delete(struct xfs_btree_cur *, int *); |
465 | xfs_bmdr_block_t *, | 307 | extern void xfs_bmbt_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); |
466 | int, | 308 | extern xfs_bmbt_block_t *xfs_bmbt_get_block(struct xfs_btree_cur *cur, |
467 | xfs_bmbt_block_t *, | 309 | int, struct xfs_buf **bpp); |
468 | int); | 310 | extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_t *r); |
469 | 311 | extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_t *r); | |
470 | int | 312 | extern xfs_fileoff_t xfs_bmbt_get_startoff(xfs_bmbt_rec_t *r); |
471 | xfs_bmbt_decrement( | 313 | extern xfs_exntst_t xfs_bmbt_get_state(xfs_bmbt_rec_t *r); |
472 | struct xfs_btree_cur *, | ||
473 | int, | ||
474 | int *); | ||
475 | |||
476 | int | ||
477 | xfs_bmbt_delete( | ||
478 | struct xfs_btree_cur *, | ||
479 | int *); | ||
480 | |||
481 | void | ||
482 | xfs_bmbt_get_all( | ||
483 | xfs_bmbt_rec_t *r, | ||
484 | xfs_bmbt_irec_t *s); | ||
485 | |||
486 | xfs_bmbt_block_t * | ||
487 | xfs_bmbt_get_block( | ||
488 | struct xfs_btree_cur *cur, | ||
489 | int level, | ||
490 | struct xfs_buf **bpp); | ||
491 | |||
492 | xfs_filblks_t | ||
493 | xfs_bmbt_get_blockcount( | ||
494 | xfs_bmbt_rec_t *r); | ||
495 | |||
496 | xfs_fsblock_t | ||
497 | xfs_bmbt_get_startblock( | ||
498 | xfs_bmbt_rec_t *r); | ||
499 | |||
500 | xfs_fileoff_t | ||
501 | xfs_bmbt_get_startoff( | ||
502 | xfs_bmbt_rec_t *r); | ||
503 | |||
504 | xfs_exntst_t | ||
505 | xfs_bmbt_get_state( | ||
506 | xfs_bmbt_rec_t *r); | ||
507 | 314 | ||
508 | #ifndef XFS_NATIVE_HOST | 315 | #ifndef XFS_NATIVE_HOST |
509 | void | 316 | extern void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); |
510 | xfs_bmbt_disk_get_all( | 317 | extern xfs_exntst_t xfs_bmbt_disk_get_state(xfs_bmbt_rec_t *r); |
511 | xfs_bmbt_rec_t *r, | 318 | extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(xfs_bmbt_rec_t *r); |
512 | xfs_bmbt_irec_t *s); | 319 | extern xfs_fsblock_t xfs_bmbt_disk_get_startblock(xfs_bmbt_rec_t *r); |
513 | 320 | extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r); | |
514 | xfs_exntst_t | 321 | #else |
515 | xfs_bmbt_disk_get_state( | 322 | #define xfs_bmbt_disk_get_all(r, s) xfs_bmbt_get_all(r, s) |
516 | xfs_bmbt_rec_t *r); | 323 | #define xfs_bmbt_disk_get_state(r) xfs_bmbt_get_state(r) |
517 | 324 | #define xfs_bmbt_disk_get_blockcount(r) xfs_bmbt_get_blockcount(r) | |
518 | xfs_filblks_t | 325 | #define xfs_bmbt_disk_get_startblock(r) xfs_bmbt_get_blockcount(r) |
519 | xfs_bmbt_disk_get_blockcount( | 326 | #define xfs_bmbt_disk_get_startoff(r) xfs_bmbt_get_startoff(r) |
520 | xfs_bmbt_rec_t *r); | ||
521 | |||
522 | xfs_fsblock_t | ||
523 | xfs_bmbt_disk_get_startblock( | ||
524 | xfs_bmbt_rec_t *r); | ||
525 | |||
526 | xfs_fileoff_t | ||
527 | xfs_bmbt_disk_get_startoff( | ||
528 | xfs_bmbt_rec_t *r); | ||
529 | |||
530 | #else | ||
531 | #define xfs_bmbt_disk_get_all(r, s) \ | ||
532 | xfs_bmbt_get_all(r, s) | ||
533 | #define xfs_bmbt_disk_get_state(r) \ | ||
534 | xfs_bmbt_get_state(r) | ||
535 | #define xfs_bmbt_disk_get_blockcount(r) \ | ||
536 | xfs_bmbt_get_blockcount(r) | ||
537 | #define xfs_bmbt_disk_get_startblock(r) \ | ||
538 | xfs_bmbt_get_blockcount(r) | ||
539 | #define xfs_bmbt_disk_get_startoff(r) \ | ||
540 | xfs_bmbt_get_startoff(r) | ||
541 | #endif /* XFS_NATIVE_HOST */ | 327 | #endif /* XFS_NATIVE_HOST */ |
542 | 328 | ||
543 | int | 329 | extern int xfs_bmbt_increment(struct xfs_btree_cur *, int, int *); |
544 | xfs_bmbt_increment( | 330 | extern int xfs_bmbt_insert(struct xfs_btree_cur *, int *); |
545 | struct xfs_btree_cur *, | 331 | extern void xfs_bmbt_log_block(struct xfs_btree_cur *, struct xfs_buf *, int); |
546 | int, | 332 | extern void xfs_bmbt_log_recs(struct xfs_btree_cur *, struct xfs_buf *, int, |
547 | int *); | 333 | int); |
548 | 334 | extern int xfs_bmbt_lookup_eq(struct xfs_btree_cur *, xfs_fileoff_t, | |
549 | int | 335 | xfs_fsblock_t, xfs_filblks_t, int *); |
550 | xfs_bmbt_insert( | 336 | extern int xfs_bmbt_lookup_ge(struct xfs_btree_cur *, xfs_fileoff_t, |
551 | struct xfs_btree_cur *, | 337 | xfs_fsblock_t, xfs_filblks_t, int *); |
552 | int *); | ||
553 | |||
554 | void | ||
555 | xfs_bmbt_log_block( | ||
556 | struct xfs_btree_cur *, | ||
557 | struct xfs_buf *, | ||
558 | int); | ||
559 | |||
560 | void | ||
561 | xfs_bmbt_log_recs( | ||
562 | struct xfs_btree_cur *, | ||
563 | struct xfs_buf *, | ||
564 | int, | ||
565 | int); | ||
566 | |||
567 | int | ||
568 | xfs_bmbt_lookup_eq( | ||
569 | struct xfs_btree_cur *, | ||
570 | xfs_fileoff_t, | ||
571 | xfs_fsblock_t, | ||
572 | xfs_filblks_t, | ||
573 | int *); | ||
574 | |||
575 | int | ||
576 | xfs_bmbt_lookup_ge( | ||
577 | struct xfs_btree_cur *, | ||
578 | xfs_fileoff_t, | ||
579 | xfs_fsblock_t, | ||
580 | xfs_filblks_t, | ||
581 | int *); | ||
582 | 338 | ||
583 | /* | 339 | /* |
584 | * Give the bmap btree a new root block. Copy the old broot contents | 340 | * Give the bmap btree a new root block. Copy the old broot contents |
585 | * down into a real block and make the broot point to it. | 341 | * down into a real block and make the broot point to it. |
586 | */ | 342 | */ |
587 | int /* error */ | 343 | extern int xfs_bmbt_newroot(struct xfs_btree_cur *cur, int *lflags, int *stat); |
588 | xfs_bmbt_newroot( | 344 | |
589 | struct xfs_btree_cur *cur, /* btree cursor */ | 345 | extern void xfs_bmbt_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); |
590 | int *logflags, /* logging flags for inode */ | 346 | extern void xfs_bmbt_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o, |
591 | int *stat); /* return status - 0 fail */ | 347 | xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v); |
592 | 348 | extern void xfs_bmbt_set_blockcount(xfs_bmbt_rec_t *r, xfs_filblks_t v); | |
593 | void | 349 | extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_t *r, xfs_fsblock_t v); |
594 | xfs_bmbt_set_all( | 350 | extern void xfs_bmbt_set_startoff(xfs_bmbt_rec_t *r, xfs_fileoff_t v); |
595 | xfs_bmbt_rec_t *r, | 351 | extern void xfs_bmbt_set_state(xfs_bmbt_rec_t *r, xfs_exntst_t v); |
596 | xfs_bmbt_irec_t *s); | ||
597 | |||
598 | void | ||
599 | xfs_bmbt_set_allf( | ||
600 | xfs_bmbt_rec_t *r, | ||
601 | xfs_fileoff_t o, | ||
602 | xfs_fsblock_t b, | ||
603 | xfs_filblks_t c, | ||
604 | xfs_exntst_t v); | ||
605 | |||
606 | void | ||
607 | xfs_bmbt_set_blockcount( | ||
608 | xfs_bmbt_rec_t *r, | ||
609 | xfs_filblks_t v); | ||
610 | |||
611 | void | ||
612 | xfs_bmbt_set_startblock( | ||
613 | xfs_bmbt_rec_t *r, | ||
614 | xfs_fsblock_t v); | ||
615 | |||
616 | void | ||
617 | xfs_bmbt_set_startoff( | ||
618 | xfs_bmbt_rec_t *r, | ||
619 | xfs_fileoff_t v); | ||
620 | |||
621 | void | ||
622 | xfs_bmbt_set_state( | ||
623 | xfs_bmbt_rec_t *r, | ||
624 | xfs_exntst_t v); | ||
625 | 352 | ||
626 | #ifndef XFS_NATIVE_HOST | 353 | #ifndef XFS_NATIVE_HOST |
627 | void | 354 | extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); |
628 | xfs_bmbt_disk_set_all( | 355 | extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o, |
629 | xfs_bmbt_rec_t *r, | 356 | xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v); |
630 | xfs_bmbt_irec_t *s); | ||
631 | |||
632 | void | ||
633 | xfs_bmbt_disk_set_allf( | ||
634 | xfs_bmbt_rec_t *r, | ||
635 | xfs_fileoff_t o, | ||
636 | xfs_fsblock_t b, | ||
637 | xfs_filblks_t c, | ||
638 | xfs_exntst_t v); | ||
639 | #else | 357 | #else |
640 | #define xfs_bmbt_disk_set_all(r, s) \ | 358 | #define xfs_bmbt_disk_set_all(r, s) xfs_bmbt_set_all(r, s) |
641 | xfs_bmbt_set_all(r, s) | 359 | #define xfs_bmbt_disk_set_allf(r, o, b, c, v) xfs_bmbt_set_allf(r, o, b, c, v) |
642 | #define xfs_bmbt_disk_set_allf(r, o, b, c, v) \ | ||
643 | xfs_bmbt_set_allf(r, o, b, c, v) | ||
644 | #endif /* XFS_NATIVE_HOST */ | 360 | #endif /* XFS_NATIVE_HOST */ |
645 | 361 | ||
646 | void | 362 | extern void xfs_bmbt_to_bmdr(xfs_bmbt_block_t *, int, xfs_bmdr_block_t *, int); |
647 | xfs_bmbt_to_bmdr( | 363 | extern int xfs_bmbt_update(struct xfs_btree_cur *, xfs_fileoff_t, |
648 | xfs_bmbt_block_t *, | 364 | xfs_fsblock_t, xfs_filblks_t, xfs_exntst_t); |
649 | int, | ||
650 | xfs_bmdr_block_t *, | ||
651 | int); | ||
652 | |||
653 | int | ||
654 | xfs_bmbt_update( | ||
655 | struct xfs_btree_cur *, | ||
656 | xfs_fileoff_t, | ||
657 | xfs_fsblock_t, | ||
658 | xfs_filblks_t, | ||
659 | xfs_exntst_t); | ||
660 | 365 | ||
661 | #ifdef DEBUG | 366 | #ifdef DEBUG |
662 | /* | 367 | /* |
663 | * Get the data from the pointed-to record. | 368 | * Get the data from the pointed-to record. |
664 | */ | 369 | */ |
665 | int | 370 | extern int xfs_bmbt_get_rec(struct xfs_btree_cur *, xfs_fileoff_t *, |
666 | xfs_bmbt_get_rec( | 371 | xfs_fsblock_t *, xfs_filblks_t *, |
667 | struct xfs_btree_cur *, | 372 | xfs_exntst_t *, int *); |
668 | xfs_fileoff_t *, | ||
669 | xfs_fsblock_t *, | ||
670 | xfs_filblks_t *, | ||
671 | xfs_exntst_t *, | ||
672 | int *); | ||
673 | #endif | 373 | #endif |
674 | 374 | ||
675 | |||
676 | /* | 375 | /* |
677 | * Search an extent list for the extent which includes block | 376 | * Search an extent list for the extent which includes block |
678 | * bno. | 377 | * bno. |
679 | */ | 378 | */ |
680 | xfs_bmbt_rec_t * | 379 | xfs_bmbt_rec_t *xfs_bmap_do_search_extents(xfs_bmbt_rec_t *, |
681 | xfs_bmap_do_search_extents( | 380 | xfs_extnum_t, xfs_extnum_t, xfs_fileoff_t, int *, |
682 | xfs_bmbt_rec_t *, | 381 | xfs_extnum_t *, xfs_bmbt_irec_t *, xfs_bmbt_irec_t *); |
683 | xfs_extnum_t, | ||
684 | xfs_extnum_t, | ||
685 | xfs_fileoff_t, | ||
686 | int *, | ||
687 | xfs_extnum_t *, | ||
688 | xfs_bmbt_irec_t *, | ||
689 | xfs_bmbt_irec_t *); | ||
690 | 382 | ||
691 | #endif /* __KERNEL__ */ | 383 | #endif /* __KERNEL__ */ |
692 | 384 | ||