aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
authorArtem B. Bityutskiy <dedekind@infradead.org>2005-07-27 10:16:57 -0400
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-11-06 11:34:21 -0500
commitf538c96ba2a3fdf7744ecf9fdffac14b1ec4be32 (patch)
treef6c2bcb42d1f6869097ea6cbbde94a677cb970d3 /fs/jffs2
parent2227c0ba4bc177a014d95b380b4d888454a127a9 (diff)
[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>
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/debug.h16
-rw-r--r--fs/jffs2/malloc.c82
2 files changed, 54 insertions, 44 deletions
diff --git a/fs/jffs2/debug.h b/fs/jffs2/debug.h
index 3c3c2940f272..4d7859712013 100644
--- a/fs/jffs2/debug.h
+++ b/fs/jffs2/debug.h
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
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 $
11 * 11 *
12 */ 12 */
13#ifndef _JFFS2_DEBUG_H_ 13#ifndef _JFFS2_DEBUG_H_
@@ -16,7 +16,7 @@
16#include <linux/config.h> 16#include <linux/config.h>
17 17
18#ifndef CONFIG_JFFS2_FS_DEBUG 18#ifndef CONFIG_JFFS2_FS_DEBUG
19#define CONFIG_JFFS2_FS_DEBUG 1 19#define CONFIG_JFFS2_FS_DEBUG 0
20#endif 20#endif
21 21
22#if CONFIG_JFFS2_FS_DEBUG == 1 22#if CONFIG_JFFS2_FS_DEBUG == 1
@@ -119,20 +119,28 @@
119#define JFFS2_DBG_FRAGTREE2(fmt, ...) 119#define JFFS2_DBG_FRAGTREE2(fmt, ...)
120#endif 120#endif
121 121
122/* Plays with node_refs */ 122/* Print the messages about manipulating node_refs */
123#ifdef JFFS2_DBG_NODEREF_MESSAGES 123#ifdef JFFS2_DBG_NODEREF_MESSAGES
124#define JFFS2_DBG_NODEREF(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) 124#define JFFS2_DBG_NODEREF(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
125#else 125#else
126#define JFFS2_DBG_NODEREF(fmt, ...) 126#define JFFS2_DBG_NODEREF(fmt, ...)
127#endif 127#endif
128 128
129/* Plays with the list of inodes (JFFS2 inocache) */ 129/* Manipulations with the list of inodes (JFFS2 inocache) */
130#ifdef JFFS2_DBG_INOCACHE_MESSAGES 130#ifdef JFFS2_DBG_INOCACHE_MESSAGES
131#define JFFS2_DBG_INOCACHE(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) 131#define JFFS2_DBG_INOCACHE(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
132#else 132#else
133#define JFFS2_DBG_INOCACHE(fmt, ...) 133#define JFFS2_DBG_INOCACHE(fmt, ...)
134#endif 134#endif
135 135
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
136/* "Paranoia" checks */ 144/* "Paranoia" checks */
137void 145void
138__jffs2_dbg_fragtree_paranoia_check(struct jffs2_inode_info *f); 146__jffs2_dbg_fragtree_paranoia_check(struct jffs2_inode_info *f);
diff --git a/fs/jffs2/malloc.c b/fs/jffs2/malloc.c
index 5abb431c2a00..734801145bf8 100644
--- a/fs/jffs2/malloc.c
+++ b/fs/jffs2/malloc.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
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 $
11 * 11 *
12 */ 12 */
13 13
@@ -17,15 +17,6 @@
17#include <linux/jffs2.h> 17#include <linux/jffs2.h>
18#include "nodelist.h" 18#include "nodelist.h"
19 19
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
29/* These are initialised to NULL in the kernel startup code. 20/* These are initialised to NULL in the kernel startup code.
30 If you're porting to other operating systems, beware */ 21 If you're porting to other operating systems, beware */
31static kmem_cache_t *full_dnode_slab; 22static kmem_cache_t *full_dnode_slab;
@@ -40,43 +31,43 @@ int __init jffs2_create_slab_caches(void)
40{ 31{
41 full_dnode_slab = kmem_cache_create("jffs2_full_dnode", 32 full_dnode_slab = kmem_cache_create("jffs2_full_dnode",
42 sizeof(struct jffs2_full_dnode), 33 sizeof(struct jffs2_full_dnode),
43 0, JFFS2_SLAB_POISON, NULL, NULL); 34 0, 0, NULL, NULL);
44 if (!full_dnode_slab) 35 if (!full_dnode_slab)
45 goto err; 36 goto err;
46 37
47 raw_dirent_slab = kmem_cache_create("jffs2_raw_dirent", 38 raw_dirent_slab = kmem_cache_create("jffs2_raw_dirent",
48 sizeof(struct jffs2_raw_dirent), 39 sizeof(struct jffs2_raw_dirent),
49 0, JFFS2_SLAB_POISON, NULL, NULL); 40 0, 0, NULL, NULL);
50 if (!raw_dirent_slab) 41 if (!raw_dirent_slab)
51 goto err; 42 goto err;
52 43
53 raw_inode_slab = kmem_cache_create("jffs2_raw_inode", 44 raw_inode_slab = kmem_cache_create("jffs2_raw_inode",
54 sizeof(struct jffs2_raw_inode), 45 sizeof(struct jffs2_raw_inode),
55 0, JFFS2_SLAB_POISON, NULL, NULL); 46 0, 0, NULL, NULL);
56 if (!raw_inode_slab) 47 if (!raw_inode_slab)
57 goto err; 48 goto err;
58 49
59 tmp_dnode_info_slab = kmem_cache_create("jffs2_tmp_dnode", 50 tmp_dnode_info_slab = kmem_cache_create("jffs2_tmp_dnode",
60 sizeof(struct jffs2_tmp_dnode_info), 51 sizeof(struct jffs2_tmp_dnode_info),
61 0, JFFS2_SLAB_POISON, NULL, NULL); 52 0, 0, NULL, NULL);
62 if (!tmp_dnode_info_slab) 53 if (!tmp_dnode_info_slab)
63 goto err; 54 goto err;
64 55
65 raw_node_ref_slab = kmem_cache_create("jffs2_raw_node_ref", 56 raw_node_ref_slab = kmem_cache_create("jffs2_raw_node_ref",
66 sizeof(struct jffs2_raw_node_ref), 57 sizeof(struct jffs2_raw_node_ref),
67 0, JFFS2_SLAB_POISON, NULL, NULL); 58 0, 0, NULL, NULL);
68 if (!raw_node_ref_slab) 59 if (!raw_node_ref_slab)
69 goto err; 60 goto err;
70 61
71 node_frag_slab = kmem_cache_create("jffs2_node_frag", 62 node_frag_slab = kmem_cache_create("jffs2_node_frag",
72 sizeof(struct jffs2_node_frag), 63 sizeof(struct jffs2_node_frag),
73 0, JFFS2_SLAB_POISON, NULL, NULL); 64 0, 0, NULL, NULL);
74 if (!node_frag_slab) 65 if (!node_frag_slab)
75 goto err; 66 goto err;
76 67
77 inode_cache_slab = kmem_cache_create("jffs2_inode_cache", 68 inode_cache_slab = kmem_cache_create("jffs2_inode_cache",
78 sizeof(struct jffs2_inode_cache), 69 sizeof(struct jffs2_inode_cache),
79 0, JFFS2_SLAB_POISON, NULL, NULL); 70 0, 0, NULL, NULL);
80 if (inode_cache_slab) 71 if (inode_cache_slab)
81 return 0; 72 return 0;
82 err: 73 err:
@@ -104,102 +95,113 @@ void jffs2_destroy_slab_caches(void)
104 95
105struct jffs2_full_dirent *jffs2_alloc_full_dirent(int namesize) 96struct jffs2_full_dirent *jffs2_alloc_full_dirent(int namesize)
106{ 97{
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;
108} 102}
109 103
110void jffs2_free_full_dirent(struct jffs2_full_dirent *x) 104void jffs2_free_full_dirent(struct jffs2_full_dirent *x)
111{ 105{
106 JFFS2_DBG_MEMALLOC("%p\n", x);
112 kfree(x); 107 kfree(x);
113} 108}
114 109
115struct jffs2_full_dnode *jffs2_alloc_full_dnode(void) 110struct jffs2_full_dnode *jffs2_alloc_full_dnode(void)
116{ 111{
117 struct jffs2_full_dnode *ret = kmem_cache_alloc(full_dnode_slab, GFP_KERNEL); 112 struct jffs2_full_dnode *ret;
118 D3 (printk (KERN_DEBUG "alloc_full_dnode at %p\n", ret)); 113 ret = kmem_cache_alloc(full_dnode_slab, GFP_KERNEL);
114 JFFS2_DBG_MEMALLOC("%p\n", ret);
119 return ret; 115 return ret;
120} 116}
121 117
122void jffs2_free_full_dnode(struct jffs2_full_dnode *x) 118void jffs2_free_full_dnode(struct jffs2_full_dnode *x)
123{ 119{
124 D3 (printk (KERN_DEBUG "free full_dnode at %p\n", x)); 120 JFFS2_DBG_MEMALLOC("%p\n", x);
125 kmem_cache_free(full_dnode_slab, x); 121 kmem_cache_free(full_dnode_slab, x);
126} 122}
127 123
128struct jffs2_raw_dirent *jffs2_alloc_raw_dirent(void) 124struct jffs2_raw_dirent *jffs2_alloc_raw_dirent(void)
129{ 125{
130 struct jffs2_raw_dirent *ret = kmem_cache_alloc(raw_dirent_slab, GFP_KERNEL); 126 struct jffs2_raw_dirent *ret;
131 D3 (printk (KERN_DEBUG "alloc_raw_dirent\n", ret)); 127 ret = kmem_cache_alloc(raw_dirent_slab, GFP_KERNEL);
128 JFFS2_DBG_MEMALLOC("%p\n", ret);
132 return ret; 129 return ret;
133} 130}
134 131
135void jffs2_free_raw_dirent(struct jffs2_raw_dirent *x) 132void jffs2_free_raw_dirent(struct jffs2_raw_dirent *x)
136{ 133{
137 D3 (printk (KERN_DEBUG "free_raw_dirent at %p\n", x)); 134 JFFS2_DBG_MEMALLOC("%p\n", x);
138 kmem_cache_free(raw_dirent_slab, x); 135 kmem_cache_free(raw_dirent_slab, x);
139} 136}
140 137
141struct jffs2_raw_inode *jffs2_alloc_raw_inode(void) 138struct jffs2_raw_inode *jffs2_alloc_raw_inode(void)
142{ 139{
143 struct jffs2_raw_inode *ret = kmem_cache_alloc(raw_inode_slab, GFP_KERNEL); 140 struct jffs2_raw_inode *ret;
144 D3 (printk (KERN_DEBUG "alloc_raw_inode at %p\n", ret)); 141 ret = kmem_cache_alloc(raw_inode_slab, GFP_KERNEL);
142 JFFS2_DBG_MEMALLOC("%p\n", ret);
145 return ret; 143 return ret;
146} 144}
147 145
148void jffs2_free_raw_inode(struct jffs2_raw_inode *x) 146void jffs2_free_raw_inode(struct jffs2_raw_inode *x)
149{ 147{
150 D3 (printk (KERN_DEBUG "free_raw_inode at %p\n", x)); 148 JFFS2_DBG_MEMALLOC("%p\n", x);
151 kmem_cache_free(raw_inode_slab, x); 149 kmem_cache_free(raw_inode_slab, x);
152} 150}
153 151
154struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void) 152struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void)
155{ 153{
156 struct jffs2_tmp_dnode_info *ret = kmem_cache_alloc(tmp_dnode_info_slab, GFP_KERNEL); 154 struct jffs2_tmp_dnode_info *ret;
157 D3 (printk (KERN_DEBUG "alloc_tmp_dnode_info at %p\n", ret)); 155 ret = kmem_cache_alloc(tmp_dnode_info_slab, GFP_KERNEL);
156 JFFS2_DBG_MEMALLOC("%p\n",
157 ret);
158 return ret; 158 return ret;
159} 159}
160 160
161void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *x) 161void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *x)
162{ 162{
163 D3 (printk (KERN_DEBUG "free_tmp_dnode_info at %p\n", x)); 163 JFFS2_DBG_MEMALLOC("%p\n", x);
164 kmem_cache_free(tmp_dnode_info_slab, x); 164 kmem_cache_free(tmp_dnode_info_slab, x);
165} 165}
166 166
167struct jffs2_raw_node_ref *jffs2_alloc_raw_node_ref(void) 167struct jffs2_raw_node_ref *jffs2_alloc_raw_node_ref(void)
168{ 168{
169 struct jffs2_raw_node_ref *ret = kmem_cache_alloc(raw_node_ref_slab, GFP_KERNEL); 169 struct jffs2_raw_node_ref *ret;
170 D3 (printk (KERN_DEBUG "alloc_raw_node_ref at %p\n", ret)); 170 ret = kmem_cache_alloc(raw_node_ref_slab, GFP_KERNEL);
171 JFFS2_DBG_MEMALLOC("%p\n", ret);
171 return ret; 172 return ret;
172} 173}
173 174
174void jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *x) 175void jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *x)
175{ 176{
176 D3 (printk (KERN_DEBUG "free_raw_node_ref at %p\n", x)); 177 JFFS2_DBG_MEMALLOC("%p\n", x);
177 kmem_cache_free(raw_node_ref_slab, x); 178 kmem_cache_free(raw_node_ref_slab, x);
178} 179}
179 180
180struct jffs2_node_frag *jffs2_alloc_node_frag(void) 181struct jffs2_node_frag *jffs2_alloc_node_frag(void)
181{ 182{
182 struct jffs2_node_frag *ret = kmem_cache_alloc(node_frag_slab, GFP_KERNEL); 183 struct jffs2_node_frag *ret;
183 D3 (printk (KERN_DEBUG "alloc_node_frag at %p\n", ret)); 184 ret = kmem_cache_alloc(node_frag_slab, GFP_KERNEL);
185 JFFS2_DBG_MEMALLOC("%p\n", ret);
184 return ret; 186 return ret;
185} 187}
186 188
187void jffs2_free_node_frag(struct jffs2_node_frag *x) 189void jffs2_free_node_frag(struct jffs2_node_frag *x)
188{ 190{
189 D3 (printk (KERN_DEBUG "free_node_frag at %p\n", x)); 191 JFFS2_DBG_MEMALLOC("%p\n", x);
190 kmem_cache_free(node_frag_slab, x); 192 kmem_cache_free(node_frag_slab, x);
191} 193}
192 194
193struct jffs2_inode_cache *jffs2_alloc_inode_cache(void) 195struct jffs2_inode_cache *jffs2_alloc_inode_cache(void)
194{ 196{
195 struct jffs2_inode_cache *ret = kmem_cache_alloc(inode_cache_slab, GFP_KERNEL); 197 struct jffs2_inode_cache *ret;
196 D3 (printk(KERN_DEBUG "Allocated inocache at %p\n", ret)); 198 ret = kmem_cache_alloc(inode_cache_slab, GFP_KERNEL);
199 JFFS2_DBG_MEMALLOC("%p\n", ret);
197 return ret; 200 return ret;
198} 201}
199 202
200void jffs2_free_inode_cache(struct jffs2_inode_cache *x) 203void jffs2_free_inode_cache(struct jffs2_inode_cache *x)
201{ 204{
202 D3 (printk(KERN_DEBUG "Freeing inocache at %p\n", x)); 205 JFFS2_DBG_MEMALLOC("%p\n", x);
203 kmem_cache_free(inode_cache_slab, x); 206 kmem_cache_free(inode_cache_slab, x);
204} 207}
205