summaryrefslogtreecommitdiffstats
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 453ce835209..9ef65e2ecf5 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
static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
struct btrfs_path *path, int level, int slot);
-struct btrfs_path *btrfs_alloc_path(void)
+inline void btrfs_init_path(struct btrfs_path *p)
{
- return kmem_cache_alloc(btrfs_path_cachep, GFP_NOFS);
+ memset(p, 0, sizeof(*p));
}
-void btrfs_free_path(struct btrfs_path *p)
+struct btrfs_path *btrfs_alloc_path(void)
{
- kmem_cache_free(btrfs_path_cachep, p);
+ struct btrfs_path *path;
+ path = kmem_cache_alloc(btrfs_path_cachep, GFP_NOFS);
+ if (path)
+ btrfs_init_path(path);
+ return path;
}
-inline void btrfs_init_path(struct btrfs_path *p)
+void btrfs_free_path(struct btrfs_path *p)
{
- memset(p, 0, sizeof(*p));
+ btrfs_release_path(NULL, p);
+ kmem_cache_free(btrfs_path_cachep, p);
}
void 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
btrfs_free_extent(trans, root, buf->b_blocknr, 1, 1);
}
btrfs_block_release(root, buf);
+ mark_buffer_dirty(cow);
*cow_ret = cow;
return 0;
}