diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-05-21 11:33:13 -0400 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-06-10 10:41:10 -0400 |
commit | 087d01b4253b611773ca81ad894486e7e17e74f6 (patch) | |
tree | b7705eef195bbd3d2bb2bb2e1bf35f05ca05af42 /fs | |
parent | 654137dd46bc7e9f088a4a551a2b77a8541dfdb8 (diff) |
nilfs2: remove nilfs_bmap_put_block
nilfs_bmap_put_block() is a wrapper function calling brelse(). This
eliminates the wrapper for simplicity.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nilfs2/bmap.c | 6 | ||||
-rw-r--r-- | fs/nilfs2/bmap.h | 1 | ||||
-rw-r--r-- | fs/nilfs2/btree.c | 33 |
3 files changed, 16 insertions, 24 deletions
diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index 4f2523f5c0b..ee9914a7b70 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c | |||
@@ -424,12 +424,6 @@ int nilfs_bmap_get_block(const struct nilfs_bmap *bmap, __u64 ptr, | |||
424 | ptr, 0, bhp, 0); | 424 | ptr, 0, bhp, 0); |
425 | } | 425 | } |
426 | 426 | ||
427 | void nilfs_bmap_put_block(const struct nilfs_bmap *bmap, | ||
428 | struct buffer_head *bh) | ||
429 | { | ||
430 | brelse(bh); | ||
431 | } | ||
432 | |||
433 | int nilfs_bmap_get_new_block(const struct nilfs_bmap *bmap, __u64 ptr, | 427 | int nilfs_bmap_get_new_block(const struct nilfs_bmap *bmap, __u64 ptr, |
434 | struct buffer_head **bhp) | 428 | struct buffer_head **bhp) |
435 | { | 429 | { |
diff --git a/fs/nilfs2/bmap.h b/fs/nilfs2/bmap.h index ad251d3e675..5b580b83289 100644 --- a/fs/nilfs2/bmap.h +++ b/fs/nilfs2/bmap.h | |||
@@ -204,7 +204,6 @@ void nilfs_bmap_sub_blocks(const struct nilfs_bmap *, int); | |||
204 | 204 | ||
205 | int nilfs_bmap_get_block(const struct nilfs_bmap *, __u64, | 205 | int nilfs_bmap_get_block(const struct nilfs_bmap *, __u64, |
206 | struct buffer_head **); | 206 | struct buffer_head **); |
207 | void nilfs_bmap_put_block(const struct nilfs_bmap *, struct buffer_head *); | ||
208 | int nilfs_bmap_get_new_block(const struct nilfs_bmap *, __u64, | 207 | int nilfs_bmap_get_new_block(const struct nilfs_bmap *, __u64, |
209 | struct buffer_head **); | 208 | struct buffer_head **); |
210 | void nilfs_bmap_delete_block(const struct nilfs_bmap *, struct buffer_head *); | 209 | void nilfs_bmap_delete_block(const struct nilfs_bmap *, struct buffer_head *); |
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index 959e5a7a803..102e218b426 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c | |||
@@ -109,8 +109,7 @@ static void nilfs_btree_clear_path(const struct nilfs_btree *btree, | |||
109 | level < NILFS_BTREE_LEVEL_MAX; | 109 | level < NILFS_BTREE_LEVEL_MAX; |
110 | level++) { | 110 | level++) { |
111 | if (path[level].bp_bh != NULL) { | 111 | if (path[level].bp_bh != NULL) { |
112 | nilfs_bmap_put_block(&btree->bt_bmap, | 112 | brelse(path[level].bp_bh); |
113 | path[level].bp_bh); | ||
114 | path[level].bp_bh = NULL; | 113 | path[level].bp_bh = NULL; |
115 | } | 114 | } |
116 | /* sib_bh is released or deleted by prepare or commit | 115 | /* sib_bh is released or deleted by prepare or commit |
@@ -669,13 +668,13 @@ static void nilfs_btree_carry_left(struct nilfs_btree *btree, | |||
669 | nilfs_btree_node_get_key(btree, node, 0)); | 668 | nilfs_btree_node_get_key(btree, node, 0)); |
670 | 669 | ||
671 | if (move) { | 670 | if (move) { |
672 | nilfs_bmap_put_block(&btree->bt_bmap, path[level].bp_bh); | 671 | brelse(path[level].bp_bh); |
673 | path[level].bp_bh = path[level].bp_sib_bh; | 672 | path[level].bp_bh = path[level].bp_sib_bh; |
674 | path[level].bp_sib_bh = NULL; | 673 | path[level].bp_sib_bh = NULL; |
675 | path[level].bp_index += lnchildren; | 674 | path[level].bp_index += lnchildren; |
676 | path[level + 1].bp_index--; | 675 | path[level + 1].bp_index--; |
677 | } else { | 676 | } else { |
678 | nilfs_bmap_put_block(&btree->bt_bmap, path[level].bp_sib_bh); | 677 | brelse(path[level].bp_sib_bh); |
679 | path[level].bp_sib_bh = NULL; | 678 | path[level].bp_sib_bh = NULL; |
680 | path[level].bp_index -= n; | 679 | path[level].bp_index -= n; |
681 | } | 680 | } |
@@ -722,14 +721,14 @@ static void nilfs_btree_carry_right(struct nilfs_btree *btree, | |||
722 | path[level + 1].bp_index--; | 721 | path[level + 1].bp_index--; |
723 | 722 | ||
724 | if (move) { | 723 | if (move) { |
725 | nilfs_bmap_put_block(&btree->bt_bmap, path[level].bp_bh); | 724 | brelse(path[level].bp_bh); |
726 | path[level].bp_bh = path[level].bp_sib_bh; | 725 | path[level].bp_bh = path[level].bp_sib_bh; |
727 | path[level].bp_sib_bh = NULL; | 726 | path[level].bp_sib_bh = NULL; |
728 | path[level].bp_index -= | 727 | path[level].bp_index -= |
729 | nilfs_btree_node_get_nchildren(btree, node); | 728 | nilfs_btree_node_get_nchildren(btree, node); |
730 | path[level + 1].bp_index++; | 729 | path[level + 1].bp_index++; |
731 | } else { | 730 | } else { |
732 | nilfs_bmap_put_block(&btree->bt_bmap, path[level].bp_sib_bh); | 731 | brelse(path[level].bp_sib_bh); |
733 | path[level].bp_sib_bh = NULL; | 732 | path[level].bp_sib_bh = NULL; |
734 | } | 733 | } |
735 | 734 | ||
@@ -781,7 +780,7 @@ static void nilfs_btree_split(struct nilfs_btree *btree, | |||
781 | *keyp = nilfs_btree_node_get_key(btree, right, 0); | 780 | *keyp = nilfs_btree_node_get_key(btree, right, 0); |
782 | *ptrp = path[level].bp_newreq.bpr_ptr; | 781 | *ptrp = path[level].bp_newreq.bpr_ptr; |
783 | 782 | ||
784 | nilfs_bmap_put_block(&btree->bt_bmap, path[level].bp_bh); | 783 | brelse(path[level].bp_bh); |
785 | path[level].bp_bh = path[level].bp_sib_bh; | 784 | path[level].bp_bh = path[level].bp_sib_bh; |
786 | path[level].bp_sib_bh = NULL; | 785 | path[level].bp_sib_bh = NULL; |
787 | } else { | 786 | } else { |
@@ -790,7 +789,7 @@ static void nilfs_btree_split(struct nilfs_btree *btree, | |||
790 | *keyp = nilfs_btree_node_get_key(btree, right, 0); | 789 | *keyp = nilfs_btree_node_get_key(btree, right, 0); |
791 | *ptrp = path[level].bp_newreq.bpr_ptr; | 790 | *ptrp = path[level].bp_newreq.bpr_ptr; |
792 | 791 | ||
793 | nilfs_bmap_put_block(&btree->bt_bmap, path[level].bp_sib_bh); | 792 | brelse(path[level].bp_sib_bh); |
794 | path[level].bp_sib_bh = NULL; | 793 | path[level].bp_sib_bh = NULL; |
795 | } | 794 | } |
796 | 795 | ||
@@ -936,7 +935,7 @@ static int nilfs_btree_prepare_insert(struct nilfs_btree *btree, | |||
936 | stats->bs_nblocks++; | 935 | stats->bs_nblocks++; |
937 | goto out; | 936 | goto out; |
938 | } else | 937 | } else |
939 | nilfs_bmap_put_block(&btree->bt_bmap, bh); | 938 | brelse(bh); |
940 | } | 939 | } |
941 | 940 | ||
942 | /* right sibling */ | 941 | /* right sibling */ |
@@ -956,7 +955,7 @@ static int nilfs_btree_prepare_insert(struct nilfs_btree *btree, | |||
956 | stats->bs_nblocks++; | 955 | stats->bs_nblocks++; |
957 | goto out; | 956 | goto out; |
958 | } else | 957 | } else |
959 | nilfs_bmap_put_block(&btree->bt_bmap, bh); | 958 | brelse(bh); |
960 | } | 959 | } |
961 | 960 | ||
962 | /* split */ | 961 | /* split */ |
@@ -1153,7 +1152,7 @@ static void nilfs_btree_borrow_left(struct nilfs_btree *btree, | |||
1153 | nilfs_btree_promote_key(btree, path, level + 1, | 1152 | nilfs_btree_promote_key(btree, path, level + 1, |
1154 | nilfs_btree_node_get_key(btree, node, 0)); | 1153 | nilfs_btree_node_get_key(btree, node, 0)); |
1155 | 1154 | ||
1156 | nilfs_bmap_put_block(&btree->bt_bmap, path[level].bp_sib_bh); | 1155 | brelse(path[level].bp_sib_bh); |
1157 | path[level].bp_sib_bh = NULL; | 1156 | path[level].bp_sib_bh = NULL; |
1158 | path[level].bp_index += n; | 1157 | path[level].bp_index += n; |
1159 | } | 1158 | } |
@@ -1192,7 +1191,7 @@ static void nilfs_btree_borrow_right(struct nilfs_btree *btree, | |||
1192 | nilfs_btree_node_get_key(btree, right, 0)); | 1191 | nilfs_btree_node_get_key(btree, right, 0)); |
1193 | path[level + 1].bp_index--; | 1192 | path[level + 1].bp_index--; |
1194 | 1193 | ||
1195 | nilfs_bmap_put_block(&btree->bt_bmap, path[level].bp_sib_bh); | 1194 | brelse(path[level].bp_sib_bh); |
1196 | path[level].bp_sib_bh = NULL; | 1195 | path[level].bp_sib_bh = NULL; |
1197 | } | 1196 | } |
1198 | 1197 | ||
@@ -1403,7 +1402,7 @@ static int nilfs_btree_prepare_delete(struct nilfs_btree *btree, | |||
1403 | &btree->bt_bmap, &path[level].bp_oldreq); | 1402 | &btree->bt_bmap, &path[level].bp_oldreq); |
1404 | err_out_child_node: | 1403 | err_out_child_node: |
1405 | for (level--; level >= NILFS_BTREE_LEVEL_NODE_MIN; level--) { | 1404 | for (level--; level >= NILFS_BTREE_LEVEL_NODE_MIN; level--) { |
1406 | nilfs_bmap_put_block(&btree->bt_bmap, path[level].bp_sib_bh); | 1405 | brelse(path[level].bp_sib_bh); |
1407 | if (btree->bt_bmap.b_pops->bpop_abort_end_ptr != NULL) | 1406 | if (btree->bt_bmap.b_pops->bpop_abort_end_ptr != NULL) |
1408 | btree->bt_bmap.b_pops->bpop_abort_end_ptr( | 1407 | btree->bt_bmap.b_pops->bpop_abort_end_ptr( |
1409 | &btree->bt_bmap, &path[level].bp_oldreq); | 1408 | &btree->bt_bmap, &path[level].bp_oldreq); |
@@ -1515,7 +1514,7 @@ static int nilfs_btree_check_delete(struct nilfs_bmap *bmap, __u64 key) | |||
1515 | nextmaxkey = (nchildren > 1) ? | 1514 | nextmaxkey = (nchildren > 1) ? |
1516 | nilfs_btree_node_get_key(btree, node, nchildren - 2) : 0; | 1515 | nilfs_btree_node_get_key(btree, node, nchildren - 2) : 0; |
1517 | if (bh != NULL) | 1516 | if (bh != NULL) |
1518 | nilfs_bmap_put_block(bmap, bh); | 1517 | brelse(bh); |
1519 | 1518 | ||
1520 | return (maxkey == key) && (nextmaxkey < bmap->b_low); | 1519 | return (maxkey == key) && (nextmaxkey < bmap->b_low); |
1521 | } | 1520 | } |
@@ -1563,7 +1562,7 @@ static int nilfs_btree_gather_data(struct nilfs_bmap *bmap, | |||
1563 | } | 1562 | } |
1564 | 1563 | ||
1565 | if (bh != NULL) | 1564 | if (bh != NULL) |
1566 | nilfs_bmap_put_block(bmap, bh); | 1565 | brelse(bh); |
1567 | 1566 | ||
1568 | return nitems; | 1567 | return nitems; |
1569 | } | 1568 | } |
@@ -1661,7 +1660,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap, | |||
1661 | nilfs_bmap_set_dirty(bmap); | 1660 | nilfs_bmap_set_dirty(bmap); |
1662 | 1661 | ||
1663 | unlock_buffer(bh); | 1662 | unlock_buffer(bh); |
1664 | nilfs_bmap_put_block(bmap, bh); | 1663 | brelse(bh); |
1665 | 1664 | ||
1666 | /* create root node at level 2 */ | 1665 | /* create root node at level 2 */ |
1667 | node = nilfs_btree_get_root(btree); | 1666 | node = nilfs_btree_get_root(btree); |
@@ -2176,7 +2175,7 @@ static int nilfs_btree_mark(struct nilfs_bmap *bmap, __u64 key, int level) | |||
2176 | 2175 | ||
2177 | if (!buffer_dirty(bh)) | 2176 | if (!buffer_dirty(bh)) |
2178 | nilfs_btnode_mark_dirty(bh); | 2177 | nilfs_btnode_mark_dirty(bh); |
2179 | nilfs_bmap_put_block(&btree->bt_bmap, bh); | 2178 | brelse(bh); |
2180 | if (!nilfs_bmap_dirty(&btree->bt_bmap)) | 2179 | if (!nilfs_bmap_dirty(&btree->bt_bmap)) |
2181 | nilfs_bmap_set_dirty(&btree->bt_bmap); | 2180 | nilfs_bmap_set_dirty(&btree->bt_bmap); |
2182 | 2181 | ||