diff options
Diffstat (limited to 'fs/xfs/xfs_bmap_btree.h')
-rw-r--r-- | fs/xfs/xfs_bmap_btree.h | 68 |
1 files changed, 16 insertions, 52 deletions
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h index a77b1b753d0..2d950e97591 100644 --- a/fs/xfs/xfs_bmap_btree.h +++ b/fs/xfs/xfs_bmap_btree.h | |||
@@ -35,45 +35,16 @@ typedef struct xfs_bmdr_block { | |||
35 | 35 | ||
36 | /* | 36 | /* |
37 | * Bmap btree record and extent descriptor. | 37 | * Bmap btree record and extent descriptor. |
38 | * For 32-bit kernels, | ||
39 | * l0:31 is an extent flag (value 1 indicates non-normal). | ||
40 | * l0:0-30 and l1:9-31 are startoff. | ||
41 | * l1:0-8, l2:0-31, and l3:21-31 are startblock. | ||
42 | * l3:0-20 are blockcount. | ||
43 | * For 64-bit kernels, | ||
44 | * l0:63 is an extent flag (value 1 indicates non-normal). | 38 | * l0:63 is an extent flag (value 1 indicates non-normal). |
45 | * l0:9-62 are startoff. | 39 | * l0:9-62 are startoff. |
46 | * l0:0-8 and l1:21-63 are startblock. | 40 | * l0:0-8 and l1:21-63 are startblock. |
47 | * l1:0-20 are blockcount. | 41 | * l1:0-20 are blockcount. |
48 | */ | 42 | */ |
49 | |||
50 | #ifndef XFS_NATIVE_HOST | ||
51 | |||
52 | #define BMBT_TOTAL_BITLEN 128 /* 128 bits, 16 bytes */ | ||
53 | #define BMBT_EXNTFLAG_BITOFF 0 | ||
54 | #define BMBT_EXNTFLAG_BITLEN 1 | 43 | #define BMBT_EXNTFLAG_BITLEN 1 |
55 | #define BMBT_STARTOFF_BITOFF (BMBT_EXNTFLAG_BITOFF + BMBT_EXNTFLAG_BITLEN) | ||
56 | #define BMBT_STARTOFF_BITLEN 54 | 44 | #define BMBT_STARTOFF_BITLEN 54 |
57 | #define BMBT_STARTBLOCK_BITOFF (BMBT_STARTOFF_BITOFF + BMBT_STARTOFF_BITLEN) | ||
58 | #define BMBT_STARTBLOCK_BITLEN 52 | 45 | #define BMBT_STARTBLOCK_BITLEN 52 |
59 | #define BMBT_BLOCKCOUNT_BITOFF \ | ||
60 | (BMBT_STARTBLOCK_BITOFF + BMBT_STARTBLOCK_BITLEN) | ||
61 | #define BMBT_BLOCKCOUNT_BITLEN (BMBT_TOTAL_BITLEN - BMBT_BLOCKCOUNT_BITOFF) | ||
62 | |||
63 | #else | ||
64 | |||
65 | #define BMBT_TOTAL_BITLEN 128 /* 128 bits, 16 bytes */ | ||
66 | #define BMBT_EXNTFLAG_BITOFF 63 | ||
67 | #define BMBT_EXNTFLAG_BITLEN 1 | ||
68 | #define BMBT_STARTOFF_BITOFF (BMBT_EXNTFLAG_BITOFF - BMBT_STARTOFF_BITLEN) | ||
69 | #define BMBT_STARTOFF_BITLEN 54 | ||
70 | #define BMBT_STARTBLOCK_BITOFF 85 /* 128 - 43 (other 9 is in first word) */ | ||
71 | #define BMBT_STARTBLOCK_BITLEN 52 | ||
72 | #define BMBT_BLOCKCOUNT_BITOFF 64 /* Start of second 64 bit container */ | ||
73 | #define BMBT_BLOCKCOUNT_BITLEN 21 | 46 | #define BMBT_BLOCKCOUNT_BITLEN 21 |
74 | 47 | ||
75 | #endif /* XFS_NATIVE_HOST */ | ||
76 | |||
77 | 48 | ||
78 | #define BMBT_USE_64 1 | 49 | #define BMBT_USE_64 1 |
79 | 50 | ||
@@ -83,12 +54,16 @@ typedef struct xfs_bmbt_rec_32 | |||
83 | } xfs_bmbt_rec_32_t; | 54 | } xfs_bmbt_rec_32_t; |
84 | typedef struct xfs_bmbt_rec_64 | 55 | typedef struct xfs_bmbt_rec_64 |
85 | { | 56 | { |
86 | __uint64_t l0, l1; | 57 | __be64 l0, l1; |
87 | } xfs_bmbt_rec_64_t; | 58 | } xfs_bmbt_rec_64_t; |
88 | 59 | ||
89 | typedef __uint64_t xfs_bmbt_rec_base_t; /* use this for casts */ | 60 | typedef __uint64_t xfs_bmbt_rec_base_t; /* use this for casts */ |
90 | typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t; | 61 | typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t; |
91 | 62 | ||
63 | typedef struct xfs_bmbt_rec_host { | ||
64 | __uint64_t l0, l1; | ||
65 | } xfs_bmbt_rec_host_t; | ||
66 | |||
92 | /* | 67 | /* |
93 | * Values and macros for delayed-allocation startblock fields. | 68 | * Values and macros for delayed-allocation startblock fields. |
94 | */ | 69 | */ |
@@ -281,23 +256,17 @@ extern ktrace_t *xfs_bmbt_trace_buf; | |||
281 | extern void xfs_bmdr_to_bmbt(xfs_bmdr_block_t *, int, xfs_bmbt_block_t *, int); | 256 | extern void xfs_bmdr_to_bmbt(xfs_bmdr_block_t *, int, xfs_bmbt_block_t *, int); |
282 | extern int xfs_bmbt_decrement(struct xfs_btree_cur *, int, int *); | 257 | extern int xfs_bmbt_decrement(struct xfs_btree_cur *, int, int *); |
283 | extern int xfs_bmbt_delete(struct xfs_btree_cur *, int *); | 258 | extern int xfs_bmbt_delete(struct xfs_btree_cur *, int *); |
284 | extern void xfs_bmbt_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); | 259 | extern void xfs_bmbt_get_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s); |
285 | extern xfs_bmbt_block_t *xfs_bmbt_get_block(struct xfs_btree_cur *cur, | 260 | extern xfs_bmbt_block_t *xfs_bmbt_get_block(struct xfs_btree_cur *cur, |
286 | int, struct xfs_buf **bpp); | 261 | int, struct xfs_buf **bpp); |
287 | extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_t *r); | 262 | extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_host_t *r); |
288 | extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_t *r); | 263 | extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_host_t *r); |
289 | extern xfs_fileoff_t xfs_bmbt_get_startoff(xfs_bmbt_rec_t *r); | 264 | extern xfs_fileoff_t xfs_bmbt_get_startoff(xfs_bmbt_rec_host_t *r); |
290 | extern xfs_exntst_t xfs_bmbt_get_state(xfs_bmbt_rec_t *r); | 265 | extern xfs_exntst_t xfs_bmbt_get_state(xfs_bmbt_rec_host_t *r); |
291 | 266 | ||
292 | #ifndef XFS_NATIVE_HOST | ||
293 | extern void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); | 267 | extern void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); |
294 | extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(xfs_bmbt_rec_t *r); | 268 | extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(xfs_bmbt_rec_t *r); |
295 | extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r); | 269 | extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r); |
296 | #else | ||
297 | #define xfs_bmbt_disk_get_all(r, s) xfs_bmbt_get_all(r, s) | ||
298 | #define xfs_bmbt_disk_get_blockcount(r) xfs_bmbt_get_blockcount(r) | ||
299 | #define xfs_bmbt_disk_get_startoff(r) xfs_bmbt_get_startoff(r) | ||
300 | #endif /* XFS_NATIVE_HOST */ | ||
301 | 270 | ||
302 | extern int xfs_bmbt_increment(struct xfs_btree_cur *, int, int *); | 271 | extern int xfs_bmbt_increment(struct xfs_btree_cur *, int, int *); |
303 | extern int xfs_bmbt_insert(struct xfs_btree_cur *, int *); | 272 | extern int xfs_bmbt_insert(struct xfs_btree_cur *, int *); |
@@ -315,22 +284,17 @@ extern int xfs_bmbt_lookup_ge(struct xfs_btree_cur *, xfs_fileoff_t, | |||
315 | */ | 284 | */ |
316 | extern int xfs_bmbt_newroot(struct xfs_btree_cur *cur, int *lflags, int *stat); | 285 | extern int xfs_bmbt_newroot(struct xfs_btree_cur *cur, int *lflags, int *stat); |
317 | 286 | ||
318 | extern void xfs_bmbt_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); | 287 | extern void xfs_bmbt_set_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s); |
319 | extern void xfs_bmbt_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o, | 288 | extern void xfs_bmbt_set_allf(xfs_bmbt_rec_host_t *r, xfs_fileoff_t o, |
320 | xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v); | 289 | xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v); |
321 | extern void xfs_bmbt_set_blockcount(xfs_bmbt_rec_t *r, xfs_filblks_t v); | 290 | extern void xfs_bmbt_set_blockcount(xfs_bmbt_rec_host_t *r, xfs_filblks_t v); |
322 | extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_t *r, xfs_fsblock_t v); | 291 | extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_host_t *r, xfs_fsblock_t v); |
323 | extern void xfs_bmbt_set_startoff(xfs_bmbt_rec_t *r, xfs_fileoff_t v); | 292 | extern void xfs_bmbt_set_startoff(xfs_bmbt_rec_host_t *r, xfs_fileoff_t v); |
324 | extern void xfs_bmbt_set_state(xfs_bmbt_rec_t *r, xfs_exntst_t v); | 293 | extern void xfs_bmbt_set_state(xfs_bmbt_rec_host_t *r, xfs_exntst_t v); |
325 | 294 | ||
326 | #ifndef XFS_NATIVE_HOST | ||
327 | extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); | 295 | extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); |
328 | extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o, | 296 | extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o, |
329 | xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v); | 297 | xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v); |
330 | #else | ||
331 | #define xfs_bmbt_disk_set_all(r, s) xfs_bmbt_set_all(r, s) | ||
332 | #define xfs_bmbt_disk_set_allf(r, o, b, c, v) xfs_bmbt_set_allf(r, o, b, c, v) | ||
333 | #endif /* XFS_NATIVE_HOST */ | ||
334 | 298 | ||
335 | extern void xfs_bmbt_to_bmdr(xfs_bmbt_block_t *, int, xfs_bmdr_block_t *, int); | 299 | extern void xfs_bmbt_to_bmdr(xfs_bmbt_block_t *, int, xfs_bmdr_block_t *, int); |
336 | extern int xfs_bmbt_update(struct xfs_btree_cur *, xfs_fileoff_t, | 300 | extern int xfs_bmbt_update(struct xfs_btree_cur *, xfs_fileoff_t, |