chfs_malloc.c revision 1.2.2.2 1 1.2.2.2 yamt /* $NetBSD: chfs_malloc.c,v 1.2.2.2 2012/04/17 00:08:54 yamt Exp $ */
2 1.2.2.2 yamt
3 1.2.2.2 yamt /*-
4 1.2.2.2 yamt * Copyright (c) 2010 Department of Software Engineering,
5 1.2.2.2 yamt * University of Szeged, Hungary
6 1.2.2.2 yamt * Copyright (C) 2010 Tamas Toth <ttoth (at) inf.u-szeged.hu>
7 1.2.2.2 yamt * Copyright (C) 2010 Adam Hoka <ahoka (at) NetBSD.org>
8 1.2.2.2 yamt * All rights reserved.
9 1.2.2.2 yamt *
10 1.2.2.2 yamt * This code is derived from software contributed to The NetBSD Foundation
11 1.2.2.2 yamt * by the Department of Software Engineering, University of Szeged, Hungary
12 1.2.2.2 yamt *
13 1.2.2.2 yamt * Redistribution and use in source and binary forms, with or without
14 1.2.2.2 yamt * modification, are permitted provided that the following conditions
15 1.2.2.2 yamt * are met:
16 1.2.2.2 yamt * 1. Redistributions of source code must retain the above copyright
17 1.2.2.2 yamt * notice, this list of conditions and the following disclaimer.
18 1.2.2.2 yamt * 2. Redistributions in binary form must reproduce the above copyright
19 1.2.2.2 yamt * notice, this list of conditions and the following disclaimer in the
20 1.2.2.2 yamt * documentation and/or other materials provided with the distribution.
21 1.2.2.2 yamt *
22 1.2.2.2 yamt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 1.2.2.2 yamt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.2.2.2 yamt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.2.2.2 yamt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.2.2.2 yamt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 1.2.2.2 yamt * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 1.2.2.2 yamt * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 1.2.2.2 yamt * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 1.2.2.2 yamt * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 1.2.2.2 yamt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 1.2.2.2 yamt * SUCH DAMAGE.
33 1.2.2.2 yamt */
34 1.2.2.2 yamt
35 1.2.2.2 yamt #include "chfs.h"
36 1.2.2.2 yamt #include <sys/pool.h>
37 1.2.2.2 yamt
38 1.2.2.2 yamt pool_cache_t chfs_vnode_cache;
39 1.2.2.2 yamt pool_cache_t chfs_nrefs_cache;
40 1.2.2.2 yamt pool_cache_t chfs_flash_vnode_cache;
41 1.2.2.2 yamt pool_cache_t chfs_flash_dirent_cache;
42 1.2.2.2 yamt pool_cache_t chfs_flash_dnode_cache;
43 1.2.2.2 yamt pool_cache_t chfs_node_frag_cache;
44 1.2.2.2 yamt pool_cache_t chfs_tmp_dnode_cache;
45 1.2.2.2 yamt pool_cache_t chfs_tmp_dnode_info_cache;
46 1.2.2.2 yamt
47 1.2.2.2 yamt int
48 1.2.2.2 yamt chfs_alloc_pool_caches(void)
49 1.2.2.2 yamt {
50 1.2.2.2 yamt chfs_vnode_cache = pool_cache_init(
51 1.2.2.2 yamt sizeof(struct chfs_vnode_cache),
52 1.2.2.2 yamt 0, 0, 0, "chfs_vnode_cache", NULL, IPL_NONE, NULL, NULL,
53 1.2.2.2 yamt NULL);
54 1.2.2.2 yamt if (!chfs_vnode_cache)
55 1.2.2.2 yamt goto err_vnode;
56 1.2.2.2 yamt
57 1.2.2.2 yamt chfs_nrefs_cache = pool_cache_init(
58 1.2.2.2 yamt (REFS_BLOCK_LEN + 1) * sizeof(struct chfs_node_ref), 0, 0,
59 1.2.2.2 yamt 0, "chfs_nrefs_pool", NULL, IPL_NONE, NULL, NULL, NULL);
60 1.2.2.2 yamt if (!chfs_nrefs_cache)
61 1.2.2.2 yamt goto err_nrefs;
62 1.2.2.2 yamt
63 1.2.2.2 yamt chfs_flash_vnode_cache = pool_cache_init(
64 1.2.2.2 yamt sizeof(struct chfs_flash_vnode), 0, 0, 0,
65 1.2.2.2 yamt "chfs_flash_vnode_pool", NULL, IPL_NONE, NULL, NULL, NULL);
66 1.2.2.2 yamt if (!chfs_flash_vnode_cache)
67 1.2.2.2 yamt goto err_flash_vnode;
68 1.2.2.2 yamt
69 1.2.2.2 yamt chfs_flash_dirent_cache = pool_cache_init(
70 1.2.2.2 yamt sizeof(struct chfs_flash_dirent_node), 0, 0, 0,
71 1.2.2.2 yamt "chfs_flash_dirent_pool", NULL, IPL_NONE, NULL, NULL, NULL);
72 1.2.2.2 yamt if (!chfs_flash_dirent_cache)
73 1.2.2.2 yamt goto err_flash_dirent;
74 1.2.2.2 yamt
75 1.2.2.2 yamt chfs_flash_dnode_cache = pool_cache_init(
76 1.2.2.2 yamt sizeof(struct chfs_flash_data_node), 0, 0, 0,
77 1.2.2.2 yamt "chfs_flash_dnode_pool", NULL, IPL_NONE, NULL, NULL, NULL);
78 1.2.2.2 yamt if (!chfs_flash_dnode_cache)
79 1.2.2.2 yamt goto err_flash_dnode;
80 1.2.2.2 yamt
81 1.2.2.2 yamt chfs_node_frag_cache = pool_cache_init(
82 1.2.2.2 yamt sizeof(struct chfs_node_frag), 0, 0, 0,
83 1.2.2.2 yamt "chfs_node_frag_pool", NULL, IPL_NONE, NULL, NULL, NULL);
84 1.2.2.2 yamt if (!chfs_node_frag_cache)
85 1.2.2.2 yamt goto err_node_frag;
86 1.2.2.2 yamt
87 1.2.2.2 yamt chfs_tmp_dnode_cache = pool_cache_init(
88 1.2.2.2 yamt sizeof(struct chfs_tmp_dnode), 0, 0, 0,
89 1.2.2.2 yamt "chfs_tmp_dnode_pool", NULL, IPL_NONE, NULL, NULL, NULL);
90 1.2.2.2 yamt if (!chfs_tmp_dnode_cache)
91 1.2.2.2 yamt goto err_tmp_dnode;
92 1.2.2.2 yamt
93 1.2.2.2 yamt chfs_tmp_dnode_info_cache = pool_cache_init(
94 1.2.2.2 yamt sizeof(struct chfs_tmp_dnode_info), 0, 0, 0,
95 1.2.2.2 yamt "chfs_tmp_dnode_info_pool", NULL, IPL_NONE, NULL, NULL, NULL);
96 1.2.2.2 yamt if (!chfs_tmp_dnode_info_cache)
97 1.2.2.2 yamt goto err_tmp_dnode_info;
98 1.2.2.2 yamt
99 1.2.2.2 yamt return 0;
100 1.2.2.2 yamt
101 1.2.2.2 yamt err_tmp_dnode_info:
102 1.2.2.2 yamt pool_cache_destroy(chfs_tmp_dnode_cache);
103 1.2.2.2 yamt err_tmp_dnode:
104 1.2.2.2 yamt pool_cache_destroy(chfs_node_frag_cache);
105 1.2.2.2 yamt err_node_frag:
106 1.2.2.2 yamt pool_cache_destroy(chfs_flash_dnode_cache);
107 1.2.2.2 yamt err_flash_dnode:
108 1.2.2.2 yamt pool_cache_destroy(chfs_flash_dirent_cache);
109 1.2.2.2 yamt err_flash_dirent:
110 1.2.2.2 yamt pool_cache_destroy(chfs_flash_vnode_cache);
111 1.2.2.2 yamt err_flash_vnode:
112 1.2.2.2 yamt pool_cache_destroy(chfs_nrefs_cache);
113 1.2.2.2 yamt err_nrefs:
114 1.2.2.2 yamt pool_cache_destroy(chfs_vnode_cache);
115 1.2.2.2 yamt err_vnode:
116 1.2.2.2 yamt
117 1.2.2.2 yamt return ENOMEM;
118 1.2.2.2 yamt }
119 1.2.2.2 yamt
120 1.2.2.2 yamt void
121 1.2.2.2 yamt chfs_destroy_pool_caches(void)
122 1.2.2.2 yamt {
123 1.2.2.2 yamt if (chfs_vnode_cache)
124 1.2.2.2 yamt pool_cache_destroy(chfs_vnode_cache);
125 1.2.2.2 yamt
126 1.2.2.2 yamt if (chfs_nrefs_cache)
127 1.2.2.2 yamt pool_cache_destroy(chfs_nrefs_cache);
128 1.2.2.2 yamt
129 1.2.2.2 yamt if (chfs_flash_vnode_cache)
130 1.2.2.2 yamt pool_cache_destroy(chfs_flash_vnode_cache);
131 1.2.2.2 yamt
132 1.2.2.2 yamt if (chfs_flash_dirent_cache)
133 1.2.2.2 yamt pool_cache_destroy(chfs_flash_dirent_cache);
134 1.2.2.2 yamt
135 1.2.2.2 yamt if (chfs_flash_dnode_cache)
136 1.2.2.2 yamt pool_cache_destroy(chfs_flash_dnode_cache);
137 1.2.2.2 yamt
138 1.2.2.2 yamt if (chfs_node_frag_cache)
139 1.2.2.2 yamt pool_cache_destroy(chfs_node_frag_cache);
140 1.2.2.2 yamt
141 1.2.2.2 yamt if (chfs_tmp_dnode_cache)
142 1.2.2.2 yamt pool_cache_destroy(chfs_tmp_dnode_cache);
143 1.2.2.2 yamt
144 1.2.2.2 yamt if (chfs_tmp_dnode_info_cache)
145 1.2.2.2 yamt pool_cache_destroy(chfs_tmp_dnode_info_cache);
146 1.2.2.2 yamt }
147 1.2.2.2 yamt
148 1.2.2.2 yamt struct chfs_vnode_cache *
149 1.2.2.2 yamt chfs_vnode_cache_alloc(ino_t vno)
150 1.2.2.2 yamt {
151 1.2.2.2 yamt struct chfs_vnode_cache* vc;
152 1.2.2.2 yamt vc = pool_cache_get(chfs_vnode_cache, PR_WAITOK);
153 1.2.2.2 yamt
154 1.2.2.2 yamt memset(vc, 0, sizeof(*vc));
155 1.2.2.2 yamt vc->vno = vno;
156 1.2.2.2 yamt vc->v = (void *)vc;
157 1.2.2.2 yamt vc->dirents = (void *)vc;
158 1.2.2.2 yamt vc->dnode = (void *)vc;
159 1.2.2.2 yamt TAILQ_INIT(&vc->scan_dirents);
160 1.2.2.2 yamt vc->highest_version = 0;
161 1.2.2.2 yamt
162 1.2.2.2 yamt return vc;
163 1.2.2.2 yamt }
164 1.2.2.2 yamt
165 1.2.2.2 yamt void
166 1.2.2.2 yamt chfs_vnode_cache_free(struct chfs_vnode_cache *vc)
167 1.2.2.2 yamt {
168 1.2.2.2 yamt //kmem_free(vc->vno_version, sizeof(uint64_t));
169 1.2.2.2 yamt pool_cache_put(chfs_vnode_cache, vc);
170 1.2.2.2 yamt }
171 1.2.2.2 yamt
172 1.2.2.2 yamt /**
173 1.2.2.2 yamt * chfs_alloc_refblock - allocating a refblock
174 1.2.2.2 yamt *
175 1.2.2.2 yamt * Returns a pointer of the first element in the block.
176 1.2.2.2 yamt *
177 1.2.2.2 yamt * We are not allocating just one node ref, instead we allocating REFS_BLOCK_LEN
178 1.2.2.2 yamt * number of node refs, the last element will be a pointer to the next block.
179 1.2.2.2 yamt * We do this, because we need a chain of nodes which have been ordered by the
180 1.2.2.2 yamt * physical address of them.
181 1.2.2.2 yamt *
182 1.2.2.2 yamt */
183 1.2.2.2 yamt struct chfs_node_ref*
184 1.2.2.2 yamt chfs_alloc_refblock(void)
185 1.2.2.2 yamt {
186 1.2.2.2 yamt int i;
187 1.2.2.2 yamt struct chfs_node_ref *nref;
188 1.2.2.2 yamt nref = pool_cache_get(chfs_nrefs_cache, PR_WAITOK);
189 1.2.2.2 yamt
190 1.2.2.2 yamt for (i = 0; i < REFS_BLOCK_LEN; i++) {
191 1.2.2.2 yamt nref[i].nref_lnr = REF_EMPTY_NODE;
192 1.2.2.2 yamt nref[i].nref_next = NULL;
193 1.2.2.2 yamt }
194 1.2.2.2 yamt i = REFS_BLOCK_LEN;
195 1.2.2.2 yamt nref[i].nref_lnr = REF_LINK_TO_NEXT;
196 1.2.2.2 yamt nref[i].nref_next = NULL;
197 1.2.2.2 yamt
198 1.2.2.2 yamt return nref;
199 1.2.2.2 yamt }
200 1.2.2.2 yamt
201 1.2.2.2 yamt /**
202 1.2.2.2 yamt * chfs_free_refblock - freeing a refblock
203 1.2.2.2 yamt */
204 1.2.2.2 yamt void
205 1.2.2.2 yamt chfs_free_refblock(struct chfs_node_ref *nref)
206 1.2.2.2 yamt {
207 1.2.2.2 yamt pool_cache_put(chfs_nrefs_cache, nref);
208 1.2.2.2 yamt }
209 1.2.2.2 yamt
210 1.2.2.2 yamt /**
211 1.2.2.2 yamt * chfs_alloc_node_ref - allocating a node ref from a refblock
212 1.2.2.2 yamt * @cheb: eraseblock information structure
213 1.2.2.2 yamt *
214 1.2.2.2 yamt * Allocating a node ref from a refblock, it there isn't any free element in the
215 1.2.2.2 yamt * block, a new block will be allocated and be linked to the current block.
216 1.2.2.2 yamt */
217 1.2.2.2 yamt struct chfs_node_ref*
218 1.2.2.2 yamt chfs_alloc_node_ref(struct chfs_eraseblock *cheb)
219 1.2.2.2 yamt {
220 1.2.2.2 yamt struct chfs_node_ref *nref, *new, *old;
221 1.2.2.2 yamt old = cheb->last_node;
222 1.2.2.2 yamt nref = cheb->last_node;
223 1.2.2.2 yamt
224 1.2.2.2 yamt if (!nref) {
225 1.2.2.2 yamt //There haven't been any nref allocated for this block yet
226 1.2.2.2 yamt nref = chfs_alloc_refblock();
227 1.2.2.2 yamt
228 1.2.2.2 yamt cheb->first_node = nref;
229 1.2.2.2 yamt cheb->last_node = nref;
230 1.2.2.2 yamt nref->nref_lnr = cheb->lnr;
231 1.2.2.2 yamt KASSERT(cheb->lnr == nref->nref_lnr);
232 1.2.2.2 yamt
233 1.2.2.2 yamt return nref;
234 1.2.2.2 yamt }
235 1.2.2.2 yamt
236 1.2.2.2 yamt nref++;
237 1.2.2.2 yamt if (nref->nref_lnr == REF_LINK_TO_NEXT) {
238 1.2.2.2 yamt new = chfs_alloc_refblock();
239 1.2.2.2 yamt nref->nref_next = new;
240 1.2.2.2 yamt nref = new;
241 1.2.2.2 yamt }
242 1.2.2.2 yamt
243 1.2.2.2 yamt cheb->last_node = nref;
244 1.2.2.2 yamt nref->nref_lnr = cheb->lnr;
245 1.2.2.2 yamt
246 1.2.2.2 yamt KASSERT(old->nref_lnr == nref->nref_lnr &&
247 1.2.2.2 yamt nref->nref_lnr == cheb->lnr);
248 1.2.2.2 yamt
249 1.2.2.2 yamt return nref;
250 1.2.2.2 yamt }
251 1.2.2.2 yamt
252 1.2.2.2 yamt /**
253 1.2.2.2 yamt * chfs_free_node_refs - freeing an eraseblock's node refs
254 1.2.2.2 yamt * @cheb: eraseblock information structure
255 1.2.2.2 yamt */
256 1.2.2.2 yamt void
257 1.2.2.2 yamt chfs_free_node_refs(struct chfs_eraseblock *cheb)
258 1.2.2.2 yamt {
259 1.2.2.2 yamt struct chfs_node_ref *nref, *block;
260 1.2.2.2 yamt
261 1.2.2.2 yamt block = nref = cheb->first_node;
262 1.2.2.2 yamt
263 1.2.2.2 yamt while (nref) {
264 1.2.2.2 yamt if (nref->nref_lnr == REF_LINK_TO_NEXT) {
265 1.2.2.2 yamt nref = nref->nref_next;
266 1.2.2.2 yamt chfs_free_refblock(block);
267 1.2.2.2 yamt block = nref;
268 1.2.2.2 yamt continue;
269 1.2.2.2 yamt }
270 1.2.2.2 yamt nref++;
271 1.2.2.2 yamt }
272 1.2.2.2 yamt }
273 1.2.2.2 yamt
274 1.2.2.2 yamt struct chfs_dirent*
275 1.2.2.2 yamt chfs_alloc_dirent(int namesize)
276 1.2.2.2 yamt {
277 1.2.2.2 yamt struct chfs_dirent *ret;
278 1.2.2.2 yamt size_t size = sizeof(struct chfs_dirent) + namesize;
279 1.2.2.2 yamt
280 1.2.2.2 yamt ret = kmem_alloc(size, KM_SLEEP);
281 1.2.2.2 yamt //ret->alloc_size = size;
282 1.2.2.2 yamt
283 1.2.2.2 yamt return ret;
284 1.2.2.2 yamt }
285 1.2.2.2 yamt
286 1.2.2.2 yamt void
287 1.2.2.2 yamt chfs_free_dirent(struct chfs_dirent *dirent)
288 1.2.2.2 yamt {
289 1.2.2.2 yamt //size_t size = dirent->alloc_size;
290 1.2.2.2 yamt size_t size = sizeof(struct chfs_dirent) + dirent->nsize + 1;
291 1.2.2.2 yamt
292 1.2.2.2 yamt kmem_free(dirent, size);
293 1.2.2.2 yamt }
294 1.2.2.2 yamt
295 1.2.2.2 yamt struct chfs_full_dnode*
296 1.2.2.2 yamt chfs_alloc_full_dnode(void)
297 1.2.2.2 yamt {
298 1.2.2.2 yamt struct chfs_full_dnode *ret;
299 1.2.2.2 yamt ret = kmem_alloc(sizeof(struct chfs_full_dnode), KM_SLEEP);
300 1.2.2.2 yamt return ret;
301 1.2.2.2 yamt }
302 1.2.2.2 yamt
303 1.2.2.2 yamt void
304 1.2.2.2 yamt chfs_free_full_dnode(struct chfs_full_dnode *fd)
305 1.2.2.2 yamt {
306 1.2.2.2 yamt kmem_free(fd,(sizeof(struct chfs_full_dnode)));
307 1.2.2.2 yamt }
308 1.2.2.2 yamt
309 1.2.2.2 yamt struct chfs_flash_vnode*
310 1.2.2.2 yamt chfs_alloc_flash_vnode(void)
311 1.2.2.2 yamt {
312 1.2.2.2 yamt struct chfs_flash_vnode *ret;
313 1.2.2.2 yamt ret = pool_cache_get(chfs_flash_vnode_cache, 0);
314 1.2.2.2 yamt return ret;
315 1.2.2.2 yamt }
316 1.2.2.2 yamt
317 1.2.2.2 yamt void
318 1.2.2.2 yamt chfs_free_flash_vnode(struct chfs_flash_vnode *fvnode)
319 1.2.2.2 yamt {
320 1.2.2.2 yamt pool_cache_put(chfs_flash_vnode_cache, fvnode);
321 1.2.2.2 yamt }
322 1.2.2.2 yamt
323 1.2.2.2 yamt struct chfs_flash_dirent_node*
324 1.2.2.2 yamt chfs_alloc_flash_dirent(void)
325 1.2.2.2 yamt {
326 1.2.2.2 yamt struct chfs_flash_dirent_node *ret;
327 1.2.2.2 yamt ret = pool_cache_get(chfs_flash_dirent_cache, 0);
328 1.2.2.2 yamt return ret;
329 1.2.2.2 yamt }
330 1.2.2.2 yamt
331 1.2.2.2 yamt void
332 1.2.2.2 yamt chfs_free_flash_dirent(struct chfs_flash_dirent_node *fdnode)
333 1.2.2.2 yamt {
334 1.2.2.2 yamt pool_cache_put(chfs_flash_dirent_cache, fdnode);
335 1.2.2.2 yamt }
336 1.2.2.2 yamt
337 1.2.2.2 yamt struct chfs_flash_data_node*
338 1.2.2.2 yamt chfs_alloc_flash_dnode(void)
339 1.2.2.2 yamt {
340 1.2.2.2 yamt struct chfs_flash_data_node *ret;
341 1.2.2.2 yamt ret = pool_cache_get(chfs_flash_dnode_cache, 0);
342 1.2.2.2 yamt return ret;
343 1.2.2.2 yamt }
344 1.2.2.2 yamt
345 1.2.2.2 yamt void
346 1.2.2.2 yamt chfs_free_flash_dnode(struct chfs_flash_data_node *fdnode)
347 1.2.2.2 yamt {
348 1.2.2.2 yamt pool_cache_put(chfs_flash_dnode_cache, fdnode);
349 1.2.2.2 yamt }
350 1.2.2.2 yamt
351 1.2.2.2 yamt
352 1.2.2.2 yamt struct chfs_node_frag*
353 1.2.2.2 yamt chfs_alloc_node_frag(void)
354 1.2.2.2 yamt {
355 1.2.2.2 yamt struct chfs_node_frag *ret;
356 1.2.2.2 yamt ret = pool_cache_get(chfs_node_frag_cache, 0);
357 1.2.2.2 yamt return ret;
358 1.2.2.2 yamt
359 1.2.2.2 yamt }
360 1.2.2.2 yamt
361 1.2.2.2 yamt void
362 1.2.2.2 yamt chfs_free_node_frag(struct chfs_node_frag *frag)
363 1.2.2.2 yamt {
364 1.2.2.2 yamt pool_cache_put(chfs_node_frag_cache, frag);
365 1.2.2.2 yamt }
366 1.2.2.2 yamt
367 1.2.2.2 yamt struct chfs_tmp_dnode *
368 1.2.2.2 yamt chfs_alloc_tmp_dnode(void)
369 1.2.2.2 yamt {
370 1.2.2.2 yamt struct chfs_tmp_dnode *ret;
371 1.2.2.2 yamt ret = pool_cache_get(chfs_tmp_dnode_cache, 0);
372 1.2.2.2 yamt ret->next = NULL;
373 1.2.2.2 yamt return ret;
374 1.2.2.2 yamt }
375 1.2.2.2 yamt
376 1.2.2.2 yamt void
377 1.2.2.2 yamt chfs_free_tmp_dnode(struct chfs_tmp_dnode *td)
378 1.2.2.2 yamt {
379 1.2.2.2 yamt pool_cache_put(chfs_tmp_dnode_cache, td);
380 1.2.2.2 yamt }
381 1.2.2.2 yamt
382 1.2.2.2 yamt struct chfs_tmp_dnode_info *
383 1.2.2.2 yamt chfs_alloc_tmp_dnode_info(void)
384 1.2.2.2 yamt {
385 1.2.2.2 yamt struct chfs_tmp_dnode_info *ret;
386 1.2.2.2 yamt ret = pool_cache_get(chfs_tmp_dnode_info_cache, 0);
387 1.2.2.2 yamt ret->tmpnode = NULL;
388 1.2.2.2 yamt return ret;
389 1.2.2.2 yamt }
390 1.2.2.2 yamt
391 1.2.2.2 yamt void
392 1.2.2.2 yamt chfs_free_tmp_dnode_info(struct chfs_tmp_dnode_info *di)
393 1.2.2.2 yamt {
394 1.2.2.2 yamt pool_cache_put(chfs_tmp_dnode_info_cache, di);
395 1.2.2.2 yamt }
396 1.2.2.2 yamt
397