diff options
Diffstat (limited to 'fs/jffs2/malloc.c')
-rw-r--r-- | fs/jffs2/malloc.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/fs/jffs2/malloc.c b/fs/jffs2/malloc.c index f2473fa2fd16..3df3250314a2 100644 --- a/fs/jffs2/malloc.c +++ b/fs/jffs2/malloc.c | |||
@@ -190,7 +190,29 @@ void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *x) | |||
190 | kmem_cache_free(tmp_dnode_info_slab, x); | 190 | kmem_cache_free(tmp_dnode_info_slab, x); |
191 | } | 191 | } |
192 | 192 | ||
193 | struct jffs2_raw_node_ref *jffs2_alloc_raw_node_ref(void) | 193 | int jffs2_prealloc_raw_node_refs(struct jffs2_sb_info *c, int nr) |
194 | { | ||
195 | struct jffs2_raw_node_ref *p = c->refs; | ||
196 | |||
197 | dbg_memalloc("%d\n", nr); | ||
198 | |||
199 | while (nr && p) { | ||
200 | p = p->next_in_ino; | ||
201 | nr--; | ||
202 | } | ||
203 | while (nr) { | ||
204 | p = __jffs2_alloc_raw_node_ref(); | ||
205 | if (!p) | ||
206 | return -ENOMEM; | ||
207 | p->next_in_ino = c->refs; | ||
208 | c->refs = p; | ||
209 | nr--; | ||
210 | } | ||
211 | c->reserved_refs = nr; | ||
212 | return 0; | ||
213 | } | ||
214 | |||
215 | struct jffs2_raw_node_ref *__jffs2_alloc_raw_node_ref(void) | ||
194 | { | 216 | { |
195 | struct jffs2_raw_node_ref *ret; | 217 | struct jffs2_raw_node_ref *ret; |
196 | ret = kmem_cache_alloc(raw_node_ref_slab, GFP_KERNEL); | 218 | ret = kmem_cache_alloc(raw_node_ref_slab, GFP_KERNEL); |
@@ -198,7 +220,7 @@ struct jffs2_raw_node_ref *jffs2_alloc_raw_node_ref(void) | |||
198 | return ret; | 220 | return ret; |
199 | } | 221 | } |
200 | 222 | ||
201 | void jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *x) | 223 | void __jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *x) |
202 | { | 224 | { |
203 | dbg_memalloc("%p\n", x); | 225 | dbg_memalloc("%p\n", x); |
204 | kmem_cache_free(raw_node_ref_slab, x); | 226 | kmem_cache_free(raw_node_ref_slab, x); |