aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/erase.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-02-15 18:56:43 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-03-26 19:39:24 -0400
commit9c261b33a9c417ccaf07f41796be278d09d02d49 (patch)
tree6cf47f47364647dfbba845c0fd3f05539072175a /fs/jffs2/erase.c
parentbf011f2ed53d587fdd8148c173c4f09ed77bdf1a (diff)
jffs2: Convert most D1/D2 macros to jffs2_dbg
D1 and D2 macros are mostly uses to emit debugging messages. Convert the logging uses of D1 & D2 to jffs2_dbg(level, fmt, ...) to be a bit more consistent style with the rest of the kernel. All jffs2_dbg output is now at KERN_DEBUG where some of the previous uses were emitted at various KERN_<LEVEL>s. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'fs/jffs2/erase.c')
-rw-r--r--fs/jffs2/erase.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index eafb8d37a6fb..ee1cd98fdbf2 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -46,8 +46,9 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
46#else /* Linux */ 46#else /* Linux */
47 struct erase_info *instr; 47 struct erase_info *instr;
48 48
49 D1(printk(KERN_DEBUG "jffs2_erase_block(): erase block %#08x (range %#08x-%#08x)\n", 49 jffs2_dbg(1, "%s(): erase block %#08x (range %#08x-%#08x)\n",
50 jeb->offset, jeb->offset, jeb->offset + c->sector_size)); 50 __func__,
51 jeb->offset, jeb->offset, jeb->offset + c->sector_size);
51 instr = kmalloc(sizeof(struct erase_info) + sizeof(struct erase_priv_struct), GFP_KERNEL); 52 instr = kmalloc(sizeof(struct erase_info) + sizeof(struct erase_priv_struct), GFP_KERNEL);
52 if (!instr) { 53 if (!instr) {
53 printk(KERN_WARNING "kmalloc for struct erase_info in jffs2_erase_block failed. Refiling block for later\n"); 54 printk(KERN_WARNING "kmalloc for struct erase_info in jffs2_erase_block failed. Refiling block for later\n");
@@ -84,7 +85,8 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
84 85
85 if (ret == -ENOMEM || ret == -EAGAIN) { 86 if (ret == -ENOMEM || ret == -EAGAIN) {
86 /* Erase failed immediately. Refile it on the list */ 87 /* Erase failed immediately. Refile it on the list */
87 D1(printk(KERN_DEBUG "Erase at 0x%08x failed: %d. Refiling on erase_pending_list\n", jeb->offset, ret)); 88 jffs2_dbg(1, "Erase at 0x%08x failed: %d. Refiling on erase_pending_list\n",
89 jeb->offset, ret);
88 mutex_lock(&c->erase_free_sem); 90 mutex_lock(&c->erase_free_sem);
89 spin_lock(&c->erase_completion_lock); 91 spin_lock(&c->erase_completion_lock);
90 list_move(&jeb->list, &c->erase_pending_list); 92 list_move(&jeb->list, &c->erase_pending_list);
@@ -125,13 +127,14 @@ int jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count)
125 127
126 work_done++; 128 work_done++;
127 if (!--count) { 129 if (!--count) {
128 D1(printk(KERN_DEBUG "Count reached. jffs2_erase_pending_blocks leaving\n")); 130 jffs2_dbg(1, "Count reached. jffs2_erase_pending_blocks leaving\n");
129 goto done; 131 goto done;
130 } 132 }
131 133
132 } else if (!list_empty(&c->erase_pending_list)) { 134 } else if (!list_empty(&c->erase_pending_list)) {
133 jeb = list_entry(c->erase_pending_list.next, struct jffs2_eraseblock, list); 135 jeb = list_entry(c->erase_pending_list.next, struct jffs2_eraseblock, list);
134 D1(printk(KERN_DEBUG "Starting erase of pending block 0x%08x\n", jeb->offset)); 136 jffs2_dbg(1, "Starting erase of pending block 0x%08x\n",
137 jeb->offset);
135 list_del(&jeb->list); 138 list_del(&jeb->list);
136 c->erasing_size += c->sector_size; 139 c->erasing_size += c->sector_size;
137 c->wasted_size -= jeb->wasted_size; 140 c->wasted_size -= jeb->wasted_size;
@@ -159,13 +162,13 @@ int jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count)
159 spin_unlock(&c->erase_completion_lock); 162 spin_unlock(&c->erase_completion_lock);
160 mutex_unlock(&c->erase_free_sem); 163 mutex_unlock(&c->erase_free_sem);
161 done: 164 done:
162 D1(printk(KERN_DEBUG "jffs2_erase_pending_blocks completed\n")); 165 jffs2_dbg(1, "jffs2_erase_pending_blocks completed\n");
163 return work_done; 166 return work_done;
164} 167}
165 168
166static void jffs2_erase_succeeded(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) 169static void jffs2_erase_succeeded(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb)
167{ 170{
168 D1(printk(KERN_DEBUG "Erase completed successfully at 0x%08x\n", jeb->offset)); 171 jffs2_dbg(1, "Erase completed successfully at 0x%08x\n", jeb->offset);
169 mutex_lock(&c->erase_free_sem); 172 mutex_lock(&c->erase_free_sem);
170 spin_lock(&c->erase_completion_lock); 173 spin_lock(&c->erase_completion_lock);
171 list_move_tail(&jeb->list, &c->erase_complete_list); 174 list_move_tail(&jeb->list, &c->erase_complete_list);
@@ -269,8 +272,8 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c,
269 return; 272 return;
270 } 273 }
271 274
272 D1(printk(KERN_DEBUG "Removed nodes in range 0x%08x-0x%08x from ino #%u\n", 275 jffs2_dbg(1, "Removed nodes in range 0x%08x-0x%08x from ino #%u\n",
273 jeb->offset, jeb->offset + c->sector_size, ic->ino)); 276 jeb->offset, jeb->offset + c->sector_size, ic->ino);
274 277
275 D2({ 278 D2({
276 int i=0; 279 int i=0;
@@ -310,7 +313,8 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c,
310void jffs2_free_jeb_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) 313void jffs2_free_jeb_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb)
311{ 314{
312 struct jffs2_raw_node_ref *block, *ref; 315 struct jffs2_raw_node_ref *block, *ref;
313 D1(printk(KERN_DEBUG "Freeing all node refs for eraseblock offset 0x%08x\n", jeb->offset)); 316 jffs2_dbg(1, "Freeing all node refs for eraseblock offset 0x%08x\n",
317 jeb->offset);
314 318
315 block = ref = jeb->first_node; 319 block = ref = jeb->first_node;
316 320
@@ -342,12 +346,13 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
342 &ebuf, NULL); 346 &ebuf, NULL);
343 if (ret != -EOPNOTSUPP) { 347 if (ret != -EOPNOTSUPP) {
344 if (ret) { 348 if (ret) {
345 D1(printk(KERN_DEBUG "MTD point failed %d\n", ret)); 349 jffs2_dbg(1, "MTD point failed %d\n", ret);
346 goto do_flash_read; 350 goto do_flash_read;
347 } 351 }
348 if (retlen < c->sector_size) { 352 if (retlen < c->sector_size) {
349 /* Don't muck about if it won't let us point to the whole erase sector */ 353 /* Don't muck about if it won't let us point to the whole erase sector */
350 D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", retlen)); 354 jffs2_dbg(1, "MTD point returned len too short: 0x%zx\n",
355 retlen);
351 mtd_unpoint(c->mtd, jeb->offset, retlen); 356 mtd_unpoint(c->mtd, jeb->offset, retlen);
352 goto do_flash_read; 357 goto do_flash_read;
353 } 358 }
@@ -372,7 +377,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
372 return -EAGAIN; 377 return -EAGAIN;
373 } 378 }
374 379
375 D1(printk(KERN_DEBUG "Verifying erase at 0x%08x\n", jeb->offset)); 380 jffs2_dbg(1, "Verifying erase at 0x%08x\n", jeb->offset);
376 381
377 for (ofs = jeb->offset; ofs < jeb->offset + c->sector_size; ) { 382 for (ofs = jeb->offset; ofs < jeb->offset + c->sector_size; ) {
378 uint32_t readlen = min((uint32_t)PAGE_SIZE, jeb->offset + c->sector_size - ofs); 383 uint32_t readlen = min((uint32_t)PAGE_SIZE, jeb->offset + c->sector_size - ofs);
@@ -422,7 +427,7 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
422 } 427 }
423 428
424 /* Write the erase complete marker */ 429 /* Write the erase complete marker */
425 D1(printk(KERN_DEBUG "Writing erased marker to block at 0x%08x\n", jeb->offset)); 430 jffs2_dbg(1, "Writing erased marker to block at 0x%08x\n", jeb->offset);
426 bad_offset = jeb->offset; 431 bad_offset = jeb->offset;
427 432
428 /* Cleanmarker in oob area or no cleanmarker at all ? */ 433 /* Cleanmarker in oob area or no cleanmarker at all ? */