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>
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 9c3d4dc..1a4de3d 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -211,7 +211,7 @@
mlog(0, "(clusters_to_add for xattr= %u)\n", clusters_to_add);
- ocfs2_get_xattr_value_extent_tree(&et, inode, xattr_bh, xv);
+ ocfs2_init_xattr_value_extent_tree(&et, inode, xattr_bh, xv);
restart_all:
@@ -307,7 +307,6 @@
goto restart_all;
}
- ocfs2_put_extent_tree(&et);
return status;
}
@@ -325,11 +324,10 @@
struct ocfs2_alloc_context *meta_ac = NULL;
struct ocfs2_extent_tree et;
- ocfs2_get_xattr_value_extent_tree(&et, inode, root_bh, xv);
+ ocfs2_init_xattr_value_extent_tree(&et, inode, root_bh, xv);
ret = ocfs2_lock_allocators(inode, &et, 0, 1, NULL, &meta_ac);
if (ret) {
- ocfs2_put_extent_tree(&et);
mlog_errno(ret);
return ret;
}
@@ -385,7 +383,6 @@
if (meta_ac)
ocfs2_free_alloc_context(meta_ac);
- ocfs2_put_extent_tree(&et);
return ret;
}
@@ -3632,7 +3629,7 @@
(unsigned long long)OCFS2_I(inode)->ip_blkno,
prev_cpos, prev_blkno);
- ocfs2_get_xattr_tree_extent_tree(&et, inode, root_bh);
+ ocfs2_init_xattr_tree_extent_tree(&et, inode, root_bh);
ret = ocfs2_lock_allocators(inode, &et, clusters_to_add, 0,
&data_ac, &meta_ac);
@@ -3727,7 +3724,6 @@
if (meta_ac)
ocfs2_free_alloc_context(meta_ac);
- ocfs2_put_extent_tree(&et);
return ret;
}
@@ -4336,7 +4332,7 @@
struct ocfs2_cached_dealloc_ctxt dealloc;
struct ocfs2_extent_tree et;
- ocfs2_get_xattr_tree_extent_tree(&et, inode, root_bh);
+ ocfs2_init_xattr_tree_extent_tree(&et, inode, root_bh);
ocfs2_init_dealloc_ctxt(&dealloc);
@@ -4347,7 +4343,6 @@
ret = ocfs2_lock_allocators(inode, &et, 0, 1, NULL, &meta_ac);
if (ret) {
- ocfs2_put_extent_tree(&et);
mlog_errno(ret);
return ret;
}
@@ -4407,7 +4402,6 @@
ocfs2_run_deallocs(osb, &dealloc);
- ocfs2_put_extent_tree(&et);
return ret;
}