diff options
author | Dave Chinner <dchinner@redhat.com> | 2013-10-22 19:51:50 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-10-23 17:28:49 -0400 |
commit | a4fbe6ab1e7abecf42b75e9c73701ed33b4ab03b (patch) | |
tree | 24753fd80e3ee2e8038869858d108db4c078a4b0 /fs/xfs/xfs_bmap_btree.h | |
parent | 239880ef6454ccff2ba8d762c3f86e8278f0ce1c (diff) |
xfs: decouple inode and bmap btree header files
Currently the xfs_inode.h header has a dependency on the definition
of the BMAP btree records as the inode fork includes an array of
xfs_bmbt_rec_host_t objects in it's definition.
Move all the btree format definitions from xfs_btree.h,
xfs_bmap_btree.h, xfs_alloc_btree.h and xfs_ialloc_btree.h to
xfs_format.h to continue the process of centralising the on-disk
format definitions. With this done, the xfs inode definitions are no
longer dependent on btree header files.
The enables a massive culling of unnecessary includes, with close to
200 #include directives removed from the XFS kernel code base.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_bmap_btree.h')
-rw-r--r-- | fs/xfs/xfs_bmap_btree.h | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h index e2b0768a89ba..6e42e1e50b89 100644 --- a/fs/xfs/xfs_bmap_btree.h +++ b/fs/xfs/xfs_bmap_btree.h | |||
@@ -18,9 +18,6 @@ | |||
18 | #ifndef __XFS_BMAP_BTREE_H__ | 18 | #ifndef __XFS_BMAP_BTREE_H__ |
19 | #define __XFS_BMAP_BTREE_H__ | 19 | #define __XFS_BMAP_BTREE_H__ |
20 | 20 | ||
21 | #define XFS_BMAP_MAGIC 0x424d4150 /* 'BMAP' */ | ||
22 | #define XFS_BMAP_CRC_MAGIC 0x424d4133 /* 'BMA3' */ | ||
23 | |||
24 | struct xfs_btree_cur; | 21 | struct xfs_btree_cur; |
25 | struct xfs_btree_block; | 22 | struct xfs_btree_block; |
26 | struct xfs_mount; | 23 | struct xfs_mount; |
@@ -28,85 +25,6 @@ struct xfs_inode; | |||
28 | struct xfs_trans; | 25 | struct xfs_trans; |
29 | 26 | ||
30 | /* | 27 | /* |
31 | * Bmap root header, on-disk form only. | ||
32 | */ | ||
33 | typedef struct xfs_bmdr_block { | ||
34 | __be16 bb_level; /* 0 is a leaf */ | ||
35 | __be16 bb_numrecs; /* current # of data records */ | ||
36 | } xfs_bmdr_block_t; | ||
37 | |||
38 | /* | ||
39 | * Bmap btree record and extent descriptor. | ||
40 | * l0:63 is an extent flag (value 1 indicates non-normal). | ||
41 | * l0:9-62 are startoff. | ||
42 | * l0:0-8 and l1:21-63 are startblock. | ||
43 | * l1:0-20 are blockcount. | ||
44 | */ | ||
45 | #define BMBT_EXNTFLAG_BITLEN 1 | ||
46 | #define BMBT_STARTOFF_BITLEN 54 | ||
47 | #define BMBT_STARTBLOCK_BITLEN 52 | ||
48 | #define BMBT_BLOCKCOUNT_BITLEN 21 | ||
49 | |||
50 | typedef struct xfs_bmbt_rec { | ||
51 | __be64 l0, l1; | ||
52 | } xfs_bmbt_rec_t; | ||
53 | |||
54 | typedef __uint64_t xfs_bmbt_rec_base_t; /* use this for casts */ | ||
55 | typedef xfs_bmbt_rec_t xfs_bmdr_rec_t; | ||
56 | |||
57 | typedef struct xfs_bmbt_rec_host { | ||
58 | __uint64_t l0, l1; | ||
59 | } xfs_bmbt_rec_host_t; | ||
60 | |||
61 | /* | ||
62 | * Values and macros for delayed-allocation startblock fields. | ||
63 | */ | ||
64 | #define STARTBLOCKVALBITS 17 | ||
65 | #define STARTBLOCKMASKBITS (15 + XFS_BIG_BLKNOS * 20) | ||
66 | #define DSTARTBLOCKMASKBITS (15 + 20) | ||
67 | #define STARTBLOCKMASK \ | ||
68 | (((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS) | ||
69 | #define DSTARTBLOCKMASK \ | ||
70 | (((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS) | ||
71 | |||
72 | static inline int isnullstartblock(xfs_fsblock_t x) | ||
73 | { | ||
74 | return ((x) & STARTBLOCKMASK) == STARTBLOCKMASK; | ||
75 | } | ||
76 | |||
77 | static inline int isnulldstartblock(xfs_dfsbno_t x) | ||
78 | { | ||
79 | return ((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK; | ||
80 | } | ||
81 | |||
82 | static inline xfs_fsblock_t nullstartblock(int k) | ||
83 | { | ||
84 | ASSERT(k < (1 << STARTBLOCKVALBITS)); | ||
85 | return STARTBLOCKMASK | (k); | ||
86 | } | ||
87 | |||
88 | static inline xfs_filblks_t startblockval(xfs_fsblock_t x) | ||
89 | { | ||
90 | return (xfs_filblks_t)((x) & ~STARTBLOCKMASK); | ||
91 | } | ||
92 | |||
93 | /* | ||
94 | * Possible extent formats. | ||
95 | */ | ||
96 | typedef enum { | ||
97 | XFS_EXTFMT_NOSTATE = 0, | ||
98 | XFS_EXTFMT_HASSTATE | ||
99 | } xfs_exntfmt_t; | ||
100 | |||
101 | /* | ||
102 | * Possible extent states. | ||
103 | */ | ||
104 | typedef enum { | ||
105 | XFS_EXT_NORM, XFS_EXT_UNWRITTEN, | ||
106 | XFS_EXT_DMAPI_OFFLINE, XFS_EXT_INVALID | ||
107 | } xfs_exntst_t; | ||
108 | |||
109 | /* | ||
110 | * Extent state and extent format macros. | 28 | * Extent state and extent format macros. |
111 | */ | 29 | */ |
112 | #define XFS_EXTFMT_INODE(x) \ | 30 | #define XFS_EXTFMT_INODE(x) \ |
@@ -115,27 +33,6 @@ typedef enum { | |||
115 | #define ISUNWRITTEN(x) ((x)->br_state == XFS_EXT_UNWRITTEN) | 33 | #define ISUNWRITTEN(x) ((x)->br_state == XFS_EXT_UNWRITTEN) |
116 | 34 | ||
117 | /* | 35 | /* |
118 | * Incore version of above. | ||
119 | */ | ||
120 | typedef struct xfs_bmbt_irec | ||
121 | { | ||
122 | xfs_fileoff_t br_startoff; /* starting file offset */ | ||
123 | xfs_fsblock_t br_startblock; /* starting block number */ | ||
124 | xfs_filblks_t br_blockcount; /* number of blocks */ | ||
125 | xfs_exntst_t br_state; /* extent state */ | ||
126 | } xfs_bmbt_irec_t; | ||
127 | |||
128 | /* | ||
129 | * Key structure for non-leaf levels of the tree. | ||
130 | */ | ||
131 | typedef struct xfs_bmbt_key { | ||
132 | __be64 br_startoff; /* starting file offset */ | ||
133 | } xfs_bmbt_key_t, xfs_bmdr_key_t; | ||
134 | |||
135 | /* btree pointer type */ | ||
136 | typedef __be64 xfs_bmbt_ptr_t, xfs_bmdr_ptr_t; | ||
137 | |||
138 | /* | ||
139 | * Btree block header size depends on a superblock flag. | 36 | * Btree block header size depends on a superblock flag. |
140 | */ | 37 | */ |
141 | #define XFS_BMBT_BLOCK_LEN(mp) \ | 38 | #define XFS_BMBT_BLOCK_LEN(mp) \ |