Skip to content

Commit f538c96

Browse files
dedekindThomas Gleixner
authored andcommitted
[JFFS2] Debug code clean up - step 4
Small comment cleanups. Remove a unused macro Signed-off-by: Artem B. Bityutskiy <dedekind@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 2227c0b commit f538c96

2 files changed

Lines changed: 54 additions & 44 deletions

File tree

‎fs/jffs2/debug.h‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* For licensing information, see the file 'LICENCE' in this directory.
99
*
10-
* $Id: debug.h,v 1.6 2005/07/24 15:18:26 dedekind Exp $
10+
* $Id: debug.h,v 1.7 2005/07/27 13:06:56 dedekind Exp $
1111
*
1212
*/
1313
#ifndef _JFFS2_DEBUG_H_
@@ -16,7 +16,7 @@
1616
#include <linux/config.h>
1717

1818
#ifndef CONFIG_JFFS2_FS_DEBUG
19-
#define CONFIG_JFFS2_FS_DEBUG 1
19+
#define CONFIG_JFFS2_FS_DEBUG 0
2020
#endif
2121

2222
#if CONFIG_JFFS2_FS_DEBUG == 1
@@ -119,20 +119,28 @@
119119
#define JFFS2_DBG_FRAGTREE2(fmt, ...)
120120
#endif
121121

122-
/* Plays with node_refs */
122+
/* Print the messages about manipulating node_refs */
123123
#ifdef JFFS2_DBG_NODEREF_MESSAGES
124124
#define JFFS2_DBG_NODEREF(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
125125
#else
126126
#define JFFS2_DBG_NODEREF(fmt, ...)
127127
#endif
128128

129-
/* Plays with the list of inodes (JFFS2 inocache) */
129+
/* Manipulations with the list of inodes (JFFS2 inocache) */
130130
#ifdef JFFS2_DBG_INOCACHE_MESSAGES
131131
#define JFFS2_DBG_INOCACHE(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
132132
#else
133133
#define JFFS2_DBG_INOCACHE(fmt, ...)
134134
#endif
135135

136+
/* Watch the object allocations */
137+
#ifdef JFFS2_DBG_MEMALLOC_MESSAGES
138+
#define JFFS2_DBG_MEMALLOC(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
139+
#else
140+
#define JFFS2_DBG_MEMALLOC(fmt, ...)
141+
#endif
142+
143+
136144
/* "Paranoia" checks */
137145
void
138146
__jffs2_dbg_fragtree_paranoia_check(struct jffs2_inode_info *f);

‎fs/jffs2/malloc.c‎

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* For licensing information, see the file 'LICENCE' in this directory.
99
*
10-
* $Id: malloc.c,v 1.28 2004/11/16 20:36:11 dwmw2 Exp $
10+
* $Id: malloc.c,v 1.29 2005/07/27 14:16:53 dedekind Exp $
1111
*
1212
*/
1313

@@ -17,15 +17,6 @@
1717
#include <linux/jffs2.h>
1818
#include "nodelist.h"
1919

20-
#if 0
21-
#define JFFS2_SLAB_POISON SLAB_POISON
22-
#else
23-
#define JFFS2_SLAB_POISON 0
24-
#endif
25-
26-
// replace this by #define D3 (x) x for cache debugging
27-
#define D3(x)
28-
2920
/* These are initialised to NULL in the kernel startup code.
3021
If you're porting to other operating systems, beware */
3122
static kmem_cache_t *full_dnode_slab;
@@ -40,43 +31,43 @@ int __init jffs2_create_slab_caches(void)
4031
{
4132
full_dnode_slab = kmem_cache_create("jffs2_full_dnode",
4233
sizeof(struct jffs2_full_dnode),
43-
0, JFFS2_SLAB_POISON, NULL, NULL);
34+
0, 0, NULL, NULL);
4435
if (!full_dnode_slab)
4536
goto err;
4637

4738
raw_dirent_slab = kmem_cache_create("jffs2_raw_dirent",
4839
sizeof(struct jffs2_raw_dirent),
49-
0, JFFS2_SLAB_POISON, NULL, NULL);
40+
0, 0, NULL, NULL);
5041
if (!raw_dirent_slab)
5142
goto err;
5243

