Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * JFFS2 -- Journalling Flash File System, Version 2. |
| 3 | * |
David Woodhouse | c00c310 | 2007-04-25 14:16:47 +0100 | [diff] [blame] | 4 | * Copyright © 2001-2007 Red Hat, Inc. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * |
| 6 | * Created by David Woodhouse <dwmw2@infradead.org> |
| 7 | * |
| 8 | * For licensing information, see the file 'LICENCE' in this directory. |
| 9 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Joe Perches | 5a52895 | 2012-02-15 15:56:45 -0800 | [diff] [blame] | 12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 13 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <linux/kernel.h> |
| 15 | #include <linux/slab.h> |
| 16 | #include <linux/init.h> |
| 17 | #include <linux/jffs2.h> |
| 18 | #include "nodelist.h" |
| 19 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | /* These are initialised to NULL in the kernel startup code. |
| 21 | If you're porting to other operating systems, beware */ |
Christoph Lameter | e18b890 | 2006-12-06 20:33:20 -0800 | [diff] [blame] | 22 | static struct kmem_cache *full_dnode_slab; |
| 23 | static struct kmem_cache *raw_dirent_slab; |
| 24 | static struct kmem_cache *raw_inode_slab; |
| 25 | static struct kmem_cache *tmp_dnode_info_slab; |
| 26 | static struct kmem_cache *raw_node_ref_slab; |
| 27 | static struct kmem_cache *node_frag_slab; |
| 28 | static struct kmem_cache *inode_cache_slab; |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 29 | #ifdef CONFIG_JFFS2_FS_XATTR |
Christoph Lameter | e18b890 | 2006-12-06 20:33:20 -0800 | [diff] [blame] | 30 | static struct kmem_cache *xattr_datum_cache; |
| 31 | static struct kmem_cache *xattr_ref_cache; |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 32 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | |
| 34 | int __init jffs2_create_slab_caches(void) |
| 35 | { |
Thomas Gleixner | 182ec4e | 2005-11-07 11:16:07 +0000 | [diff] [blame] | 36 | full_dnode_slab = kmem_cache_create("jffs2_full_dnode", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | sizeof(struct jffs2_full_dnode), |
Paul Mundt | 20c2df8 | 2007-07-20 10:11:58 +0900 | [diff] [blame] | 38 | 0, 0, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | if (!full_dnode_slab) |
| 40 | goto err; |
| 41 | |
| 42 | raw_dirent_slab = kmem_cache_create("jffs2_raw_dirent", |
| 43 | sizeof(struct jffs2_raw_dirent), |
David Woodhouse | dd79998 | 2009-09-19 16:14:01 -0700 | [diff] [blame] | 44 | 0, SLAB_HWCACHE_ALIGN, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | if (!raw_dirent_slab) |
| 46 | goto err; |
| 47 | |
| 48 | raw_inode_slab = kmem_cache_create("jffs2_raw_inode", |
| 49 | sizeof(struct jffs2_raw_inode), |
David Woodhouse | dd79998 | 2009-09-19 16:14:01 -0700 | [diff] [blame] | 50 | 0, SLAB_HWCACHE_ALIGN, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | if (!raw_inode_slab) |
| 52 | goto err; |
| 53 | |
| 54 | tmp_dnode_info_slab = kmem_cache_create("jffs2_tmp_dnode", |
| 55 | sizeof(struct jffs2_tmp_dnode_info), |
Paul Mundt | 20c2df8 | 2007-07-20 10:11:58 +0900 | [diff] [blame] | 56 | 0, 0, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | if (!tmp_dnode_info_slab) |
| 58 | goto err; |
| 59 | |
David Woodhouse | 9bfeb69 | 2006-05-26 21:19:05 +0100 | [diff] [blame] | 60 | raw_node_ref_slab = kmem_cache_create("jffs2_refblock", |
| 61 | sizeof(struct jffs2_raw_node_ref) * (REFS_PER_BLOCK + 1), |
Paul Mundt | 20c2df8 | 2007-07-20 10:11:58 +0900 | [diff] [blame] | 62 | 0, 0, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | if (!raw_node_ref_slab) |
| 64 | goto err; |
| 65 | |
| 66 | node_frag_slab = kmem_cache_create("jffs2_node_frag", |
| 67 | sizeof(struct jffs2_node_frag), |
Paul Mundt | 20c2df8 | 2007-07-20 10:11:58 +0900 | [diff] [blame] | 68 | 0, 0, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | if (!node_frag_slab) |
| 70 | goto err; |
| 71 | |
| 72 | inode_cache_slab = kmem_cache_create("jffs2_inode_cache", |
| 73 | sizeof(struct jffs2_inode_cache), |
Paul Mundt | 20c2df8 | 2007-07-20 10:11:58 +0900 | [diff] [blame] | 74 | 0, 0, NULL); |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 75 | if (!inode_cache_slab) |
| 76 | goto err; |
| 77 | |
| 78 | #ifdef CONFIG_JFFS2_FS_XATTR |
| 79 | xattr_datum_cache = kmem_cache_create("jffs2_xattr_datum", |
| 80 | sizeof(struct jffs2_xattr_datum), |
Paul Mundt | 20c2df8 | 2007-07-20 10:11:58 +0900 | [diff] [blame] | 81 | 0, 0, NULL); |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 82 | if (!xattr_datum_cache) |
| 83 | goto err; |
| 84 | |
| 85 | xattr_ref_cache = kmem_cache_create("jffs2_xattr_ref", |
| 86 | sizeof(struct jffs2_xattr_ref), |
Paul Mundt | 20c2df8 | 2007-07-20 10:11:58 +0900 | [diff] [blame] | 87 | 0, 0, NULL); |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 88 | if (!xattr_ref_cache) |
| 89 | goto err; |
| 90 | #endif |
| 91 | |
| 92 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | err: |
| 94 | jffs2_destroy_slab_caches(); |
| 95 | return -ENOMEM; |
| 96 | } |
| 97 | |
| 98 | void jffs2_destroy_slab_caches(void) |
| 99 | { |
Julia Lawall | e1305df | 2015-09-13 14:15:29 +0200 | [diff] [blame] | 100 | kmem_cache_destroy(full_dnode_slab); |
| 101 | kmem_cache_destroy(raw_dirent_slab); |
| 102 | kmem_cache_destroy(raw_inode_slab); |
| 103 | kmem_cache_destroy(tmp_dnode_info_slab); |
| 104 | kmem_cache_destroy(raw_node_ref_slab); |
| 105 | kmem_cache_destroy(node_frag_slab); |
| 106 | kmem_cache_destroy(inode_cache_slab); |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 107 | #ifdef CONFIG_JFFS2_FS_XATTR |
Julia Lawall | e1305df | 2015-09-13 14:15:29 +0200 | [diff] [blame] | 108 | kmem_cache_destroy(xattr_datum_cache); |
| 109 | kmem_cache_destroy(xattr_ref_cache); |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 110 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | struct jffs2_full_dirent *jffs2_alloc_full_dirent(int namesize) |
| 114 | { |
Artem B. Bityutskiy | f538c96 | 2005-07-27 15:16:57 +0100 | [diff] [blame] | 115 | struct jffs2_full_dirent *ret; |
| 116 | ret = kmalloc(sizeof(struct jffs2_full_dirent) + namesize, GFP_KERNEL); |
Artem B. Bityutskiy | 733802d | 2005-09-22 12:25:00 +0100 | [diff] [blame] | 117 | dbg_memalloc("%p\n", ret); |
Artem B. Bityutskiy | f538c96 | 2005-07-27 15:16:57 +0100 | [diff] [blame] | 118 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | void jffs2_free_full_dirent(struct jffs2_full_dirent *x) |
| 122 | { |
Artem B. Bityutskiy | 733802d | 2005-09-22 12:25:00 +0100 | [diff] [blame] | 123 | dbg_memalloc("%p\n", x); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | kfree(x); |
| 125 | } |
| 126 | |
| 127 | struct jffs2_full_dnode *jffs2_alloc_full_dnode(void) |
| 128 | { |
Artem B. Bityutskiy | f538c96 | 2005-07-27 15:16:57 +0100 | [diff] [blame] | 129 | struct jffs2_full_dnode *ret; |
| 130 | ret = kmem_cache_alloc(full_dnode_slab, GFP_KERNEL); |
Artem B. Bityutskiy | 733802d | 2005-09-22 12:25:00 +0100 | [diff] [blame] | 131 | dbg_memalloc("%p\n", ret); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | return ret; |
| 133 | } |
| 134 | |
| 135 | void jffs2_free_full_dnode(struct jffs2_full_dnode *x) |
| 136 | { |
Artem B. Bityutskiy | 733802d | 2005-09-22 12:25:00 +0100 | [diff] [blame] | 137 | dbg_memalloc("%p\n", x); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | kmem_cache_free(full_dnode_slab, x); |
| 139 | } |
| 140 | |
| 141 | struct jffs2_raw_dirent *jffs2_alloc_raw_dirent(void) |
| 142 | { |
Artem B. Bityutskiy | f538c96 | 2005-07-27 15:16:57 +0100 | [diff] [blame] | 143 | struct jffs2_raw_dirent *ret; |
| 144 | ret = kmem_cache_alloc(raw_dirent_slab, GFP_KERNEL); |
Artem B. Bityutskiy | 733802d | 2005-09-22 12:25:00 +0100 | [diff] [blame] | 145 | dbg_memalloc("%p\n", ret); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | return ret; |
| 147 | } |
| 148 | |
| 149 | void jffs2_free_raw_dirent(struct jffs2_raw_dirent *x) |
| 150 | { |
Artem B. Bityutskiy | 733802d | 2005-09-22 12:25:00 +0100 | [diff] [blame] | 151 | dbg_memalloc("%p\n", x); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | kmem_cache_free(raw_dirent_slab, x); |
| 153 | } |
| 154 | |
| 155 | struct jffs2_raw_inode *jffs2_alloc_raw_inode(void) |
| 156 | { |
Artem B. Bityutskiy | f538c96 | 2005-07-27 15:16:57 +0100 | [diff] [blame] | 157 | struct jffs2_raw_inode *ret; |
| 158 | ret = kmem_cache_alloc(raw_inode_slab, GFP_KERNEL); |
Artem B. Bityutskiy | 733802d | 2005-09-22 12:25:00 +0100 | [diff] [blame] | 159 | dbg_memalloc("%p\n", ret); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | return ret; |
| 161 | } |
| 162 | |
| 163 | void jffs2_free_raw_inode(struct jffs2_raw_inode *x) |
| 164 | { |
Artem B. Bityutskiy | 733802d | 2005-09-22 12:25:00 +0100 | [diff] [blame] | 165 | dbg_memalloc("%p\n", x); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | kmem_cache_free(raw_inode_slab, x); |
| 167 | } |
| 168 | |
| 169 | struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void) |
| 170 | { |
Artem B. Bityutskiy | f538c96 | 2005-07-27 15:16:57 +0100 | [diff] [blame] | 171 | struct jffs2_tmp_dnode_info *ret; |
| 172 | ret = kmem_cache_alloc(tmp_dnode_info_slab, GFP_KERNEL); |
Artem B. Bityutskiy | 733802d | 2005-09-22 12:25:00 +0100 | [diff] [blame] | 173 | dbg_memalloc("%p\n", |
Artem B. Bityutskiy | f538c96 | 2005-07-27 15:16:57 +0100 | [diff] [blame] | 174 | ret); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | return ret; |
| 176 | } |
| 177 | |
| 178 | void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *x) |
| 179 | { |
Artem B. Bityutskiy | 733802d | 2005-09-22 12:25:00 +0100 | [diff] [blame] | 180 | dbg_memalloc("%p\n", x); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | kmem_cache_free(tmp_dnode_info_slab, x); |
| 182 | } |
| 183 | |
Adrian Bunk | c05d52c | 2006-06-22 12:03:35 +0200 | [diff] [blame] | 184 | static struct jffs2_raw_node_ref *jffs2_alloc_refblock(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | { |
Artem B. Bityutskiy | f538c96 | 2005-07-27 15:16:57 +0100 | [diff] [blame] | 186 | struct jffs2_raw_node_ref *ret; |
David Woodhouse | 9bfeb69 | 2006-05-26 21:19:05 +0100 | [diff] [blame] | 187 | |
Artem B. Bityutskiy | f538c96 | 2005-07-27 15:16:57 +0100 | [diff] [blame] | 188 | ret = kmem_cache_alloc(raw_node_ref_slab, GFP_KERNEL); |
David Woodhouse | 9bfeb69 | 2006-05-26 21:19:05 +0100 | [diff] [blame] | 189 | if (ret) { |
| 190 | int i = 0; |
| 191 | for (i=0; i < REFS_PER_BLOCK; i++) { |
| 192 | ret[i].flash_offset = REF_EMPTY_NODE; |
| 193 | ret[i].next_in_ino = NULL; |
| 194 | } |
| 195 | ret[i].flash_offset = REF_LINK_NODE; |
| 196 | ret[i].next_in_ino = NULL; |
| 197 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | return ret; |
| 199 | } |
| 200 | |
David Woodhouse | 9bfeb69 | 2006-05-26 21:19:05 +0100 | [diff] [blame] | 201 | int jffs2_prealloc_raw_node_refs(struct jffs2_sb_info *c, |
| 202 | struct jffs2_eraseblock *jeb, int nr) |
| 203 | { |
| 204 | struct jffs2_raw_node_ref **p, *ref; |
| 205 | int i = nr; |
| 206 | |
| 207 | dbg_memalloc("%d\n", nr); |
| 208 | |
| 209 | p = &jeb->last_node; |
| 210 | ref = *p; |
| 211 | |
| 212 | dbg_memalloc("Reserving %d refs for block @0x%08x\n", nr, jeb->offset); |
| 213 | |
| 214 | /* If jeb->last_node is really a valid node then skip over it */ |
| 215 | if (ref && ref->flash_offset != REF_EMPTY_NODE) |
| 216 | ref++; |
| 217 | |
| 218 | while (i) { |
| 219 | if (!ref) { |
| 220 | dbg_memalloc("Allocating new refblock linked from %p\n", p); |
| 221 | ref = *p = jffs2_alloc_refblock(); |
| 222 | if (!ref) |
| 223 | return -ENOMEM; |
| 224 | } |
| 225 | if (ref->flash_offset == REF_LINK_NODE) { |
| 226 | p = &ref->next_in_ino; |
| 227 | ref = *p; |
| 228 | continue; |
| 229 | } |
| 230 | i--; |
| 231 | ref++; |
| 232 | } |
| 233 | jeb->allocated_refs = nr; |
| 234 | |
| 235 | dbg_memalloc("Reserved %d refs for block @0x%08x, last_node is %p (%08x,%p)\n", |
| 236 | nr, jeb->offset, jeb->last_node, jeb->last_node->flash_offset, |
| 237 | jeb->last_node->next_in_ino); |
| 238 | |
| 239 | return 0; |
| 240 | } |
| 241 | |
| 242 | void jffs2_free_refblock(struct jffs2_raw_node_ref *x) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | { |
Artem B. Bityutskiy | 733802d | 2005-09-22 12:25:00 +0100 | [diff] [blame] | 244 | dbg_memalloc("%p\n", x); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | kmem_cache_free(raw_node_ref_slab, x); |
| 246 | } |
| 247 | |
| 248 | struct jffs2_node_frag *jffs2_alloc_node_frag(void) |
| 249 | { |
Artem B. Bityutskiy | f538c96 | 2005-07-27 15:16:57 +0100 | [diff] [blame] | 250 | struct jffs2_node_frag *ret; |
| 251 | ret = kmem_cache_alloc(node_frag_slab, GFP_KERNEL); |
Artem B. Bityutskiy | 733802d | 2005-09-22 12:25:00 +0100 | [diff] [blame] | 252 | dbg_memalloc("%p\n", ret); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | return ret; |
| 254 | } |
| 255 | |
| 256 | void jffs2_free_node_frag(struct jffs2_node_frag *x) |
| 257 | { |
Artem B. Bityutskiy | 733802d | 2005-09-22 12:25:00 +0100 | [diff] [blame] | 258 | dbg_memalloc("%p\n", x); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | kmem_cache_free(node_frag_slab, x); |
| 260 | } |
| 261 | |
| 262 | struct jffs2_inode_cache *jffs2_alloc_inode_cache(void) |
| 263 | { |
Artem B. Bityutskiy | f538c96 | 2005-07-27 15:16:57 +0100 | [diff] [blame] | 264 | struct jffs2_inode_cache *ret; |
| 265 | ret = kmem_cache_alloc(inode_cache_slab, GFP_KERNEL); |
Artem B. Bityutskiy | 733802d | 2005-09-22 12:25:00 +0100 | [diff] [blame] | 266 | dbg_memalloc("%p\n", ret); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | return ret; |
| 268 | } |
| 269 | |
| 270 | void jffs2_free_inode_cache(struct jffs2_inode_cache *x) |
| 271 | { |
Artem B. Bityutskiy | 733802d | 2005-09-22 12:25:00 +0100 | [diff] [blame] | 272 | dbg_memalloc("%p\n", x); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | kmem_cache_free(inode_cache_slab, x); |
| 274 | } |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 275 | |
| 276 | #ifdef CONFIG_JFFS2_FS_XATTR |
| 277 | struct jffs2_xattr_datum *jffs2_alloc_xattr_datum(void) |
| 278 | { |
| 279 | struct jffs2_xattr_datum *xd; |
Wei Yongjun | c6d59cd | 2009-03-04 12:01:35 -0800 | [diff] [blame] | 280 | xd = kmem_cache_zalloc(xattr_datum_cache, GFP_KERNEL); |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 281 | dbg_memalloc("%p\n", xd); |
Zhouyi Zhou | 2072552 | 2013-12-02 18:37:05 +0800 | [diff] [blame] | 282 | if (!xd) |
| 283 | return NULL; |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 284 | |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 285 | xd->class = RAWNODE_CLASS_XATTR_DATUM; |
KaiGai Kohei | c9f700f | 2006-06-11 10:35:15 +0900 | [diff] [blame] | 286 | xd->node = (void *)xd; |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 287 | INIT_LIST_HEAD(&xd->xindex); |
| 288 | return xd; |
| 289 | } |
| 290 | |
| 291 | void jffs2_free_xattr_datum(struct jffs2_xattr_datum *xd) |
| 292 | { |
| 293 | dbg_memalloc("%p\n", xd); |
| 294 | kmem_cache_free(xattr_datum_cache, xd); |
| 295 | } |
| 296 | |
| 297 | struct jffs2_xattr_ref *jffs2_alloc_xattr_ref(void) |
| 298 | { |
| 299 | struct jffs2_xattr_ref *ref; |
Wei Yongjun | c6d59cd | 2009-03-04 12:01:35 -0800 | [diff] [blame] | 300 | ref = kmem_cache_zalloc(xattr_ref_cache, GFP_KERNEL); |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 301 | dbg_memalloc("%p\n", ref); |
Zhouyi Zhou | 2072552 | 2013-12-02 18:37:05 +0800 | [diff] [blame] | 302 | if (!ref) |
| 303 | return NULL; |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 304 | |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 305 | ref->class = RAWNODE_CLASS_XATTR_REF; |
KaiGai Kohei | c9f700f | 2006-06-11 10:35:15 +0900 | [diff] [blame] | 306 | ref->node = (void *)ref; |
KaiGai Kohei | aa98d7c | 2006-05-13 15:09:47 +0900 | [diff] [blame] | 307 | return ref; |
| 308 | } |
| 309 | |
| 310 | void jffs2_free_xattr_ref(struct jffs2_xattr_ref *ref) |
| 311 | { |
| 312 | dbg_memalloc("%p\n", ref); |
| 313 | kmem_cache_free(xattr_ref_cache, ref); |
| 314 | } |
| 315 | #endif |