Release 4.7 fs/jffs2/malloc.c
/*
* JFFS2 -- Journalling Flash File System, Version 2.
*
* Copyright © 2001-2007 Red Hat, Inc.
*
* Created by David Woodhouse <dwmw2@infradead.org>
*
* For licensing information, see the file 'LICENCE' in this directory.
*
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/jffs2.h>
#include "nodelist.h"
/* These are initialised to NULL in the kernel startup code.
If you're porting to other operating systems, beware */
static struct kmem_cache *full_dnode_slab;
static struct kmem_cache *raw_dirent_slab;
static struct kmem_cache *raw_inode_slab;
static struct kmem_cache *tmp_dnode_info_slab;
static struct kmem_cache *raw_node_ref_slab;
static struct kmem_cache *node_frag_slab;
static struct kmem_cache *inode_cache_slab;
#ifdef CONFIG_JFFS2_FS_XATTR
static struct kmem_cache *xattr_datum_cache;
static struct kmem_cache *xattr_ref_cache;
#endif
int __init jffs2_create_slab_caches(void)
{
full_dnode_slab = kmem_cache_create("jffs2_full_dnode",
sizeof(struct jffs2_full_dnode),
0, 0, NULL);
if (!full_dnode_slab)
goto err;
raw_dirent_slab = kmem_cache_create("jffs2_raw_dirent",
sizeof(struct jffs2_raw_dirent),
0, SLAB_HWCACHE_ALIGN, NULL);
if (!raw_dirent_slab)
goto err;
raw_inode_slab = kmem_cache_create("jffs2_raw_inode",
sizeof(struct jffs2_raw_inode),
0, SLAB_HWCACHE_ALIGN, NULL);
if (!raw_inode_slab)
goto err;
tmp_dnode_info_slab = kmem_cache_create("jffs2_tmp_dnode",
sizeof(struct jffs2_tmp_dnode_info),
0, 0, NULL);
if (!tmp_dnode_info_slab)
goto err;
raw_node_ref_slab = kmem_cache_create("jffs2_refblock",
sizeof(struct jffs2_raw_node_ref) * (REFS_PER_BLOCK + 1),
0, 0, NULL);
if (!raw_node_ref_slab)
goto err;
node_frag_slab = kmem_cache_create("jffs2_node_frag",
sizeof(struct jffs2_node_frag),
0, 0, NULL);
if (!node_frag_slab)
goto err;
inode_cache_slab = kmem_cache_create("jffs2_inode_cache",
sizeof(struct jffs2_inode_cache),
0, 0, NULL);
if (!inode_cache_slab)
goto err;
#ifdef CONFIG_JFFS2_FS_XATTR
xattr_datum_cache = kmem_cache_create("jffs2_xattr_datum",
sizeof(struct jffs2_xattr_datum),
0, 0, NULL);
if (!xattr_datum_cache)
goto err;
xattr_ref_cache = kmem_cache_create("jffs2_xattr_ref",
sizeof(struct jffs2_xattr_ref),
0, 0, NULL);
if (!xattr_ref_cache)
goto err;
#endif
return 0;
err:
jffs2_destroy_slab_caches();
return -ENOMEM;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 196 | 71.53% | 1 | 16.67% |
kaigai kohei | kaigai kohei | 63 | 22.99% | 1 | 16.67% |
david woodhouse | david woodhouse | 10 | 3.65% | 3 | 50.00% |
artem bityutskiy | artem bityutskiy | 5 | 1.82% | 1 | 16.67% |
| Total | 274 | 100.00% | 6 | 100.00% |
void jffs2_destroy_slab_caches(void)
{
kmem_cache_destroy(full_dnode_slab);
kmem_cache_destroy(raw_dirent_slab);
kmem_cache_destroy(raw_inode_slab);
kmem_cache_destroy(tmp_dnode_info_slab);
kmem_cache_destroy(raw_node_ref_slab);
kmem_cache_destroy(node_frag_slab);
kmem_cache_destroy(inode_cache_slab);
#ifdef CONFIG_JFFS2_FS_XATTR
kmem_cache_destroy(xattr_datum_cache);
kmem_cache_destroy(xattr_ref_cache);
#endif
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 42 | 73.68% | 1 | 50.00% |
kaigai kohei | kaigai kohei | 15 | 26.32% | 1 | 50.00% |
| Total | 57 | 100.00% | 2 | 100.00% |
struct jffs2_full_dirent *jffs2_alloc_full_dirent(int namesize)
{
struct jffs2_full_dirent *ret;
ret = kmalloc(sizeof(struct jffs2_full_dirent) + namesize, GFP_KERNEL);
dbg_memalloc("%p\n", ret);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 23 | 57.50% | 1 | 33.33% |
artem bityutskiy | artem bityutskiy | 17 | 42.50% | 2 | 66.67% |
| Total | 40 | 100.00% | 3 | 100.00% |
void jffs2_free_full_dirent(struct jffs2_full_dirent *x)
{
dbg_memalloc("%p\n", x);
kfree(x);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 15 | 68.18% | 1 | 33.33% |
artem bityutskiy | artem bityutskiy | 7 | 31.82% | 2 | 66.67% |
| Total | 22 | 100.00% | 3 | 100.00% |
struct jffs2_full_dnode *jffs2_alloc_full_dnode(void)
{
struct jffs2_full_dnode *ret;
ret = kmem_cache_alloc(full_dnode_slab, GFP_KERNEL);
dbg_memalloc("%p\n", ret);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 20 | 60.61% | 1 | 25.00% |
david woodhouse | david woodhouse | 7 | 21.21% | 1 | 25.00% |
artem bityutskiy | artem bityutskiy | 6 | 18.18% | 2 | 50.00% |
| Total | 33 | 100.00% | 4 | 100.00% |
void jffs2_free_full_dnode(struct jffs2_full_dnode *x)
{
dbg_memalloc("%p\n", x);
kmem_cache_free(full_dnode_slab, x);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 17 | 70.83% | 1 | 25.00% |
david woodhouse | david woodhouse | 5 | 20.83% | 1 | 25.00% |
artem bityutskiy | artem bityutskiy | 2 | 8.33% | 2 | 50.00% |
| Total | 24 | 100.00% | 4 | 100.00% |
struct jffs2_raw_dirent *jffs2_alloc_raw_dirent(void)
{
struct jffs2_raw_dirent *ret;
ret = kmem_cache_alloc(raw_dirent_slab, GFP_KERNEL);
dbg_memalloc("%p\n", ret);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 16 | 48.48% | 1 | 25.00% |
david woodhouse | david woodhouse | 11 | 33.33% | 1 | 25.00% |
artem bityutskiy | artem bityutskiy | 6 | 18.18% | 2 | 50.00% |
| Total | 33 | 100.00% | 4 | 100.00% |
void jffs2_free_raw_dirent(struct jffs2_raw_dirent *x)
{
dbg_memalloc("%p\n", x);
kmem_cache_free(raw_dirent_slab, x);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 17 | 70.83% | 1 | 25.00% |
david woodhouse | david woodhouse | 5 | 20.83% | 1 | 25.00% |
artem bityutskiy | artem bityutskiy | 2 | 8.33% | 2 | 50.00% |
| Total | 24 | 100.00% | 4 | 100.00% |
struct jffs2_raw_inode *jffs2_alloc_raw_inode(void)
{
struct jffs2_raw_inode *ret;
ret = kmem_cache_alloc(raw_inode_slab, GFP_KERNEL);
dbg_memalloc("%p\n", ret);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 16 | 48.48% | 1 | 25.00% |
david woodhouse | david woodhouse | 11 | 33.33% | 1 | 25.00% |
artem bityutskiy | artem bityutskiy | 6 | 18.18% | 2 | 50.00% |
| Total | 33 | 100.00% | 4 | 100.00% |
void jffs2_free_raw_inode(struct jffs2_raw_inode *x)
{
dbg_memalloc("%p\n", x);
kmem_cache_free(raw_inode_slab, x);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 17 | 70.83% | 1 | 25.00% |
david woodhouse | david woodhouse | 5 | 20.83% | 1 | 25.00% |
artem bityutskiy | artem bityutskiy | 2 | 8.33% | 2 | 50.00% |
| Total | 24 | 100.00% | 4 | 100.00% |
struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void)
{
struct jffs2_tmp_dnode_info *ret;
ret = kmem_cache_alloc(tmp_dnode_info_slab, GFP_KERNEL);
dbg_memalloc("%p\n",
ret);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 16 | 48.48% | 1 | 25.00% |
david woodhouse | david woodhouse | 11 | 33.33% | 1 | 25.00% |
artem bityutskiy | artem bityutskiy | 6 | 18.18% | 2 | 50.00% |
| Total | 33 | 100.00% | 4 | 100.00% |
void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *x)
{
dbg_memalloc("%p\n", x);
kmem_cache_free(tmp_dnode_info_slab, x);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 17 | 70.83% | 1 | 25.00% |
david woodhouse | david woodhouse | 5 | 20.83% | 1 | 25.00% |
artem bityutskiy | artem bityutskiy | 2 | 8.33% | 2 | 50.00% |
| Total | 24 | 100.00% | 4 | 100.00% |
static struct jffs2_raw_node_ref *jffs2_alloc_refblock(void)
{
struct jffs2_raw_node_ref *ret;
ret = kmem_cache_alloc(raw_node_ref_slab, GFP_KERNEL);
if (ret) {
int i = 0;
for (i=0; i < REFS_PER_BLOCK; i++) {
ret[i].flash_offset = REF_EMPTY_NODE;
ret[i].next_in_ino = NULL;
}
ret[i].flash_offset = REF_LINK_NODE;
ret[i].next_in_ino = NULL;
}
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
david woodhouse | david woodhouse | 88 | 98.88% | 1 | 50.00% |
adrian bunk | adrian bunk | 1 | 1.12% | 1 | 50.00% |
| Total | 89 | 100.00% | 2 | 100.00% |
int jffs2_prealloc_raw_node_refs(struct jffs2_sb_info *c,
struct jffs2_eraseblock *jeb, int nr)
{
struct jffs2_raw_node_ref **p, *ref;
int i = nr;
dbg_memalloc("%d\n", nr);
p = &jeb->last_node;
ref = *p;
dbg_memalloc("Reserving %d refs for block @0x%08x\n", nr, jeb->offset);
/* If jeb->last_node is really a valid node then skip over it */
if (ref && ref->flash_offset != REF_EMPTY_NODE)
ref++;
while (i) {
if (!ref) {
dbg_memalloc("Allocating new refblock linked from %p\n", p);
ref = *p = jffs2_alloc_refblock();
if (!ref)
return -ENOMEM;
}
if (ref->flash_offset == REF_LINK_NODE) {
p = &ref->next_in_ino;
ref = *p;
continue;
}
i--;
ref++;
}
jeb->allocated_refs = nr;
dbg_memalloc("Reserved %d refs for block @0x%08x, last_node is %p (%08x,%p)\n",
nr, jeb->offset, jeb->last_node, jeb->last_node->flash_offset,
jeb->last_node->next_in_ino);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
david woodhouse | david woodhouse | 175 | 98.31% | 4 | 66.67% |
linus torvalds | linus torvalds | 2 | 1.12% | 1 | 16.67% |
artem bityutskiy | artem bityutskiy | 1 | 0.56% | 1 | 16.67% |
| Total | 178 | 100.00% | 6 | 100.00% |
void jffs2_free_refblock(struct jffs2_raw_node_ref *x)
{
dbg_memalloc("%p\n", x);
kmem_cache_free(raw_node_ref_slab, x);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 16 | 66.67% | 1 | 20.00% |
david woodhouse | david woodhouse | 6 | 25.00% | 2 | 40.00% |
artem bityutskiy | artem bityutskiy | 2 | 8.33% | 2 | 40.00% |
| Total | 24 | 100.00% | 5 | 100.00% |
struct jffs2_node_frag *jffs2_alloc_node_frag(void)
{
struct jffs2_node_frag *ret;
ret = kmem_cache_alloc(node_frag_slab, GFP_KERNEL);
dbg_memalloc("%p\n", ret);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 16 | 48.48% | 1 | 25.00% |
david woodhouse | david woodhouse | 11 | 33.33% | 1 | 25.00% |
artem bityutskiy | artem bityutskiy | 6 | 18.18% | 2 | 50.00% |
| Total | 33 | 100.00% | 4 | 100.00% |
void jffs2_free_node_frag(struct jffs2_node_frag *x)
{
dbg_memalloc("%p\n", x);
kmem_cache_free(node_frag_slab, x);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 17 | 70.83% | 1 | 25.00% |
david woodhouse | david woodhouse | 5 | 20.83% | 1 | 25.00% |
artem bityutskiy | artem bityutskiy | 2 | 8.33% | 2 | 50.00% |
| Total | 24 | 100.00% | 4 | 100.00% |
struct jffs2_inode_cache *jffs2_alloc_inode_cache(void)
{
struct jffs2_inode_cache *ret;
ret = kmem_cache_alloc(inode_cache_slab, GFP_KERNEL);
dbg_memalloc("%p\n", ret);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 27 | 81.82% | 1 | 33.33% |
artem bityutskiy | artem bityutskiy | 6 | 18.18% | 2 | 66.67% |
| Total | 33 | 100.00% | 3 | 100.00% |
void jffs2_free_inode_cache(struct jffs2_inode_cache *x)
{
dbg_memalloc("%p\n", x);
kmem_cache_free(inode_cache_slab, x);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 22 | 91.67% | 1 | 33.33% |
artem bityutskiy | artem bityutskiy | 2 | 8.33% | 2 | 66.67% |
| Total | 24 | 100.00% | 3 | 100.00% |
#ifdef CONFIG_JFFS2_FS_XATTR
struct jffs2_xattr_datum *jffs2_alloc_xattr_datum(void)
{
struct jffs2_xattr_datum *xd;
xd = kmem_cache_zalloc(xattr_datum_cache, GFP_KERNEL);
dbg_memalloc("%p\n", xd);
if (!xd)
return NULL;
xd->class = RAWNODE_CLASS_XATTR_DATUM;
xd->node = (void *)xd;
INIT_LIST_HEAD(&xd->xindex);
return xd;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kaigai kohei | kaigai kohei | 56 | 86.15% | 2 | 50.00% |
zhouyi zhou | zhouyi zhou | 8 | 12.31% | 1 | 25.00% |
wei yongjun | wei yongjun | 1 | 1.54% | 1 | 25.00% |
| Total | 65 | 100.00% | 4 | 100.00% |
void jffs2_free_xattr_datum(struct jffs2_xattr_datum *xd)
{
dbg_memalloc("%p\n", xd);
kmem_cache_free(xattr_datum_cache, xd);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kaigai kohei | kaigai kohei | 24 | 100.00% | 1 | 100.00% |
| Total | 24 | 100.00% | 1 | 100.00% |
struct jffs2_xattr_ref *jffs2_alloc_xattr_ref(void)
{
struct jffs2_xattr_ref *ref;
ref = kmem_cache_zalloc(xattr_ref_cache, GFP_KERNEL);
dbg_memalloc("%p\n", ref);
if (!ref)
return NULL;
ref->class = RAWNODE_CLASS_XATTR_REF;
ref->node = (void *)ref;
return ref;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kaigai kohei | kaigai kohei | 48 | 84.21% | 2 | 50.00% |
zhouyi zhou | zhouyi zhou | 8 | 14.04% | 1 | 25.00% |
wei yongjun | wei yongjun | 1 | 1.75% | 1 | 25.00% |
| Total | 57 | 100.00% | 4 | 100.00% |
void jffs2_free_xattr_ref(struct jffs2_xattr_ref *ref)
{
dbg_memalloc("%p\n", ref);
kmem_cache_free(xattr_ref_cache, ref);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kaigai kohei | kaigai kohei | 24 | 100.00% | 1 | 100.00% |
| Total | 24 | 100.00% | 1 | 100.00% |
#endif
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 556 | 43.30% | 1 | 5.88% |
david woodhouse | david woodhouse | 356 | 27.73% | 7 | 41.18% |
kaigai kohei | kaigai kohei | 248 | 19.31% | 2 | 11.76% |
artem bityutskiy | artem bityutskiy | 80 | 6.23% | 2 | 11.76% |
christoph lameter | christoph lameter | 18 | 1.40% | 1 | 5.88% |
zhouyi zhou | zhouyi zhou | 16 | 1.25% | 1 | 5.88% |
joe perches | joe perches | 7 | 0.55% | 1 | 5.88% |
wei yongjun | wei yongjun | 2 | 0.16% | 1 | 5.88% |
adrian bunk | adrian bunk | 1 | 0.08% | 1 | 5.88% |
| Total | 1284 | 100.00% | 17 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.