5344
raw_inode_slab = kmem_cache_create("jffs2_raw_inode",
5445
sizeof(struct jffs2_raw_inode),
55-
0, JFFS2_SLAB_POISON, NULL, NULL);
46+
0, 0, NULL, NULL);
5647
if (!raw_inode_slab)
5748
goto err;
5849

5950
tmp_dnode_info_slab = kmem_cache_create("jffs2_tmp_dnode",
6051
sizeof(struct jffs2_tmp_dnode_info),
61-
0, JFFS2_SLAB_POISON, NULL, NULL);
52+
0, 0, NULL, NULL);
6253
if (!tmp_dnode_info_slab)
6354
goto err;
6455

6556
raw_node_ref_slab = kmem_cache_create("jffs2_raw_node_ref",
6657
sizeof(struct jffs2_raw_node_ref),
67-
0, JFFS2_SLAB_POISON, NULL, NULL);
58+
0, 0, NULL, NULL);
6859
if (!raw_node_ref_slab)
6960
goto err;
7061

7162
node_frag_slab = kmem_cache_create("jffs2_node_frag",
7263
sizeof(struct jffs2_node_frag),
73-
0, JFFS2_SLAB_POISON, NULL, NULL);
64+
0, 0, NULL, NULL);
7465
if (!node_frag_slab)
7566
goto err;
7667

7768
inode_cache_slab = kmem_cache_create("jffs2_inode_cache",
7869
sizeof(struct jffs2_inode_cache),
79-
0, JFFS2_SLAB_POISON, NULL, NULL);
70+
0, 0, NULL, NULL);
8071
if (inode_cache_slab)
8172
return 0;
8273
err:
@@ -104,102 +95,113 @@ void jffs2_destroy_slab_caches(void)
10495

10596
struct jffs2_full_dirent *jffs2_alloc_full_dirent(int namesize)
10697
{
107-
return kmalloc(sizeof(struct jffs2_full_dirent) + namesize, GFP_KERNEL);
98+
struct jffs2_full_dirent *ret;
99+
ret = kmalloc(sizeof(struct jffs2_full_dirent) + namesize, GFP_KERNEL);
100+
JFFS2_DBG_MEMALLOC("%p\n", ret);
101+
return ret;
108102
}
109103

110104
void jffs2_free_full_dirent(struct jffs2_full_dirent *x)
111105
{
106+
JFFS2_DBG_MEMALLOC("%p\n", x);
112107
kfree(x);
113108
}
114109

115110
struct jffs2_full_dnode *jffs2_alloc_full_dnode(void)
116111
{
117-
struct jffs2_full_dnode *ret = kmem_cache_alloc(full_dnode_slab, GFP_KERNEL);
118-
D3 (printk (KERN_DEBUG "alloc_full_dnode at %p\n", ret));
112+
struct jffs2_full_dnode *ret;
113+
ret = kmem_cache_alloc(full_dnode_slab, GFP_KERNEL);
114+
JFFS2_DBG_MEMALLOC("%p\n", ret);
119115
return ret;
120116
}
121117

122118
void jffs2_free_full_dnode(struct jffs2_full_dnode *x)
123119
{
124-
D3 (printk (KERN_DEBUG "free full_dnode at %p\n", x));
120+
JFFS2_DBG_MEMALLOC("%p\n", x);
125121
kmem_cache_free(full_dnode_slab, x);
126122
}
127123

128124
struct jffs2_raw_dirent *jffs2_alloc_raw_dirent(void)
129125
{
130-
struct jffs2_raw_dirent *ret = kmem_cache_alloc(raw_dirent_slab, GFP_KERNEL);
131-
D3 (printk (KERN_DEBUG "alloc_raw_dirent\n", ret));
126+
struct jffs2_raw_dirent *ret;
127+
ret = kmem_cache_alloc(raw_dirent_slab, GFP_KERNEL);
128+
JFFS2_DBG_MEMALLOC("%p\n", ret);
132129
return ret;
133130
}
134131

135132
void jffs2_free_raw_dirent(struct jffs2_raw_dirent *x)
136133
{
137-
D3 (printk (KERN_DEBUG "free_raw_dirent at %p\n", x));
134+
JFFS2_DBG_MEMALLOC("%p\n", x);
138135
kmem_cache_free(raw_dirent_slab, x);
139136
}
140137

