Commit f538c96b authored by Artem B. Bityutskiy's avatar Artem B. Bityutskiy Committed by Thomas Gleixner

[JFFS2] Debug code clean up - step 4

Small comment cleanups. Remove a unused macro
Signed-off-by: default avatarArtem B. Bityutskiy <dedekind@infradead.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 2227c0ba
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* For licensing information, see the file 'LICENCE' in this directory. * For licensing information, see the file 'LICENCE' in this directory.
* *
* $Id: debug.h,v 1.6 2005/07/24 15:18:26 dedekind Exp $ * $Id: debug.h,v 1.7 2005/07/27 13:06:56 dedekind Exp $
* *
*/ */
#ifndef _JFFS2_DEBUG_H_ #ifndef _JFFS2_DEBUG_H_
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <linux/config.h> #include <linux/config.h>
#ifndef CONFIG_JFFS2_FS_DEBUG #ifndef CONFIG_JFFS2_FS_DEBUG
#define CONFIG_JFFS2_FS_DEBUG 1 #define CONFIG_JFFS2_FS_DEBUG 0
#endif #endif
#if CONFIG_JFFS2_FS_DEBUG == 1 #if CONFIG_JFFS2_FS_DEBUG == 1
...@@ -119,20 +119,28 @@ ...@@ -119,20 +119,28 @@
#define JFFS2_DBG_FRAGTREE2(fmt, ...) #define JFFS2_DBG_FRAGTREE2(fmt, ...)
#endif #endif
/* Plays with node_refs */ /* Print the messages about manipulating node_refs */
#ifdef JFFS2_DBG_NODEREF_MESSAGES #ifdef JFFS2_DBG_NODEREF_MESSAGES
#define JFFS2_DBG_NODEREF(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) #define JFFS2_DBG_NODEREF(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else #else
#define JFFS2_DBG_NODEREF(fmt, ...) #define JFFS2_DBG_NODEREF(fmt, ...)
#endif #endif
/* Plays with the list of inodes (JFFS2 inocache) */ /* Manipulations with the list of inodes (JFFS2 inocache) */
#ifdef JFFS2_DBG_INOCACHE_MESSAGES #ifdef JFFS2_DBG_INOCACHE_MESSAGES
#define JFFS2_DBG_INOCACHE(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) #define JFFS2_DBG_INOCACHE(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else #else
#define JFFS2_DBG_INOCACHE(fmt, ...) #define JFFS2_DBG_INOCACHE(fmt, ...)
#endif #endif
/* Watch the object allocations */
#ifdef JFFS2_DBG_MEMALLOC_MESSAGES
#define JFFS2_DBG_MEMALLOC(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
#define JFFS2_DBG_MEMALLOC(fmt, ...)
#endif
/* "Paranoia" checks */ /* "Paranoia" checks */
void void
__jffs2_dbg_fragtree_paranoia_check(struct jffs2_inode_info *f); __jffs2_dbg_fragtree_paranoia_check(struct jffs2_inode_info *f);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* For licensing information, see the file 'LICENCE' in this directory. * For licensing information, see the file 'LICENCE' in this directory.
* *
* $Id: malloc.c,v 1.28 2004/11/16 20:36:11 dwmw2 Exp $ * $Id: malloc.c,v 1.29 2005/07/27 14:16:53 dedekind Exp $
* *
*/ */
...@@ -17,15 +17,6 @@ ...@@ -17,15 +17,6 @@
#include <linux/jffs2.h> #include <linux/jffs2.h>
#include "nodelist.h" #include "nodelist.h"
#if 0
#define JFFS2_SLAB_POISON SLAB_POISON
#else
#define JFFS2_SLAB_POISON 0
#endif
// replace this by #define D3 (x) x for cache debugging
#define D3(x)
/* These are initialised to NULL in the kernel startup code. /* These are initialised to NULL in the kernel startup code.
If you're porting to other operating systems, beware */ If you're porting to other operating systems, beware */
static kmem_cache_t *full_dnode_slab; static kmem_cache_t *full_dnode_slab;
...@@ -40,43 +31,43 @@ int __init jffs2_create_slab_caches(void) ...@@ -40,43 +31,43 @@ int __init jffs2_create_slab_caches(void)
{ {
full_dnode_slab = kmem_cache_create("jffs2_full_dnode", full_dnode_slab = kmem_cache_create("jffs2_full_dnode",
sizeof(struct jffs2_full_dnode), sizeof(struct jffs2_full_dnode),
0, JFFS2_SLAB_POISON, NULL, NULL); 0, 0, NULL, NULL);
if (!full_dnode_slab) if (!full_dnode_slab)
goto err; goto err;
raw_dirent_slab = kmem_cache_create("jffs2_raw_dirent", raw_dirent_slab = kmem_cache_create("jffs2_raw_dirent",
sizeof(struct jffs2_raw_dirent), sizeof(struct jffs2_raw_dirent),
0, JFFS2_SLAB_POISON, NULL, NULL); 0, 0, NULL, NULL);
if (!raw_dirent_slab) if (!raw_dirent_slab)
goto err; goto err;
raw_inode_slab = kmem_cache_create("jffs2_raw_inode", raw_inode_slab = kmem_cache_create("jffs2_raw_inode",
sizeof(struct jffs2_raw_inode), sizeof(struct jffs2_raw_inode),
0, JFFS2_SLAB_POISON, NULL, NULL); 0, 0, NULL, NULL);
if (!raw_inode_slab) if (!raw_inode_slab)
goto err; goto err;
tmp_dnode_info_slab = kmem_cache_create("jffs2_tmp_dnode", tmp_dnode_info_slab = kmem_cache_create("jffs2_tmp_dnode",
sizeof(struct jffs2_tmp_dnode_info), sizeof(struct jffs2_tmp_dnode_info),
0, JFFS2_SLAB_POISON, NULL, NULL); 0, 0, NULL, NULL);
if (!tmp_dnode_info_slab) if (!tmp_dnode_info_slab)
goto err; goto err;
raw_node_ref_slab = kmem_cache_create("jffs2_raw_node_ref", raw_node_ref_slab = kmem_cache_create("jffs2_raw_node_ref",
sizeof(struct jffs2_raw_node_ref), sizeof(struct jffs2_raw_node_ref),
0, JFFS2_SLAB_POISON, NULL, NULL); 0, 0, NULL, NULL);
if (!raw_node_ref_slab) if (!raw_node_ref_slab)
goto err; goto err;
node_frag_slab = kmem_cache_create("jffs2_node_frag", node_frag_slab = kmem_cache_create("jffs2_node_frag",
sizeof(struct jffs2_node_frag), sizeof(struct jffs2_node_frag),
0, JFFS2_SLAB_POISON, NULL, NULL); 0, 0, NULL, NULL);
if (!node_frag_slab) if (!node_frag_slab)
goto err; goto err;
inode_cache_slab = kmem_cache_create("jffs2_inode_cache", inode_cache_slab = kmem_cache_create("jffs2_inode_cache",
sizeof(struct jffs2_inode_cache), sizeof(struct jffs2_inode_cache),
0, JFFS2_SLAB_POISON, NULL, NULL); 0, 0, NULL, NULL);
if (inode_cache_slab) if (inode_cache_slab)
return 0; return 0;
err: err:
...@@ -104,102 +95,113 @@ void jffs2_destroy_slab_caches(void) ...@@ -104,102 +95,113 @@ void jffs2_destroy_slab_caches(void)
struct jffs2_full_dirent *jffs2_alloc_full_dirent(int namesize) struct jffs2_full_dirent *jffs2_alloc_full_dirent(int namesize)
{ {
return kmalloc(sizeof(struct jffs2_full_dirent) + namesize, GFP_KERNEL); struct jffs2_full_dirent *ret;
ret = kmalloc(sizeof(struct jffs2_full_dirent) + namesize, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n", ret);
return ret;
} }
void jffs2_free_full_dirent(struct jffs2_full_dirent *x) void jffs2_free_full_dirent(struct jffs2_full_dirent *x)
{ {
JFFS2_DBG_MEMALLOC("%p\n", x);
kfree(x); kfree(x);
} }
struct jffs2_full_dnode *jffs2_alloc_full_dnode(void) struct jffs2_full_dnode *jffs2_alloc_full_dnode(void)
{ {
struct jffs2_full_dnode *ret = kmem_cache_alloc(full_dnode_slab, GFP_KERNEL); struct jffs2_full_dnode *ret;
D3 (printk (KERN_DEBUG "alloc_full_dnode at %p\n", ret)); ret = kmem_cache_alloc(full_dnode_slab, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n", ret);
return ret; return ret;
} }
void jffs2_free_full_dnode(struct jffs2_full_dnode *x) void jffs2_free_full_dnode(struct jffs2_full_dnode *x)
{ {
D3 (printk (KERN_DEBUG "free full_dnode at %p\n", x)); JFFS2_DBG_MEMALLOC("%p\n", x);
kmem_cache_free(full_dnode_slab, x); kmem_cache_free(full_dnode_slab, x);
} }
struct jffs2_raw_dirent *jffs2_alloc_raw_dirent(void) struct jffs2_raw_dirent *jffs2_alloc_raw_dirent(void)
{ {
struct jffs2_raw_dirent *ret = kmem_cache_alloc(raw_dirent_slab, GFP_KERNEL); struct jffs2_raw_dirent *ret;
D3 (printk (KERN_DEBUG "alloc_raw_dirent\n", ret)); ret = kmem_cache_alloc(raw_dirent_slab, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n", ret);
return ret; return ret;
} }
void jffs2_free_raw_dirent(struct jffs2_raw_dirent *x) void jffs2_free_raw_dirent(struct jffs2_raw_dirent *x)
{ {
D3 (printk (KERN_DEBUG "free_raw_dirent at %p\n", x)); JFFS2_DBG_MEMALLOC("%p\n", x);
kmem_cache_free(raw_dirent_slab, x); kmem_cache_free(raw_dirent_slab, x);
} }
struct jffs2_raw_inode *jffs2_alloc_raw_inode(void) struct jffs2_raw_inode *jffs2_alloc_raw_inode(void)
{ {
struct jffs2_raw_inode *ret = kmem_cache_alloc(raw_inode_slab, GFP_KERNEL); struct jffs2_raw_inode *ret;
D3 (printk (KERN_DEBUG "alloc_raw_inode at %p\n", ret)); ret = kmem_cache_alloc(raw_inode_slab, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n", ret);
return ret; return ret;
} }
void jffs2_free_raw_inode(struct jffs2_raw_inode *x) void jffs2_free_raw_inode(struct jffs2_raw_inode *x)
{ {
D3 (printk (KERN_DEBUG "free_raw_inode at %p\n", x)); JFFS2_DBG_MEMALLOC("%p\n", x);
kmem_cache_free(raw_inode_slab, x); kmem_cache_free(raw_inode_slab, x);
} }
struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void) struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void)
{ {
struct jffs2_tmp_dnode_info *ret = kmem_cache_alloc(tmp_dnode_info_slab, GFP_KERNEL); struct jffs2_tmp_dnode_info *ret;
D3 (printk (KERN_DEBUG "alloc_tmp_dnode_info at %p\n", ret)); ret = kmem_cache_alloc(tmp_dnode_info_slab, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n",
ret);
return ret; return ret;
} }
void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *x) void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *x)
{ {
D3 (printk (KERN_DEBUG "free_tmp_dnode_info at %p\n", x)); JFFS2_DBG_MEMALLOC("%p\n", x);
kmem_cache_free(tmp_dnode_info_slab, x); kmem_cache_free(tmp_dnode_info_slab, x);
} }
struct jffs2_raw_node_ref *jffs2_alloc_raw_node_ref(void) struct jffs2_raw_node_ref *jffs2_alloc_raw_node_ref(void)
{ {
struct jffs2_raw_node_ref *ret = kmem_cache_alloc(raw_node_ref_slab, GFP_KERNEL); struct jffs2_raw_node_ref *ret;
D3 (printk (KERN_DEBUG "alloc_raw_node_ref at %p\n", ret)); ret = kmem_cache_alloc(raw_node_ref_slab, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n", ret);
return ret; return ret;
} }
void jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *x) void jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *x)
{ {
D3 (printk (KERN_DEBUG "free_raw_node_ref at %p\n", x)); JFFS2_DBG_MEMALLOC("%p\n", x);
kmem_cache_free(raw_node_ref_slab, x); kmem_cache_free(raw_node_ref_slab, x);
} }
struct jffs2_node_frag *jffs2_alloc_node_frag(void) struct jffs2_node_frag *jffs2_alloc_node_frag(void)
{ {
struct jffs2_node_frag *ret = kmem_cache_alloc(node_frag_slab, GFP_KERNEL); struct jffs2_node_frag *ret;
D3 (printk (KERN_DEBUG "alloc_node_frag at %p\n", ret)); ret = kmem_cache_alloc(node_frag_slab, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n", ret);
return ret; return ret;
} }
void jffs2_free_node_frag(struct jffs2_node_frag *x) void jffs2_free_node_frag(struct jffs2_node_frag *x)
{ {
D3 (printk (KERN_DEBUG "free_node_frag at %p\n", x)); JFFS2_DBG_MEMALLOC("%p\n", x);
kmem_cache_free(node_frag_slab, x); kmem_cache_free(node_frag_slab, x);
} }
struct jffs2_inode_cache *jffs2_alloc_inode_cache(void) struct jffs2_inode_cache *jffs2_alloc_inode_cache(void)
{ {
struct jffs2_inode_cache *ret = kmem_cache_alloc(inode_cache_slab, GFP_KERNEL); struct jffs2_inode_cache *ret;
D3 (printk(KERN_DEBUG "Allocated inocache at %p\n", ret)); ret = kmem_cache_alloc(inode_cache_slab, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n", ret);
return ret; return ret;
} }
void jffs2_free_inode_cache(struct jffs2_inode_cache *x) void jffs2_free_inode_cache(struct jffs2_inode_cache *x)
{ {
D3 (printk(KERN_DEBUG "Freeing inocache at %p\n", x)); JFFS2_DBG_MEMALLOC("%p\n", x);
kmem_cache_free(inode_cache_slab, x); kmem_cache_free(inode_cache_slab, x);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment