Blame view

fs/xfs/xfs_bmap_btree.h 11.2 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
  /*
7b7187698   Nathan Scott   [XFS] Update lice...
2
3
   * Copyright (c) 2000,2002-2005 Silicon Graphics, Inc.
   * All Rights Reserved.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
4
   *
7b7187698   Nathan Scott   [XFS] Update lice...
5
6
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License as
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
7
8
   * published by the Free Software Foundation.
   *
7b7187698   Nathan Scott   [XFS] Update lice...
9
10
11
12
   * This program is distributed in the hope that it would be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
   *
7b7187698   Nathan Scott   [XFS] Update lice...
14
15
16
   * You should have received a copy of the GNU General Public License
   * along with this program; if not, write the Free Software Foundation,
   * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   */
  #ifndef __XFS_BMAP_BTREE_H__
  #define __XFS_BMAP_BTREE_H__
  
  #define XFS_BMAP_MAGIC	0x424d4150	/* 'BMAP' */
  
  struct xfs_btree_cur;
  struct xfs_btree_lblock;
  struct xfs_mount;
  struct xfs_inode;
  
  /*
   * Bmap root header, on-disk form only.
   */
16259e7d9   Christoph Hellwig   [XFS] Endianess a...
31
32
33
  typedef struct xfs_bmdr_block {
  	__be16		bb_level;	/* 0 is a leaf */
  	__be16		bb_numrecs;	/* current # of data records */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  } xfs_bmdr_block_t;
  
  /*
   * Bmap btree record and extent descriptor.
   * For 32-bit kernels,
   *  l0:31 is an extent flag (value 1 indicates non-normal).
   *  l0:0-30 and l1:9-31 are startoff.
   *  l1:0-8, l2:0-31, and l3:21-31 are startblock.
   *  l3:0-20 are blockcount.
   * For 64-bit kernels,
   *  l0:63 is an extent flag (value 1 indicates non-normal).
   *  l0:9-62 are startoff.
   *  l0:0-8 and l1:21-63 are startblock.
   *  l1:0-20 are blockcount.
   */
f016bad6b   Nathan Scott   [XFS] Cleanup som...
49
  #ifndef XFS_NATIVE_HOST
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
  
  #define BMBT_TOTAL_BITLEN	128	/* 128 bits, 16 bytes */
  #define BMBT_EXNTFLAG_BITOFF	0
  #define BMBT_EXNTFLAG_BITLEN	1
  #define BMBT_STARTOFF_BITOFF	(BMBT_EXNTFLAG_BITOFF + BMBT_EXNTFLAG_BITLEN)
  #define BMBT_STARTOFF_BITLEN	54
  #define BMBT_STARTBLOCK_BITOFF	(BMBT_STARTOFF_BITOFF + BMBT_STARTOFF_BITLEN)
  #define BMBT_STARTBLOCK_BITLEN	52
  #define BMBT_BLOCKCOUNT_BITOFF	\
  	(BMBT_STARTBLOCK_BITOFF + BMBT_STARTBLOCK_BITLEN)
  #define BMBT_BLOCKCOUNT_BITLEN	(BMBT_TOTAL_BITLEN - BMBT_BLOCKCOUNT_BITOFF)
  
  #else
  
  #define BMBT_TOTAL_BITLEN	128	/* 128 bits, 16 bytes */
  #define BMBT_EXNTFLAG_BITOFF	63
  #define BMBT_EXNTFLAG_BITLEN	1
  #define BMBT_STARTOFF_BITOFF	(BMBT_EXNTFLAG_BITOFF - BMBT_STARTOFF_BITLEN)
  #define BMBT_STARTOFF_BITLEN	54
  #define BMBT_STARTBLOCK_BITOFF	85 /* 128 - 43 (other 9 is in first word) */
  #define BMBT_STARTBLOCK_BITLEN	52
  #define BMBT_BLOCKCOUNT_BITOFF	64 /* Start of second 64 bit container */
  #define BMBT_BLOCKCOUNT_BITLEN	21
f016bad6b   Nathan Scott   [XFS] Cleanup som...
73
  #endif /* XFS_NATIVE_HOST */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
  
  
  #define BMBT_USE_64	1
  
  typedef struct xfs_bmbt_rec_32
  {
  	__uint32_t		l0, l1, l2, l3;
  } xfs_bmbt_rec_32_t;
  typedef struct xfs_bmbt_rec_64
  {
  	__uint64_t		l0, l1;
  } xfs_bmbt_rec_64_t;
  
  typedef __uint64_t	xfs_bmbt_rec_base_t;	/* use this for casts */
  typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t;
  
  /*
   * Values and macros for delayed-allocation startblock fields.
   */
  #define STARTBLOCKVALBITS	17
  #define STARTBLOCKMASKBITS	(15 + XFS_BIG_BLKNOS * 20)
  #define DSTARTBLOCKMASKBITS	(15 + 20)
  #define STARTBLOCKMASK		\
  	(((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
  #define DSTARTBLOCKMASK		\
  	(((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
a844f4510   Nathan Scott   [XFS] Remove xfs_...
100

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
101
  #define ISNULLSTARTBLOCK(x)	isnullstartblock(x)
a844f4510   Nathan Scott   [XFS] Remove xfs_...
102
103
104
105
  static inline int isnullstartblock(xfs_fsblock_t x)
  {
  	return ((x) & STARTBLOCKMASK) == STARTBLOCKMASK;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
106
  #define ISNULLDSTARTBLOCK(x)	isnulldstartblock(x)
a844f4510   Nathan Scott   [XFS] Remove xfs_...
107
108
109
110
  static inline int isnulldstartblock(xfs_dfsbno_t x)
  {
  	return ((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
111
  #define NULLSTARTBLOCK(k)	nullstartblock(k)
a844f4510   Nathan Scott   [XFS] Remove xfs_...
112
113
114
115
116
  static inline xfs_fsblock_t nullstartblock(int k)
  {
  	ASSERT(k < (1 << STARTBLOCKVALBITS));
  	return STARTBLOCKMASK | (k);
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
117
  #define STARTBLOCKVAL(x)	startblockval(x)
a844f4510   Nathan Scott   [XFS] Remove xfs_...
118
119
120
121
  static inline xfs_filblks_t startblockval(xfs_fsblock_t x)
  {
  	return (xfs_filblks_t)((x) & ~STARTBLOCKMASK);
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
  
  /*
   * Possible extent formats.
   */
  typedef enum {
  	XFS_EXTFMT_NOSTATE = 0,
  	XFS_EXTFMT_HASSTATE
  } xfs_exntfmt_t;
  
  /*
   * Possible extent states.
   */
  typedef enum {
  	XFS_EXT_NORM, XFS_EXT_UNWRITTEN,
  	XFS_EXT_DMAPI_OFFLINE, XFS_EXT_INVALID
  } xfs_exntst_t;
  
  /*
   * Extent state and extent format macros.
   */
a844f4510   Nathan Scott   [XFS] Remove xfs_...
142
143
144
  #define XFS_EXTFMT_INODE(x)	\
  	(XFS_SB_VERSION_HASEXTFLGBIT(&((x)->i_mount->m_sb)) ? \
  		XFS_EXTFMT_HASSTATE : XFS_EXTFMT_NOSTATE)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
  #define ISUNWRITTEN(x)	((x)->br_state == XFS_EXT_UNWRITTEN)
  
  /*
   * Incore version of above.
   */
  typedef struct xfs_bmbt_irec
  {
  	xfs_fileoff_t	br_startoff;	/* starting file offset */
  	xfs_fsblock_t	br_startblock;	/* starting block number */
  	xfs_filblks_t	br_blockcount;	/* number of blocks */
  	xfs_exntst_t	br_state;	/* extent state */
  } xfs_bmbt_irec_t;
  
  /*
   * Key structure for non-leaf levels of the tree.
   */
8801bb99e   Christoph Hellwig   [XFS] endianess a...
161
162
  typedef struct xfs_bmbt_key {
  	__be64		br_startoff;	/* starting file offset */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
163
  } xfs_bmbt_key_t, xfs_bmdr_key_t;
397b5208d   Christoph Hellwig   [XFS] endianess a...
164
165
166
167
  /* btree pointer type */
  typedef __be64 xfs_bmbt_ptr_t, xfs_bmdr_ptr_t;
  
  /* btree block header type */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
168
  typedef struct xfs_btree_lblock xfs_bmbt_block_t;
a844f4510   Nathan Scott   [XFS] Remove xfs_...
169
  #define XFS_BUF_TO_BMBT_BLOCK(bp)	((xfs_bmbt_block_t *)XFS_BUF_PTR(bp))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
170

a844f4510   Nathan Scott   [XFS] Remove xfs_...
171
172
  #define XFS_BMAP_RBLOCK_DSIZE(lev,cur)	((cur)->bc_private.b.forksize)
  #define XFS_BMAP_RBLOCK_ISIZE(lev,cur)	\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
173
  	((int)XFS_IFORK_PTR((cur)->bc_private.b.ip, \
a844f4510   Nathan Scott   [XFS] Remove xfs_...
174
  		    (cur)->bc_private.b.whichfork)->if_broot_bytes)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
175

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
176
  #define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) \
a844f4510   Nathan Scott   [XFS] Remove xfs_...
177
  	(((lev) == (cur)->bc_nlevels - 1 ? \
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
178
179
  		XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \
  			xfs_bmdr, (lev) == 0) : \
a844f4510   Nathan Scott   [XFS] Remove xfs_...
180
  		((cur)->bc_mp->m_bmap_dmxr[(lev) != 0])))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
181
  #define XFS_BMAP_BLOCK_IMAXRECS(lev,cur) \
a844f4510   Nathan Scott   [XFS] Remove xfs_...
182
183
184
185
  	(((lev) == (cur)->bc_nlevels - 1 ? \
  			XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur),\
  				xfs_bmbt, (lev) == 0) : \
  			((cur)->bc_mp->m_bmap_dmxr[(lev) != 0])))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
186

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
187
  #define XFS_BMAP_BLOCK_DMINRECS(lev,cur) \
a844f4510   Nathan Scott   [XFS] Remove xfs_...
188
189
190
191
  	(((lev) == (cur)->bc_nlevels - 1 ? \
  			XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur),\
  				xfs_bmdr, (lev) == 0) : \
  			((cur)->bc_mp->m_bmap_dmnr[(lev) != 0])))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
192
  #define XFS_BMAP_BLOCK_IMINRECS(lev,cur) \
a844f4510   Nathan Scott   [XFS] Remove xfs_...
193
194
195
196
  	(((lev) == (cur)->bc_nlevels - 1 ? \
  			XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur),\
  				xfs_bmbt, (lev) == 0) : \
  			((cur)->bc_mp->m_bmap_dmnr[(lev) != 0])))
2c36ddeda   Eric Sandeen   [XFS] Remove unus...
197
198
199
  #define XFS_BMAP_REC_DADDR(bb,i,cur)	(XFS_BTREE_REC_ADDR(xfs_bmbt, bb, i))
  
  #define XFS_BMAP_REC_IADDR(bb,i,cur)	(XFS_BTREE_REC_ADDR(xfs_bmbt, bb, i))
a844f4510   Nathan Scott   [XFS] Remove xfs_...
200
201
  
  #define XFS_BMAP_KEY_DADDR(bb,i,cur)	\
2c36ddeda   Eric Sandeen   [XFS] Remove unus...
202
  	(XFS_BTREE_KEY_ADDR(xfs_bmbt, bb, i))
a844f4510   Nathan Scott   [XFS] Remove xfs_...
203
  #define XFS_BMAP_KEY_IADDR(bb,i,cur)	\
2c36ddeda   Eric Sandeen   [XFS] Remove unus...
204
  	(XFS_BTREE_KEY_ADDR(xfs_bmbt, bb, i))
a844f4510   Nathan Scott   [XFS] Remove xfs_...
205
206
  
  #define XFS_BMAP_PTR_DADDR(bb,i,cur)	\
2c36ddeda   Eric Sandeen   [XFS] Remove unus...
207
  	(XFS_BTREE_PTR_ADDR(xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS(	\
16259e7d9   Christoph Hellwig   [XFS] Endianess a...
208
  				be16_to_cpu((bb)->bb_level), cur)))
a844f4510   Nathan Scott   [XFS] Remove xfs_...
209
  #define XFS_BMAP_PTR_IADDR(bb,i,cur)	\
2c36ddeda   Eric Sandeen   [XFS] Remove unus...
210
  	(XFS_BTREE_PTR_ADDR(xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS(	\
16259e7d9   Christoph Hellwig   [XFS] Endianess a...
211
  				be16_to_cpu((bb)->bb_level), cur)))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
212
213
214
215
216
  
  /*
   * These are to be used when we know the size of the block and
   * we don't have a cursor.
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
217
  #define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) \
2c36ddeda   Eric Sandeen   [XFS] Remove unus...
218
  	(XFS_BTREE_REC_ADDR(xfs_bmbt,bb,i))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
219
  #define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) \
2c36ddeda   Eric Sandeen   [XFS] Remove unus...
220
  	(XFS_BTREE_KEY_ADDR(xfs_bmbt,bb,i))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
221
  #define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) \
2c36ddeda   Eric Sandeen   [XFS] Remove unus...
222
  	(XFS_BTREE_PTR_ADDR(xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)))
a844f4510   Nathan Scott   [XFS] Remove xfs_...
223

16259e7d9   Christoph Hellwig   [XFS] Endianess a...
224
  #define XFS_BMAP_BROOT_NUMRECS(bb)	be16_to_cpu((bb)->bb_numrecs)
a844f4510   Nathan Scott   [XFS] Remove xfs_...
225
  #define XFS_BMAP_BROOT_MAXRECS(sz)	XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
226

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
227
  #define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \
a844f4510   Nathan Scott   [XFS] Remove xfs_...
228
229
  	(int)(sizeof(xfs_bmbt_block_t) + \
  	       ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
230
  #define XFS_BMAP_BROOT_SPACE(bb) \
16259e7d9   Christoph Hellwig   [XFS] Endianess a...
231
  	(XFS_BMAP_BROOT_SPACE_CALC(be16_to_cpu((bb)->bb_numrecs)))
a844f4510   Nathan Scott   [XFS] Remove xfs_...
232
233
234
  #define XFS_BMDR_SPACE_CALC(nrecs) \
  	(int)(sizeof(xfs_bmdr_block_t) + \
  	       ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
235
236
237
238
  
  /*
   * Maximum number of bmap btree levels.
   */
a844f4510   Nathan Scott   [XFS] Remove xfs_...
239
  #define XFS_BM_MAXLEVELS(mp,w)		((mp)->m_bm_maxlevels[(w)])
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
240

a844f4510   Nathan Scott   [XFS] Remove xfs_...
241
  #define XFS_BMAP_SANITY_CHECK(mp,bb,level) \
16259e7d9   Christoph Hellwig   [XFS] Endianess a...
242
243
244
245
  	(be32_to_cpu((bb)->bb_magic) == XFS_BMAP_MAGIC && \
  	 be16_to_cpu((bb)->bb_level) == level && \
  	 be16_to_cpu((bb)->bb_numrecs) > 0 && \
  	 be16_to_cpu((bb)->bb_numrecs) <= (mp)->m_bmap_dmxr[(level) != 0])
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
  
  
  #ifdef __KERNEL__
  
  #if defined(XFS_BMBT_TRACE)
  /*
   * Trace buffer entry types.
   */
  #define XFS_BMBT_KTRACE_ARGBI	1
  #define XFS_BMBT_KTRACE_ARGBII	2
  #define XFS_BMBT_KTRACE_ARGFFFI 3
  #define XFS_BMBT_KTRACE_ARGI	4
  #define XFS_BMBT_KTRACE_ARGIFK	5
  #define XFS_BMBT_KTRACE_ARGIFR	6
  #define XFS_BMBT_KTRACE_ARGIK	7
  #define XFS_BMBT_KTRACE_CUR	8
  
  #define XFS_BMBT_TRACE_SIZE	4096	/* size of global trace buffer */
  #define XFS_BMBT_KTRACE_SIZE	32	/* size of per-inode trace buffer */
  extern ktrace_t	*xfs_bmbt_trace_buf;
  #endif
  
  /*
   * Prototypes for xfs_bmap.c to call.
   */
a844f4510   Nathan Scott   [XFS] Remove xfs_...
271
272
273
274
275
276
277
278
279
280
  extern void xfs_bmdr_to_bmbt(xfs_bmdr_block_t *, int, xfs_bmbt_block_t *, int);
  extern int xfs_bmbt_decrement(struct xfs_btree_cur *, int, int *);
  extern int xfs_bmbt_delete(struct xfs_btree_cur *, int *);
  extern void xfs_bmbt_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
  extern xfs_bmbt_block_t *xfs_bmbt_get_block(struct xfs_btree_cur *cur,
  						int, struct xfs_buf **bpp);
  extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_t *r);
  extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_t *r);
  extern xfs_fileoff_t xfs_bmbt_get_startoff(xfs_bmbt_rec_t *r);
  extern xfs_exntst_t xfs_bmbt_get_state(xfs_bmbt_rec_t *r);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
281

f016bad6b   Nathan Scott   [XFS] Cleanup som...
282
  #ifndef XFS_NATIVE_HOST
a844f4510   Nathan Scott   [XFS] Remove xfs_...
283
  extern void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
a844f4510   Nathan Scott   [XFS] Remove xfs_...
284
  extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(xfs_bmbt_rec_t *r);
a844f4510   Nathan Scott   [XFS] Remove xfs_...
285
286
287
  extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r);
  #else
  #define xfs_bmbt_disk_get_all(r, s)	xfs_bmbt_get_all(r, s)
a844f4510   Nathan Scott   [XFS] Remove xfs_...
288
  #define xfs_bmbt_disk_get_blockcount(r)	xfs_bmbt_get_blockcount(r)
a844f4510   Nathan Scott   [XFS] Remove xfs_...
289
  #define xfs_bmbt_disk_get_startoff(r)	xfs_bmbt_get_startoff(r)
f016bad6b   Nathan Scott   [XFS] Cleanup som...
290
  #endif /* XFS_NATIVE_HOST */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
291

a844f4510   Nathan Scott   [XFS] Remove xfs_...
292
293
294
295
296
297
298
299
300
  extern int xfs_bmbt_increment(struct xfs_btree_cur *, int, int *);
  extern int xfs_bmbt_insert(struct xfs_btree_cur *, int *);
  extern void xfs_bmbt_log_block(struct xfs_btree_cur *, struct xfs_buf *, int);
  extern void xfs_bmbt_log_recs(struct xfs_btree_cur *, struct xfs_buf *, int,
  				int);
  extern int xfs_bmbt_lookup_eq(struct xfs_btree_cur *, xfs_fileoff_t,
  				xfs_fsblock_t, xfs_filblks_t, int *);
  extern int xfs_bmbt_lookup_ge(struct xfs_btree_cur *, xfs_fileoff_t,
  				xfs_fsblock_t, xfs_filblks_t, int *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
301

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
302
303
304
305
  /*
   * Give the bmap btree a new root block.  Copy the old broot contents
   * down into a real block and make the broot point to it.
   */
a844f4510   Nathan Scott   [XFS] Remove xfs_...
306
307
308
309
310
311
312
313
314
  extern int xfs_bmbt_newroot(struct xfs_btree_cur *cur, int *lflags, int *stat);
  
  extern void xfs_bmbt_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
  extern void xfs_bmbt_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o,
  			xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v);
  extern void xfs_bmbt_set_blockcount(xfs_bmbt_rec_t *r, xfs_filblks_t v);
  extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_t *r, xfs_fsblock_t v);
  extern void xfs_bmbt_set_startoff(xfs_bmbt_rec_t *r, xfs_fileoff_t v);
  extern void xfs_bmbt_set_state(xfs_bmbt_rec_t *r, xfs_exntst_t v);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
315

f016bad6b   Nathan Scott   [XFS] Cleanup som...
316
  #ifndef XFS_NATIVE_HOST
a844f4510   Nathan Scott   [XFS] Remove xfs_...
317
318
319
  extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
  extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o,
  			xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
320
  #else
a844f4510   Nathan Scott   [XFS] Remove xfs_...
321
322
  #define xfs_bmbt_disk_set_all(r, s)		xfs_bmbt_set_all(r, s)
  #define xfs_bmbt_disk_set_allf(r, o, b, c, v)	xfs_bmbt_set_allf(r, o, b, c, v)
f016bad6b   Nathan Scott   [XFS] Cleanup som...
323
  #endif /* XFS_NATIVE_HOST */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
324

a844f4510   Nathan Scott   [XFS] Remove xfs_...
325
326
327
  extern void xfs_bmbt_to_bmdr(xfs_bmbt_block_t *, int, xfs_bmdr_block_t *, int);
  extern int xfs_bmbt_update(struct xfs_btree_cur *, xfs_fileoff_t,
  				xfs_fsblock_t, xfs_filblks_t, xfs_exntst_t);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
328

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
329
330
331
  #endif	/* __KERNEL__ */
  
  #endif	/* __XFS_BMAP_BTREE_H__ */