141138
struct jffs2_raw_inode *jffs2_alloc_raw_inode(void)
142139
{
143-
struct jffs2_raw_inode *ret = kmem_cache_alloc(raw_inode_slab, GFP_KERNEL);
144-
D3 (printk (KERN_DEBUG "alloc_raw_inode at %p\n", ret));
140+
struct jffs2_raw_inode *ret;
141+
ret = kmem_cache_alloc(raw_inode_slab, GFP_KERNEL);
142+
JFFS2_DBG_MEMALLOC("%p\n", ret);
145143
return ret;
146144
}
147145

148146
void jffs2_free_raw_inode(struct jffs2_raw_inode *x)
149147
{
150-
D3 (printk (KERN_DEBUG "free_raw_inode at %p\n", x));
148+
JFFS2_DBG_MEMALLOC("%p\n", x);
151149
kmem_cache_free(raw_inode_slab, x);
152150
}
153151

154152
struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void)
155153
{
156-
struct jffs2_tmp_dnode_info *ret = kmem_cache_alloc(tmp_dnode_info_slab, GFP_KERNEL);
157-
D3 (printk (KERN_DEBUG "alloc_tmp_dnode_info at %p\n", ret));
154+
struct jffs2_tmp_dnode_info *ret;
155+
ret = kmem_cache_alloc(tmp_dnode_info_slab, GFP_KERNEL);
156+
JFFS2_DBG_MEMALLOC("%p\n",
157+
ret);
158158
return ret;
159159
}
160160

161161
void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *x)
162162
{
163-
D3 (printk (KERN_DEBUG "free_tmp_dnode_info at %p\n", x));
163+
JFFS2_DBG_MEMALLOC("%p\n", x);
164164
kmem_cache_free(tmp_dnode_info_slab, x);
165165
}
166166

167167
struct jffs2_raw_node_ref *jffs2_alloc_raw_node_ref(void)
168168
{
169-
struct jffs2_raw_node_ref *ret = kmem_cache_alloc(raw_node_ref_slab, GFP_KERNEL);
170-
D3 (printk (KERN_DEBUG "alloc_raw_node_ref at %p\n", ret));
169+
struct jffs2_raw_node_ref *ret;
170+
ret = kmem_cache_alloc(raw_node_ref_slab, GFP_KERNEL);
171+
JFFS2_DBG_MEMALLOC("%p\n", ret);
171172
return ret;
172173
}
173174

174175
void jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *x)
175176
{
176-
D3 (printk (KERN_DEBUG "free_raw_node_ref at %p\n", x));
177+
JFFS2_DBG_MEMALLOC("%p\n", x);
177178
kmem_cache_free(raw_node_ref_slab, x);
178179
}
179180

180181
struct jffs2_node_frag *jffs2_alloc_node_frag(void)
181182
{
182-
struct jffs2_node_frag *ret = kmem_cache_alloc(node_frag_slab, GFP_KERNEL);
183-
D3 (printk (KERN_DEBUG "alloc_node_frag at %p\n", ret));
183+
struct jffs2_node_frag *ret;
184+
ret = kmem_cache_alloc(node_frag_slab, GFP_KERNEL);
185+
JFFS2_DBG_MEMALLOC("%p\n", ret);
184186
return ret;
185187
}
186188

187189
void jffs2_free_node_frag(struct jffs2_node_frag *x)
188190
{
189-
D3 (printk (KERN_DEBUG "free_node_frag at %p\n", x));
191+
JFFS2_DBG_MEMALLOC("%p\n", x);
190192
kmem_cache_free(node_frag_slab, x);
191193
}
192194

193195
struct jffs2_inode_cache *jffs2_alloc_inode_cache(void)
194196
{
195-
struct jffs2_inode_cache *ret = kmem_cache_alloc(inode_cache_slab, GFP_KERNEL);
196-
D3 (printk(KERN_DEBUG "Allocated inocache at %p\n", ret));
197+
struct jffs2_inode_cache *ret;
198+
ret = kmem_cache_alloc(inode_cache_slab, GFP_KERNEL);
199+
JFFS2_DBG_MEMALLOC("%p\n", ret);
197200
return ret;
198201
}
199202

200203
void jffs2_free_inode_cache(struct jffs2_inode_cache *x)
201204
{
202-
D3 (printk(KERN_DEBUG "Freeing inocache at %p\n", x));
205+
JFFS2_DBG_MEMALLOC("%p\n", x);
203206
kmem_cache_free(inode_cache_slab, x);
204207
}
205-

0 commit comments

Comments
 (0)