aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-08-14 12:54:59 -0400
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-09-14 05:27:15 -0400
commit3218929dbd25245e0f601df1e359a3ed3f7fb03b (patch)
tree4f3f0f21b9f2e6eaa255315c659c1168ad3b5c96 /fs
parent6d28f7ea43856449ed2f344cb209af3ba1c6b757 (diff)
nilfs2: stop zero-fill of btree path just before free it
The btree path object is cleared just before it is freed. This will remove the code doing the unnecessary clear operation. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs')
-rw-r--r--fs/nilfs2/btree.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index 21ed8ccea4b9..115b157d508b 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -97,25 +97,13 @@ static void nilfs_btree_init_path(struct nilfs_btree_path *path)
97 } 97 }
98} 98}
99 99
100static void nilfs_btree_clear_path(struct nilfs_btree_path *path) 100static void nilfs_btree_release_path(struct nilfs_btree_path *path)
101{ 101{
102 int level; 102 int level;
103 103
104 for (level = NILFS_BTREE_LEVEL_DATA; 104 for (level = NILFS_BTREE_LEVEL_DATA; level < NILFS_BTREE_LEVEL_MAX;
105 level < NILFS_BTREE_LEVEL_MAX; 105 level++)
106 level++) { 106 brelse(path[level].bp_bh);
107 if (path[level].bp_bh != NULL) {
108 brelse(path[level].bp_bh);
109 path[level].bp_bh = NULL;
110 }
111 /* sib_bh is released or deleted by prepare or commit
112 * operations. */
113 path[level].bp_sib_bh = NULL;
114 path[level].bp_index = 0;
115 path[level].bp_oldreq.bpr_ptr = NILFS_BMAP_INVALID_PTR;
116 path[level].bp_newreq.bpr_ptr = NILFS_BMAP_INVALID_PTR;
117 path[level].bp_op = NULL;
118 }
119} 107}
120 108
121/* 109/*
@@ -557,7 +545,7 @@ static int nilfs_btree_lookup(const struct nilfs_bmap *bmap,
557 if (ptrp != NULL) 545 if (ptrp != NULL)
558 *ptrp = ptr; 546 *ptrp = ptr;
559 547
560 nilfs_btree_clear_path(path); 548 nilfs_btree_release_path(path);
561 nilfs_btree_free_path(path); 549 nilfs_btree_free_path(path);
562 550
563 return ret; 551 return ret;
@@ -639,7 +627,7 @@ static int nilfs_btree_lookup_contig(const struct nilfs_bmap *bmap,
639 *ptrp = ptr; 627 *ptrp = ptr;
640 ret = cnt; 628 ret = cnt;
641 out: 629 out:
642 nilfs_btree_clear_path(path); 630 nilfs_btree_release_path(path);
643 nilfs_btree_free_path(path); 631 nilfs_btree_free_path(path);
644 return ret; 632 return ret;
645} 633}
@@ -1146,7 +1134,7 @@ static int nilfs_btree_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr)
1146 nilfs_bmap_add_blocks(bmap, stats.bs_nblocks); 1134 nilfs_bmap_add_blocks(bmap, stats.bs_nblocks);
1147 1135
1148 out: 1136 out:
1149 nilfs_btree_clear_path(path); 1137 nilfs_btree_release_path(path);
1150 nilfs_btree_free_path(path); 1138 nilfs_btree_free_path(path);
1151 return ret; 1139 return ret;
1152} 1140}
@@ -1501,7 +1489,7 @@ static int nilfs_btree_delete(struct nilfs_bmap *bmap, __u64 key)
1501 nilfs_bmap_sub_blocks(bmap, stats.bs_nblocks); 1489 nilfs_bmap_sub_blocks(bmap, stats.bs_nblocks);
1502 1490
1503out: 1491out:
1504 nilfs_btree_clear_path(path); 1492 nilfs_btree_release_path(path);
1505 nilfs_btree_free_path(path); 1493 nilfs_btree_free_path(path);
1506 return ret; 1494 return ret;
1507} 1495}
@@ -1520,7 +1508,7 @@ static int nilfs_btree_last_key(const struct nilfs_bmap *bmap, __u64 *keyp)
1520 1508
1521 ret = nilfs_btree_do_lookup_last(btree, path, keyp, NULL); 1509 ret = nilfs_btree_do_lookup_last(btree, path, keyp, NULL);
1522 1510
1523 nilfs_btree_clear_path(path); 1511 nilfs_btree_release_path(path);
1524 nilfs_btree_free_path(path); 1512 nilfs_btree_free_path(path);
1525 1513
1526 return ret; 1514 return ret;
@@ -1975,7 +1963,7 @@ static int nilfs_btree_propagate(const struct nilfs_bmap *bmap,
1975 nilfs_btree_propagate_p(btree, path, level, bh); 1963 nilfs_btree_propagate_p(btree, path, level, bh);
1976 1964
1977 out: 1965 out:
1978 nilfs_btree_clear_path(path); 1966 nilfs_btree_release_path(path);
1979 nilfs_btree_free_path(path); 1967 nilfs_btree_free_path(path);
1980 1968
1981 return ret; 1969 return ret;
@@ -2156,7 +2144,7 @@ static int nilfs_btree_assign(struct nilfs_bmap *bmap,
2156 nilfs_btree_assign_p(btree, path, level, bh, blocknr, binfo); 2144 nilfs_btree_assign_p(btree, path, level, bh, blocknr, binfo);
2157 2145
2158 out: 2146 out:
2159 nilfs_btree_clear_path(path); 2147 nilfs_btree_release_path(path);
2160 nilfs_btree_free_path(path); 2148 nilfs_btree_free_path(path);
2161 2149
2162 return ret; 2150 return ret;
@@ -2222,7 +2210,7 @@ static int nilfs_btree_mark(struct nilfs_bmap *bmap, __u64 key, int level)
2222 nilfs_bmap_set_dirty(&btree->bt_bmap); 2210 nilfs_bmap_set_dirty(&btree->bt_bmap);
2223 2211
2224 out: 2212 out:
2225 nilfs_btree_clear_path(path); 2213 nilfs_btree_release_path(path);
2226 nilfs_btree_free_path(path); 2214 nilfs_btree_free_path(path);
2227 return ret; 2215 return ret;
2228} 2216}