summaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/btree.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-07-13 23:33:54 +0900
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-07-23 10:02:14 +0900
commit5ad2686e9266f24a0bb76b01d5c3ae29b4e149fe (patch)
treedf7d1d37ec380e58b0b171db07c5d8a7f9bb4ff0 /fs/nilfs2/btree.c
parent9b7b265c9ab67fcd1245d6b64fa5ca2eda43ac88 (diff)
downloadlinux-stable-5ad2686e9266f24a0bb76b01d5c3ae29b4e149fe.tar.gz
linux-stable-5ad2686e9266f24a0bb76b01d5c3ae29b4e149fe.tar.bz2
linux-stable-5ad2686e9266f24a0bb76b01d5c3ae29b4e149fe.zip
nilfs2: get maximum number of child nodes from bmap object
The patch "reduce repetitive calculation of max number of child nodes" gathered up the calculation of maximum number of child nodes into nilfs_btree_nchildren_per_block() function. This makes the function get resultant value from a private variable in bmap object instead of calculating it for each call. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/btree.c')
-rw-r--r--fs/nilfs2/btree.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index 829e145f1353..7089d9041146 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -154,7 +154,7 @@ static inline int nilfs_btree_node_size(const struct nilfs_bmap *btree)
static int nilfs_btree_nchildren_per_block(const struct nilfs_bmap *btree)
{
- return NILFS_BTREE_NODE_NCHILDREN_MAX(nilfs_btree_node_size(btree));
+ return btree->b_nchildren_per_block;
}
static inline __le64 *
@@ -2218,10 +2218,14 @@ static const struct nilfs_bmap_operations nilfs_btree_ops_gc = {
int nilfs_btree_init(struct nilfs_bmap *bmap)
{
bmap->b_ops = &nilfs_btree_ops;
+ bmap->b_nchildren_per_block =
+ NILFS_BTREE_NODE_NCHILDREN_MAX(nilfs_btree_node_size(bmap));
return 0;
}
void nilfs_btree_init_gc(struct nilfs_bmap *bmap)
{
bmap->b_ops = &nilfs_btree_ops_gc;
+ bmap->b_nchildren_per_block =
+ NILFS_BTREE_NODE_NCHILDREN_MAX(nilfs_btree_node_size(bmap));
}