aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-07-13 10:33:55 -0400
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-07-22 21:02:15 -0400
commit7c397a81fe90c0445df2873700d14e82cca5fbc8 (patch)
tree99e4ecd31923cbdcaaeabb7cf54f548a2716415f
parent5ad2686e9266f24a0bb76b01d5c3ae29b4e149fe (diff)
nilfs2: eliminate inline keywords in btree implementation
This removes all inline uses from btree.c. Gcc now agressively apply inline expansion even for the functions declared without the keyword; the inline use in btree.c looks excessive. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
-rw-r--r--fs/nilfs2/btree.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index 7089d9041146..6462c7026479 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -106,48 +106,45 @@ static int nilfs_btree_get_new_block(const struct nilfs_bmap *btree,
106 return 0; 106 return 0;
107} 107}
108 108
109static inline int 109static int nilfs_btree_node_get_flags(const struct nilfs_btree_node *node)
110nilfs_btree_node_get_flags(const struct nilfs_btree_node *node)
111{ 110{
112 return node->bn_flags; 111 return node->bn_flags;
113} 112}
114 113
115static inline void 114static void
116nilfs_btree_node_set_flags(struct nilfs_btree_node *node, int flags) 115nilfs_btree_node_set_flags(struct nilfs_btree_node *node, int flags)
117{ 116{
118 node->bn_flags = flags; 117 node->bn_flags = flags;
119} 118}
120 119
121static inline int nilfs_btree_node_root(const struct nilfs_btree_node *node) 120static int nilfs_btree_node_root(const struct nilfs_btree_node *node)
122{ 121{
123 return nilfs_btree_node_get_flags(node) & NILFS_BTREE_NODE_ROOT; 122 return nilfs_btree_node_get_flags(node) & NILFS_BTREE_NODE_ROOT;
124} 123}
125 124
126static inline int 125static int nilfs_btree_node_get_level(const struct nilfs_btree_node *node)
127nilfs_btree_node_get_level(const struct nilfs_btree_node *node)
128{ 126{
129 return node->bn_level; 127 return node->bn_level;
130} 128}
131 129
132static inline void 130static void
133nilfs_btree_node_set_level(struct nilfs_btree_node *node, int level) 131nilfs_btree_node_set_level(struct nilfs_btree_node *node, int level)
134{ 132{
135 node->bn_level = level; 133 node->bn_level = level;
136} 134}
137 135
138static inline int 136static int nilfs_btree_node_get_nchildren(const struct nilfs_btree_node *node)
139nilfs_btree_node_get_nchildren(const struct nilfs_btree_node *node)
140{ 137{
141 return le16_to_cpu(node->bn_nchildren); 138 return le16_to_cpu(node->bn_nchildren);
142} 139}
143 140
144static inline void 141static void
145nilfs_btree_node_set_nchildren(struct nilfs_btree_node *node, int nchildren) 142nilfs_btree_node_set_nchildren(struct nilfs_btree_node *node, int nchildren)
146{ 143{
147 node->bn_nchildren = cpu_to_le16(nchildren); 144 node->bn_nchildren = cpu_to_le16(nchildren);
148} 145}
149 146
150static inline int nilfs_btree_node_size(const struct nilfs_bmap *btree) 147static int nilfs_btree_node_size(const struct nilfs_bmap *btree)
151{ 148{
152 return 1 << btree->b_inode->i_blkbits; 149 return 1 << btree->b_inode->i_blkbits;
153} 150}
@@ -157,7 +154,7 @@ static int nilfs_btree_nchildren_per_block(const struct nilfs_bmap *btree)
157 return btree->b_nchildren_per_block; 154 return btree->b_nchildren_per_block;
158} 155}
159 156
160static inline __le64 * 157static __le64 *
161nilfs_btree_node_dkeys(const struct nilfs_btree_node *node) 158nilfs_btree_node_dkeys(const struct nilfs_btree_node *node)
162{ 159{
163 return (__le64 *)((char *)(node + 1) + 160 return (__le64 *)((char *)(node + 1) +
@@ -165,32 +162,32 @@ nilfs_btree_node_dkeys(const struct nilfs_btree_node *node)
165 0 : NILFS_BTREE_NODE_EXTRA_PAD_SIZE)); 162 0 : NILFS_BTREE_NODE_EXTRA_PAD_SIZE));
166} 163}
167 164
168static inline __le64 * 165static __le64 *
169nilfs_btree_node_dptrs(const struct nilfs_btree_node *node, int ncmax) 166nilfs_btree_node_dptrs(const struct nilfs_btree_node *node, int ncmax)
170{ 167{
171 return (__le64 *)(nilfs_btree_node_dkeys(node) + ncmax); 168 return (__le64 *)(nilfs_btree_node_dkeys(node) + ncmax);
172} 169}
173 170
174static inline __u64 171static __u64
175nilfs_btree_node_get_key(const struct nilfs_btree_node *node, int index) 172nilfs_btree_node_get_key(const struct nilfs_btree_node *node, int index)
176{ 173{
177 return le64_to_cpu(*(nilfs_btree_node_dkeys(node) + index)); 174 return le64_to_cpu(*(nilfs_btree_node_dkeys(node) + index));
178} 175}
179 176
180static inline void 177static void
181nilfs_btree_node_set_key(struct nilfs_btree_node *node, int index, __u64 key) 178nilfs_btree_node_set_key(struct nilfs_btree_node *node, int index, __u64 key)
182{ 179{
183 *(nilfs_btree_node_dkeys(node) + index) = cpu_to_le64(key); 180 *(nilfs_btree_node_dkeys(node) + index) = cpu_to_le64(key);
184} 181}
185 182
186static inline __u64 183static __u64
187nilfs_btree_node_get_ptr(const struct nilfs_btree_node *node, int index, 184nilfs_btree_node_get_ptr(const struct nilfs_btree_node *node, int index,
188 int ncmax) 185 int ncmax)
189{ 186{
190 return le64_to_cpu(*(nilfs_btree_node_dptrs(node, ncmax) + index)); 187 return le64_to_cpu(*(nilfs_btree_node_dptrs(node, ncmax) + index));
191} 188}
192 189
193static inline void 190static void
194nilfs_btree_node_set_ptr(struct nilfs_btree_node *node, int index, __u64 ptr, 191nilfs_btree_node_set_ptr(struct nilfs_btree_node *node, int index, __u64 ptr,
195 int ncmax) 192 int ncmax)
196{ 193{
@@ -402,25 +399,25 @@ int nilfs_btree_broken_node_block(struct buffer_head *bh)
402 bh->b_size, bh->b_blocknr); 399 bh->b_size, bh->b_blocknr);
403} 400}
404 401
405static inline struct nilfs_btree_node * 402static struct nilfs_btree_node *
406nilfs_btree_get_root(const struct nilfs_bmap *btree) 403nilfs_btree_get_root(const struct nilfs_bmap *btree)
407{ 404{
408 return (struct nilfs_btree_node *)btree->b_u.u_data; 405 return (struct nilfs_btree_node *)btree->b_u.u_data;
409} 406}
410 407
411static inline struct nilfs_btree_node * 408static struct nilfs_btree_node *
412nilfs_btree_get_nonroot_node(const struct nilfs_btree_path *path, int level) 409nilfs_btree_get_nonroot_node(const struct nilfs_btree_path *path, int level)
413{ 410{
414 return (struct nilfs_btree_node *)path[level].bp_bh->b_data; 411 return (struct nilfs_btree_node *)path[level].bp_bh->b_data;
415} 412}
416 413
417static inline struct nilfs_btree_node * 414static struct nilfs_btree_node *
418nilfs_btree_get_sib_node(const struct nilfs_btree_path *path, int level) 415nilfs_btree_get_sib_node(const struct nilfs_btree_path *path, int level)
419{ 416{
420 return (struct nilfs_btree_node *)path[level].bp_sib_bh->b_data; 417 return (struct nilfs_btree_node *)path[level].bp_sib_bh->b_data;
421} 418}
422 419
423static inline int nilfs_btree_height(const struct nilfs_bmap *btree) 420static int nilfs_btree_height(const struct nilfs_bmap *btree)
424{ 421{
425 return nilfs_btree_node_get_level(nilfs_btree_get_root(btree)) + 1; 422 return nilfs_btree_node_get_level(nilfs_btree_get_root(btree)) + 1;
426} 423}
@@ -442,7 +439,7 @@ nilfs_btree_get_node(const struct nilfs_bmap *btree,
442 return node; 439 return node;
443} 440}
444 441
445static inline int 442static int
446nilfs_btree_bad_node(struct nilfs_btree_node *node, int level) 443nilfs_btree_bad_node(struct nilfs_btree_node *node, int level)
447{ 444{
448 if (unlikely(nilfs_btree_node_get_level(node) != level)) { 445 if (unlikely(nilfs_btree_node_get_level(node) != level)) {