aboutsummaryrefslogtreecommitdiff
path: root/fs/ocfs2/alloc.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2008-08-22 12:46:09 -0700
committerMark Fasheh <mfasheh@suse.com>2008-10-13 16:57:05 -0700
commit8d6220d6a74a33552cf877bcea25503d7f6a59e6 (patch)
tree2c3f662c55ab4a0a22989c06edf0d027387bfbed /fs/ocfs2/alloc.c
parent1625f8ac151743e452ec062c2989669c508ffa48 (diff)
ocfs2: Change ocfs2_get_*_extent_tree() to ocfs2_init_*_extent_tree()
The original get/put_extent_tree() functions held a reference on et_root_bh. However, every single caller already has a safe reference, making the get/put cycle irrelevant. We change ocfs2_get_*_extent_tree() to ocfs2_init_*_extent_tree(). It no longer gets a reference on et_root_bh. ocfs2_put_extent_tree() is removed. Callers now have a simpler init+use pattern. Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r--fs/ocfs2/alloc.c49
1 files changed, 21 insertions, 28 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 06b9bd73d6d..47201b67dbf 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -55,7 +55,7 @@
*
* To implement an on-disk btree (extent tree) type in ocfs2, add
* an ocfs2_extent_tree_operations structure and the matching
- * ocfs2_get_<thingy>_extent_tree() function. That's pretty much it
+ * ocfs2_init_<thingy>_extent_tree() function. That's pretty much it
* for the allocation portion of the extent tree.
*/
struct ocfs2_extent_tree_operations {
@@ -301,14 +301,13 @@ static struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = {
.eo_fill_max_leaf_clusters = ocfs2_xattr_tree_fill_max_leaf_clusters,
};
-static void __ocfs2_get_extent_tree(struct ocfs2_extent_tree *et,
- struct inode *inode,
- struct buffer_head *bh,
- void *obj,
- struct ocfs2_extent_tree_operations *ops)
+static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et,
+ struct inode *inode,
+ struct buffer_head *bh,
+ void *obj,
+ struct ocfs2_extent_tree_operations *ops)
{
et->et_ops = ops;
- get_bh(bh);
et->et_root_bh = bh;
if (!obj)
obj = (void *)bh->b_data;
@@ -321,33 +320,28 @@ static void __ocfs2_get_extent_tree(struct ocfs2_extent_tree *et,
et->et_ops->eo_fill_max_leaf_clusters(inode, et);
}
-void ocfs2_get_dinode_extent_tree(struct ocfs2_extent_tree *et,
- struct inode *inode,
- struct buffer_head *bh)
-{
- __ocfs2_get_extent_tree(et, inode, bh, NULL, &ocfs2_dinode_et_ops);
-}
-
-void ocfs2_get_xattr_tree_extent_tree(struct ocfs2_extent_tree *et,
- struct inode *inode,
- struct buffer_head *bh)
+void ocfs2_init_dinode_extent_tree(struct ocfs2_extent_tree *et,
+ struct inode *inode,
+ struct buffer_head *bh)
{
- __ocfs2_get_extent_tree(et, inode, bh, NULL,
- &ocfs2_xattr_tree_et_ops);
+ __ocfs2_init_extent_tree(et, inode, bh, NULL, &ocfs2_dinode_et_ops);
}
-void ocfs2_get_xattr_value_extent_tree(struct ocfs2_extent_tree *et,
+void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et,
struct inode *inode,
- struct buffer_head *bh,
- struct ocfs2_xattr_value_root *xv)
+ struct buffer_head *bh)
{
- __ocfs2_get_extent_tree(et, inode, bh, xv,
- &ocfs2_xattr_value_et_ops);
+ __ocfs2_init_extent_tree(et, inode, bh, NULL,
+ &ocfs2_xattr_tree_et_ops);
}
-void ocfs2_put_extent_tree(struct ocfs2_extent_tree *et)
+void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et,
+ struct inode *inode,
+ struct buffer_head *bh,
+ struct ocfs2_xattr_value_root *xv)
{
- brelse(et->et_root_bh);
+ __ocfs2_init_extent_tree(et, inode, bh, xv,
+ &ocfs2_xattr_value_et_ops);
}
static inline void ocfs2_et_set_last_eb_blk(struct ocfs2_extent_tree *et,
@@ -6791,10 +6785,9 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
* this proves to be false, we could always re-build
* the in-inode data from our pages.
*/
- ocfs2_get_dinode_extent_tree(&et, inode, di_bh);
+ ocfs2_init_dinode_extent_tree(&et, inode, di_bh);
ret = ocfs2_insert_extent(osb, handle, inode, &et,
0, block, 1, 0, NULL);
- ocfs2_put_extent_tree(&et);
if (ret) {
mlog_errno(ret);
goto out_commit;