aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_map.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r--fs/btrfs/extent_map.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index b3ff63c4bf2a..f91f28efdb59 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -42,18 +42,30 @@ struct extent_page_data {
42 struct extent_map_tree *tree; 42 struct extent_map_tree *tree;
43 get_extent_t *get_extent; 43 get_extent_t *get_extent;
44}; 44};
45 45int __init extent_map_init(void)
46void __init extent_map_init(void)
47{ 46{
48 extent_map_cache = btrfs_cache_create("extent_map", 47 extent_map_cache = btrfs_cache_create("extent_map",
49 sizeof(struct extent_map), 0, 48 sizeof(struct extent_map), 0,
50 NULL); 49 NULL);
50 if (!extent_map_cache)
51 return -ENOMEM;
51 extent_state_cache = btrfs_cache_create("extent_state", 52 extent_state_cache = btrfs_cache_create("extent_state",
52 sizeof(struct extent_state), 0, 53 sizeof(struct extent_state), 0,
53 NULL); 54 NULL);
55 if (!extent_state_cache)
56 goto free_map_cache;
54 extent_buffer_cache = btrfs_cache_create("extent_buffers", 57 extent_buffer_cache = btrfs_cache_create("extent_buffers",
55 sizeof(struct extent_buffer), 0, 58 sizeof(struct extent_buffer), 0,
56 NULL); 59 NULL);
60 if (!extent_buffer_cache)
61 goto free_state_cache;
62 return 0;
63
64free_state_cache:
65 kmem_cache_destroy(extent_state_cache);
66free_map_cache:
67 kmem_cache_destroy(extent_map_cache);
68 return -ENOMEM;
57} 69}
58 70
59void __exit extent_map_exit(void) 71void __exit extent_map_exit(void)