aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r--fs/btrfs/ctree.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 453ce835209a..9ef65e2ecf51 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -16,19 +16,24 @@ static int balance_node_right(struct btrfs_trans_handle *trans, struct
16static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root, 16static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
17 struct btrfs_path *path, int level, int slot); 17 struct btrfs_path *path, int level, int slot);
18 18
19struct btrfs_path *btrfs_alloc_path(void) 19inline void btrfs_init_path(struct btrfs_path *p)
20{ 20{
21 return kmem_cache_alloc(btrfs_path_cachep, GFP_NOFS); 21 memset(p, 0, sizeof(*p));
22} 22}
23 23
24void btrfs_free_path(struct btrfs_path *p) 24struct btrfs_path *btrfs_alloc_path(void)
25{ 25{
26 kmem_cache_free(btrfs_path_cachep, p); 26 struct btrfs_path *path;
27 path = kmem_cache_alloc(btrfs_path_cachep, GFP_NOFS);
28 if (path)
29 btrfs_init_path(path);
30 return path;
27} 31}
28 32
29inline void btrfs_init_path(struct btrfs_path *p) 33void btrfs_free_path(struct btrfs_path *p)
30{ 34{
31 memset(p, 0, sizeof(*p)); 35 btrfs_release_path(NULL, p);
36 kmem_cache_free(btrfs_path_cachep, p);
32} 37}
33 38
34void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p) 39void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p)
@@ -77,6 +82,7 @@ static int btrfs_cow_block(struct btrfs_trans_handle *trans, struct btrfs_root
77 btrfs_free_extent(trans, root, buf->b_blocknr, 1, 1); 82 btrfs_free_extent(trans, root, buf->b_blocknr, 1, 1);
78 } 83 }
79 btrfs_block_release(root, buf); 84 btrfs_block_release(root, buf);
85 mark_buffer_dirty(cow);
80 *cow_ret = cow; 86 *cow_ret = cow;
81 return 0; 87 return 0;
82} 88}