aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/alloc.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2008-08-22 15:46:09 -0400
committerMark Fasheh <mfasheh@suse.com>2008-10-13 19:57:05 -0400
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 06b9bd73d6d2..47201b67dbf2 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -55,7 +55,7 @@
55 * 55 *
56 * To implement an on-disk btree (extent tree) type in ocfs2, add 56 * To implement an on-disk btree (extent tree) type in ocfs2, add
57 * an ocfs2_extent_tree_operations structure and the matching 57 * an ocfs2_extent_tree_operations structure and the matching
58 * ocfs2_get_<thingy>_extent_tree() function. That's pretty much it 58 * ocfs2_init_<thingy>_extent_tree() function. That's pretty much it
59 * for the allocation portion of the extent tree. 59 * for the allocation portion of the extent tree.
60 */ 60 */
61struct ocfs2_extent_tree_operations { 61struct ocfs2_extent_tree_operations {
@@ -301,14 +301,13 @@ static struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = {
301 .eo_fill_max_leaf_clusters = ocfs2_xattr_tree_fill_max_leaf_clusters, 301 .eo_fill_max_leaf_clusters = ocfs2_xattr_tree_fill_max_leaf_clusters,
302}; 302};
303 303
304static void __ocfs2_get_extent_tree(struct ocfs2_extent_tree *et, 304static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et,
305 struct inode *inode, 305 struct inode *inode,
306 struct buffer_head *bh, 306 struct buffer_head *bh,
307 void *obj, 307 void *obj,
308 struct ocfs2_extent_tree_operations *ops) 308 struct ocfs2_extent_tree_operations *ops)
309{ 309{
310 et->et_ops = ops; 310 et->et_ops = ops;
311 get_bh(bh);
312 et->et_root_bh = bh; 311 et->et_root_bh = bh;
313 if (!obj) 312 if (!obj)
314 obj = (void *)bh->b_data; 313 obj = (void *)bh->b_data;
@@ -321,33 +320,28 @@ static void __ocfs2_get_extent_tree(struct ocfs2_extent_tree *et,
321 et->et_ops->eo_fill_max_leaf_clusters(inode, et); 320 et->et_ops->eo_fill_max_leaf_clusters(inode, et);
322} 321}
323 322
324void ocfs2_get_dinode_extent_tree(struct ocfs2_extent_tree *et, 323void ocfs2_init_dinode_extent_tree(struct ocfs2_extent_tree *et,
325 struct inode *inode, 324 struct inode *inode,
326 struct buffer_head *bh) 325 struct buffer_head *bh)
327{
328 __ocfs2_get_extent_tree(et, inode, bh, NULL, &ocfs2_dinode_et_ops);
329}
330
331void ocfs2_get_xattr_tree_extent_tree(struct ocfs2_extent_tree *et,
332 struct inode *inode,
333 struct buffer_head *bh)
334{ 326{
335 __ocfs2_get_extent_tree(et, inode, bh, NULL, 327 __ocfs2_init_extent_tree(et, inode, bh, NULL, &ocfs2_dinode_et_ops);
336 &ocfs2_xattr_tree_et_ops);
337} 328}
338 329
339void ocfs2_get_xattr_value_extent_tree(struct ocfs2_extent_tree *et, 330void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et,
340 struct inode *inode, 331 struct inode *inode,
341 struct buffer_head *bh, 332 struct buffer_head *bh)
342 struct ocfs2_xattr_value_root *xv)
343{ 333{
344 __ocfs2_get_extent_tree(et, inode, bh, xv, 334 __ocfs2_init_extent_tree(et, inode, bh, NULL,
345 &ocfs2_xattr_value_et_ops); 335 &ocfs2_xattr_tree_et_ops);
346} 336}
347 337
348void ocfs2_put_extent_tree(struct ocfs2_extent_tree *et) 338void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et,
339 struct inode *inode,
340 struct buffer_head *bh,
341 struct ocfs2_xattr_value_root *xv)
349{ 342{
350 brelse(et->et_root_bh); 343 __ocfs2_init_extent_tree(et, inode, bh, xv,
344 &ocfs2_xattr_value_et_ops);
351} 345}
352 346
353static inline void ocfs2_et_set_last_eb_blk(struct ocfs2_extent_tree *et, 347static 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,
6791 * this proves to be false, we could always re-build 6785 * this proves to be false, we could always re-build
6792 * the in-inode data from our pages. 6786 * the in-inode data from our pages.
6793 */ 6787 */
6794 ocfs2_get_dinode_extent_tree(&et, inode, di_bh); 6788 ocfs2_init_dinode_extent_tree(&et, inode, di_bh);
6795 ret = ocfs2_insert_extent(osb, handle, inode, &et, 6789 ret = ocfs2_insert_extent(osb, handle, inode, &et,
6796 0, block, 1, 0, NULL); 6790 0, block, 1, 0, NULL);
6797 ocfs2_put_extent_tree(&et);
6798 if (ret) { 6791 if (ret) {
6799 mlog_errno(ret); 6792 mlog_errno(ret);
6800 goto out_commit; 6793 goto out_commit;