aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-02-15 18:56:44 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-03-26 19:39:40 -0400
commitda320f055a8818269c008e30b887cdcf09d8e4bd (patch)
treedeaead9c0bd0ed473e633fca2d66460b3b0ec99d
parent9c261b33a9c417ccaf07f41796be278d09d02d49 (diff)
jffs2: Convert printks to pr_<level>
Use the more current logging style. Coalesce formats, align arguments. Convert uses of embedded function names to %s, __func__. A couple of long line checkpatch errors I don't care about exist. 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>
-rw-r--r--fs/jffs2/background.c5
-rw-r--r--fs/jffs2/compr.c17
-rw-r--r--fs/jffs2/compr_zlib.c6
-rw-r--r--fs/jffs2/debug.c20
-rw-r--r--fs/jffs2/dir.c7
-rw-r--r--fs/jffs2/erase.c36
-rw-r--r--fs/jffs2/fs.c22
-rw-r--r--fs/jffs2/gc.c158
-rw-r--r--fs/jffs2/nodelist.c28
-rw-r--r--fs/jffs2/nodemgmt.c51
-rw-r--r--fs/jffs2/read.c21
-rw-r--r--fs/jffs2/scan.c84
-rw-r--r--fs/jffs2/summary.c11
-rw-r--r--fs/jffs2/super.c18
-rw-r--r--fs/jffs2/symlink.c2
-rw-r--r--fs/jffs2/wbuf.c83
-rw-r--r--fs/jffs2/write.c37
17 files changed, 342 insertions, 264 deletions
diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c
index 26ce06cd4d0f..63dafc6196e5 100644
--- a/fs/jffs2/background.c
+++ b/fs/jffs2/background.c
@@ -42,7 +42,8 @@ int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c)
42 42
43 tsk = kthread_run(jffs2_garbage_collect_thread, c, "jffs2_gcd_mtd%d", c->mtd->index); 43 tsk = kthread_run(jffs2_garbage_collect_thread, c, "jffs2_gcd_mtd%d", c->mtd->index);
44 if (IS_ERR(tsk)) { 44 if (IS_ERR(tsk)) {
45 printk(KERN_WARNING "fork failed for JFFS2 garbage collect thread: %ld\n", -PTR_ERR(tsk)); 45 pr_warn("fork failed for JFFS2 garbage collect thread: %ld\n",
46 -PTR_ERR(tsk));
46 complete(&c->gc_thread_exit); 47 complete(&c->gc_thread_exit);
47 ret = PTR_ERR(tsk); 48 ret = PTR_ERR(tsk);
48 } else { 49 } else {
@@ -152,7 +153,7 @@ static int jffs2_garbage_collect_thread(void *_c)
152 153
153 jffs2_dbg(1, "%s(): pass\n", __func__); 154 jffs2_dbg(1, "%s(): pass\n", __func__);
154 if (jffs2_garbage_collect_pass(c) == -ENOSPC) { 155 if (jffs2_garbage_collect_pass(c) == -ENOSPC) {
155 printk(KERN_NOTICE "No space for garbage collection. Aborting GC thread\n"); 156 pr_notice("No space for garbage collection. Aborting GC thread\n");
156 goto die; 157 goto die;
157 } 158 }
158 } 159 }
diff --git a/fs/jffs2/compr.c b/fs/jffs2/compr.c
index be8e493d76bd..ee9bf23ee8ef 100644
--- a/fs/jffs2/compr.c
+++ b/fs/jffs2/compr.c
@@ -79,7 +79,7 @@ static int jffs2_selected_compress(u8 compr, unsigned char *data_in,
79 79
80 output_buf = kmalloc(*cdatalen, GFP_KERNEL); 80 output_buf = kmalloc(*cdatalen, GFP_KERNEL);
81 if (!output_buf) { 81 if (!output_buf) {
82 printk(KERN_WARNING "JFFS2: No memory for compressor allocation. Compression failed.\n"); 82 pr_warn("JFFS2: No memory for compressor allocation. Compression failed.\n");
83 return ret; 83 return ret;
84 } 84 }
85 orig_slen = *datalen; 85 orig_slen = *datalen;
@@ -188,7 +188,8 @@ uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
188 tmp_buf = kmalloc(orig_slen, GFP_KERNEL); 188 tmp_buf = kmalloc(orig_slen, GFP_KERNEL);
189 spin_lock(&jffs2_compressor_list_lock); 189 spin_lock(&jffs2_compressor_list_lock);
190 if (!tmp_buf) { 190 if (!tmp_buf) {
191 printk(KERN_WARNING "JFFS2: No memory for compressor allocation. (%d bytes)\n", orig_slen); 191 pr_warn("JFFS2: No memory for compressor allocation. (%d bytes)\n",
192 orig_slen);
192 continue; 193 continue;
193 } 194 }
194 else { 195 else {
@@ -235,7 +236,7 @@ uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
235 cpage_out, datalen, cdatalen); 236 cpage_out, datalen, cdatalen);
236 break; 237 break;
237 default: 238 default:
238 printk(KERN_ERR "JFFS2: unknown compression mode.\n"); 239 pr_err("JFFS2: unknown compression mode\n");
239 } 240 }
240 241
241 if (ret == JFFS2_COMPR_NONE) { 242 if (ret == JFFS2_COMPR_NONE) {
@@ -277,7 +278,8 @@ int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
277 ret = this->decompress(cdata_in, data_out, cdatalen, datalen); 278 ret = this->decompress(cdata_in, data_out, cdatalen, datalen);
278 spin_lock(&jffs2_compressor_list_lock); 279 spin_lock(&jffs2_compressor_list_lock);
279 if (ret) { 280 if (ret) {
280 printk(KERN_WARNING "Decompressor \"%s\" returned %d\n", this->name, ret); 281 pr_warn("Decompressor \"%s\" returned %d\n",
282 this->name, ret);
281 } 283 }
282 else { 284 else {
283 this->stat_decompr_blocks++; 285 this->stat_decompr_blocks++;
@@ -287,7 +289,8 @@ int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
287 return ret; 289 return ret;
288 } 290 }
289 } 291 }
290 printk(KERN_WARNING "JFFS2 compression type 0x%02x not available.\n", comprtype); 292 pr_warn("JFFS2 compression type 0x%02x not available\n",
293 comprtype);
291 spin_unlock(&jffs2_compressor_list_lock); 294 spin_unlock(&jffs2_compressor_list_lock);
292 return -EIO; 295 return -EIO;
293 } 296 }
@@ -299,7 +302,7 @@ int jffs2_register_compressor(struct jffs2_compressor *comp)
299 struct jffs2_compressor *this; 302 struct jffs2_compressor *this;
300 303
301 if (!comp->name) { 304 if (!comp->name) {
302 printk(KERN_WARNING "NULL compressor name at registering JFFS2 compressor. Failed.\n"); 305 pr_warn("NULL compressor name at registering JFFS2 compressor. Failed.\n");
303 return -1; 306 return -1;
304 } 307 }
305 comp->compr_buf_size=0; 308 comp->compr_buf_size=0;
@@ -340,7 +343,7 @@ int jffs2_unregister_compressor(struct jffs2_compressor *comp)
340 343
341 if (comp->usecount) { 344 if (comp->usecount) {
342 spin_unlock(&jffs2_compressor_list_lock); 345 spin_unlock(&jffs2_compressor_list_lock);
343 printk(KERN_WARNING "JFFS2: Compressor module is in use. Unregister failed.\n"); 346 pr_warn("JFFS2: Compressor module is in use. Unregister failed.\n");
344 return -1; 347 return -1;
345 } 348 }
346 list_del(&comp->list); 349 list_del(&comp->list);
diff --git a/fs/jffs2/compr_zlib.c b/fs/jffs2/compr_zlib.c
index 40979c928751..88529e4924c6 100644
--- a/fs/jffs2/compr_zlib.c
+++ b/fs/jffs2/compr_zlib.c
@@ -79,7 +79,7 @@ static int jffs2_zlib_compress(unsigned char *data_in,
79 mutex_lock(&deflate_mutex); 79 mutex_lock(&deflate_mutex);
80 80
81 if (Z_OK != zlib_deflateInit(&def_strm, 3)) { 81 if (Z_OK != zlib_deflateInit(&def_strm, 3)) {
82 printk(KERN_WARNING "deflateInit failed\n"); 82 pr_warn("deflateInit failed\n");
83 mutex_unlock(&deflate_mutex); 83 mutex_unlock(&deflate_mutex);
84 return -1; 84 return -1;
85 } 85 }
@@ -169,7 +169,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in,
169 169
170 170
171 if (Z_OK != zlib_inflateInit2(&inf_strm, wbits)) { 171 if (Z_OK != zlib_inflateInit2(&inf_strm, wbits)) {
172 printk(KERN_WARNING "inflateInit failed\n"); 172 pr_warn("inflateInit failed\n");
173 mutex_unlock(&inflate_mutex); 173 mutex_unlock(&inflate_mutex);
174 return 1; 174 return 1;
175 } 175 }
@@ -177,7 +177,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in,
177 while((ret = zlib_inflate(&inf_strm, Z_FINISH)) == Z_OK) 177 while((ret = zlib_inflate(&inf_strm, Z_FINISH)) == Z_OK)
178 ; 178 ;
179 if (ret != Z_STREAM_END) { 179 if (ret != Z_STREAM_END) {
180 printk(KERN_NOTICE "inflate returned %d\n", ret); 180 pr_notice("inflate returned %d\n", ret);
181 } 181 }
182 zlib_inflateEnd(&inf_strm); 182 zlib_inflateEnd(&inf_strm);
183 mutex_unlock(&inflate_mutex); 183 mutex_unlock(&inflate_mutex);
diff --git a/fs/jffs2/debug.c b/fs/jffs2/debug.c
index e0b76c87a91a..6cac7d6aad69 100644
--- a/fs/jffs2/debug.c
+++ b/fs/jffs2/debug.c
@@ -261,12 +261,15 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
261 bad += c->sector_size; 261 bad += c->sector_size;
262 } 262 }
263 263
264#define check(sz) \ 264#define check(sz) \
265 if (sz != c->sz##_size) { \ 265do { \
266 printk(KERN_WARNING #sz "_size mismatch counted 0x%x, c->" #sz "_size 0x%x\n", \ 266 if (sz != c->sz##_size) { \
267 sz, c->sz##_size); \ 267 pr_warn("%s_size mismatch counted 0x%x, c->%s_size 0x%x\n", \
268 dump = 1; \ 268 #sz, #sz, sz, c->sz##_size); \
269 } 269 dump = 1; \
270 } \
271} while (0)
272
270 check(free); 273 check(free);
271 check(dirty); 274 check(dirty);
272 check(used); 275 check(used);
@@ -274,11 +277,12 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
274 check(unchecked); 277 check(unchecked);
275 check(bad); 278 check(bad);
276 check(erasing); 279 check(erasing);
280
277#undef check 281#undef check
278 282
279 if (nr_counted != c->nr_blocks) { 283 if (nr_counted != c->nr_blocks) {
280 printk(KERN_WARNING "%s counted only 0x%x blocks of 0x%x. Where are the others?\n", 284 pr_warn("%s counted only 0x%x blocks of 0x%x. Where are the others?\n",
281 __func__, nr_counted, c->nr_blocks); 285 __func__, nr_counted, c->nr_blocks);
282 dump = 1; 286 dump = 1;
283 } 287 }
284 288
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index 01a07af0021d..a7a3c1ac9121 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -103,7 +103,7 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target,
103 if (ino) { 103 if (ino) {
104 inode = jffs2_iget(dir_i->i_sb, ino); 104 inode = jffs2_iget(dir_i->i_sb, ino);
105 if (IS_ERR(inode)) 105 if (IS_ERR(inode))
106 printk(KERN_WARNING "iget() failed for ino #%u\n", ino); 106 pr_warn("iget() failed for ino #%u\n", ino);
107 } 107 }
108 108
109 return d_splice_alias(inode, target); 109 return d_splice_alias(inode, target);
@@ -365,7 +365,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
365 /* We use f->target field to store the target path. */ 365 /* We use f->target field to store the target path. */
366 f->target = kmemdup(target, targetlen + 1, GFP_KERNEL); 366 f->target = kmemdup(target, targetlen + 1, GFP_KERNEL);
367 if (!f->target) { 367 if (!f->target) {
368 printk(KERN_WARNING "Can't allocate %d bytes of memory\n", targetlen + 1); 368 pr_warn("Can't allocate %d bytes of memory\n", targetlen + 1);
369 mutex_unlock(&f->sem); 369 mutex_unlock(&f->sem);
370 jffs2_complete_reservation(c); 370 jffs2_complete_reservation(c);
371 ret = -ENOMEM; 371 ret = -ENOMEM;
@@ -860,7 +860,8 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
860 f->inocache->pino_nlink++; 860 f->inocache->pino_nlink++;
861 mutex_unlock(&f->sem); 861 mutex_unlock(&f->sem);
862 862
863 printk(KERN_NOTICE "jffs2_rename(): Link succeeded, unlink failed (err %d). You now have a hard link\n", ret); 863 pr_notice("%s(): Link succeeded, unlink failed (err %d). You now have a hard link\n",
864 __func__, ret);
864 /* Might as well let the VFS know */ 865 /* Might as well let the VFS know */
865 d_instantiate(new_dentry, old_dentry->d_inode); 866 d_instantiate(new_dentry, old_dentry->d_inode);
866 ihold(old_dentry->d_inode); 867 ihold(old_dentry->d_inode);
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index ee1cd98fdbf2..5f14309a1faf 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -51,7 +51,7 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
51 jeb->offset, jeb->offset, jeb->offset + c->sector_size); 51 jeb->offset, jeb->offset, jeb->offset + c->sector_size);
52 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);
53 if (!instr) { 53 if (!instr) {
54 printk(KERN_WARNING "kmalloc for struct erase_info in jffs2_erase_block failed. Refiling block for later\n"); 54 pr_warn("kmalloc for struct erase_info in jffs2_erase_block failed. Refiling block for later\n");
55 mutex_lock(&c->erase_free_sem); 55 mutex_lock(&c->erase_free_sem);
56 spin_lock(&c->erase_completion_lock); 56 spin_lock(&c->erase_completion_lock);
57 list_move(&jeb->list, &c->erase_pending_list); 57 list_move(&jeb->list, &c->erase_pending_list);
@@ -99,9 +99,11 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
99 } 99 }
100 100
101 if (ret == -EROFS) 101 if (ret == -EROFS)
102 printk(KERN_WARNING "Erase at 0x%08x failed immediately: -EROFS. Is the sector locked?\n", jeb->offset); 102 pr_warn("Erase at 0x%08x failed immediately: -EROFS. Is the sector locked?\n",
103 jeb->offset);
103 else 104 else
104 printk(KERN_WARNING "Erase at 0x%08x failed immediately: errno %d\n", jeb->offset, ret); 105 pr_warn("Erase at 0x%08x failed immediately: errno %d\n",
106 jeb->offset, ret);
105 107
106 jffs2_erase_failed(c, jeb, bad_offset); 108 jffs2_erase_failed(c, jeb, bad_offset);
107} 109}
@@ -217,7 +219,7 @@ static void jffs2_erase_callback(struct erase_info *instr)
217 struct erase_priv_struct *priv = (void *)instr->priv; 219 struct erase_priv_struct *priv = (void *)instr->priv;
218 220
219 if(instr->state != MTD_ERASE_DONE) { 221 if(instr->state != MTD_ERASE_DONE) {
220 printk(KERN_WARNING "Erase at 0x%08llx finished, but state != MTD_ERASE_DONE. State is 0x%x instead.\n", 222 pr_warn("Erase at 0x%08llx finished, but state != MTD_ERASE_DONE. State is 0x%x instead.\n",
221 (unsigned long long)instr->addr, instr->state); 223 (unsigned long long)instr->addr, instr->state);
222 jffs2_erase_failed(priv->c, priv->jeb, instr->fail_addr); 224 jffs2_erase_failed(priv->c, priv->jeb, instr->fail_addr);
223 } else { 225 } else {
@@ -284,7 +286,7 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c,
284 286
285 printk(KERN_DEBUG); 287 printk(KERN_DEBUG);
286 while(this) { 288 while(this) {
287 printk(KERN_CONT "0x%08x(%d)->", 289 pr_cont("0x%08x(%d)->",
288 ref_offset(this), ref_flags(this)); 290 ref_offset(this), ref_flags(this));
289 if (++i == 5) { 291 if (++i == 5) {
290 printk(KERN_DEBUG); 292 printk(KERN_DEBUG);
@@ -292,7 +294,7 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c,
292 } 294 }
293 this = this->next_in_ino; 295 this = this->next_in_ino;
294 } 296 }
295 printk(KERN_CONT "\n"); 297 pr_cont("\n");
296 }); 298 });
297 299
298 switch (ic->class) { 300 switch (ic->class) {
@@ -364,8 +366,10 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
364 } while(--retlen); 366 } while(--retlen);
365 mtd_unpoint(c->mtd, jeb->offset, c->sector_size); 367 mtd_unpoint(c->mtd, jeb->offset, c->sector_size);
366 if (retlen) { 368 if (retlen) {
367 printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08tx\n", 369 pr_warn("Newly-erased block contained word 0x%lx at offset 0x%08tx\n",
368 *wordebuf, jeb->offset + c->sector_size-retlen*sizeof(*wordebuf)); 370 *wordebuf,
371 jeb->offset +
372 c->sector_size-retlen * sizeof(*wordebuf));
369 return -EIO; 373 return -EIO;
370 } 374 }
371 return 0; 375 return 0;
@@ -373,7 +377,8 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
373 do_flash_read: 377 do_flash_read:
374 ebuf = kmalloc(PAGE_SIZE, GFP_KERNEL); 378 ebuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
375 if (!ebuf) { 379 if (!ebuf) {
376 printk(KERN_WARNING "Failed to allocate page buffer for verifying erase at 0x%08x. Refiling\n", jeb->offset); 380 pr_warn("Failed to allocate page buffer for verifying erase at 0x%08x. Refiling\n",
381 jeb->offset);
377 return -EAGAIN; 382 return -EAGAIN;
378 } 383 }
379 384
@@ -387,12 +392,14 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
387 392
388 ret = mtd_read(c->mtd, ofs, readlen, &retlen, ebuf); 393 ret = mtd_read(c->mtd, ofs, readlen, &retlen, ebuf);
389 if (ret) { 394 if (ret) {
390 printk(KERN_WARNING "Read of newly-erased block at 0x%08x failed: %d. Putting on bad_list\n", ofs, ret); 395 pr_warn("Read of newly-erased block at 0x%08x failed: %d. Putting on bad_list\n",
396 ofs, ret);
391 ret = -EIO; 397 ret = -EIO;
392 goto fail; 398 goto fail;
393 } 399 }
394 if (retlen != readlen) { 400 if (retlen != readlen) {
395 printk(KERN_WARNING "Short read from newly-erased block at 0x%08x. Wanted %d, got %zd\n", ofs, readlen, retlen); 401 pr_warn("Short read from newly-erased block at 0x%08x. Wanted %d, got %zd\n",
402 ofs, readlen, retlen);
396 ret = -EIO; 403 ret = -EIO;
397 goto fail; 404 goto fail;
398 } 405 }
@@ -401,7 +408,8 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
401 unsigned long *datum = ebuf + i; 408 unsigned long *datum = ebuf + i;
402 if (*datum + 1) { 409 if (*datum + 1) {
403 *bad_offset += i; 410 *bad_offset += i;
404 printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08x\n", *datum, *bad_offset); 411 pr_warn("Newly-erased block contained word 0x%lx at offset 0x%08x\n",
412 *datum, *bad_offset);
405 ret = -EIO; 413 ret = -EIO;
406 goto fail; 414 goto fail;
407 } 415 }
@@ -456,10 +464,10 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
456 464
457 if (ret || retlen != sizeof(marker)) { 465 if (ret || retlen != sizeof(marker)) {
458 if (ret) 466 if (ret)
459 printk(KERN_WARNING "Write clean marker to block at 0x%08x failed: %d\n", 467 pr_warn("Write clean marker to block at 0x%08x failed: %d\n",
460 jeb->offset, ret); 468 jeb->offset, ret);
461 else 469 else
462 printk(KERN_WARNING "Short write to newly-erased block at 0x%08x: Wanted %zd, got %zd\n", 470 pr_warn("Short write to newly-erased block at 0x%08x: Wanted %zd, got %zd\n",
463 jeb->offset, sizeof(marker), retlen); 471 jeb->offset, sizeof(marker), retlen);
464 472
465 goto filebad; 473 goto filebad;
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 9a8c97c264c2..598baafa0219 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -320,14 +320,16 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
320 /* Read the device numbers from the media */ 320 /* Read the device numbers from the media */
321 if (f->metadata->size != sizeof(jdev.old_id) && 321 if (f->metadata->size != sizeof(jdev.old_id) &&
322 f->metadata->size != sizeof(jdev.new_id)) { 322 f->metadata->size != sizeof(jdev.new_id)) {
323 printk(KERN_NOTICE "Device node has strange size %d\n", f->metadata->size); 323 pr_notice("Device node has strange size %d\n",
324 f->metadata->size);
324 goto error_io; 325 goto error_io;
325 } 326 }
326 jffs2_dbg(1, "Reading device numbers from flash\n"); 327 jffs2_dbg(1, "Reading device numbers from flash\n");
327 ret = jffs2_read_dnode(c, f, f->metadata, (char *)&jdev, 0, f->metadata->size); 328 ret = jffs2_read_dnode(c, f, f->metadata, (char *)&jdev, 0, f->metadata->size);
328 if (ret < 0) { 329 if (ret < 0) {
329 /* Eep */ 330 /* Eep */
330 printk(KERN_NOTICE "Read device numbers for inode %lu failed\n", (unsigned long)inode->i_ino); 331 pr_notice("Read device numbers for inode %lu failed\n",
332 (unsigned long)inode->i_ino);
331 goto error; 333 goto error;
332 } 334 }
333 if (f->metadata->size == sizeof(jdev.old_id)) 335 if (f->metadata->size == sizeof(jdev.old_id))
@@ -342,7 +344,8 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
342 break; 344 break;
343 345
344 default: 346 default:
345 printk(KERN_WARNING "jffs2_read_inode(): Bogus imode %o for ino %lu\n", inode->i_mode, (unsigned long)inode->i_ino); 347 pr_warn("%s(): Bogus i_mode %o for ino %lu\n",
348 __func__, inode->i_mode, (unsigned long)inode->i_ino);
346 } 349 }
347 350
348 mutex_unlock(&f->sem); 351 mutex_unlock(&f->sem);
@@ -510,11 +513,11 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
510 513
511#ifndef CONFIG_JFFS2_FS_WRITEBUFFER 514#ifndef CONFIG_JFFS2_FS_WRITEBUFFER
512 if (c->mtd->type == MTD_NANDFLASH) { 515 if (c->mtd->type == MTD_NANDFLASH) {
513 printk(KERN_ERR "jffs2: Cannot operate on NAND flash unless jffs2 NAND support is compiled in.\n"); 516 pr_err("jffs2: Cannot operate on NAND flash unless jffs2 NAND support is compiled in.\n");
514 return -EINVAL; 517 return -EINVAL;
515 } 518 }
516 if (c->mtd->type == MTD_DATAFLASH) { 519 if (c->mtd->type == MTD_DATAFLASH) {
517 printk(KERN_ERR "jffs2: Cannot operate on DataFlash unless jffs2 DataFlash support is compiled in.\n"); 520 pr_err("jffs2: Cannot operate on DataFlash unless jffs2 DataFlash support is compiled in.\n");
518 return -EINVAL; 521 return -EINVAL;
519 } 522 }
520#endif 523#endif
@@ -528,12 +531,13 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
528 */ 531 */
529 if ((c->sector_size * blocks) != c->flash_size) { 532 if ((c->sector_size * blocks) != c->flash_size) {
530 c->flash_size = c->sector_size * blocks; 533 c->flash_size = c->sector_size * blocks;
531 printk(KERN_INFO "jffs2: Flash size not aligned to erasesize, reducing to %dKiB\n", 534 pr_info("jffs2: Flash size not aligned to erasesize, reducing to %dKiB\n",
532 c->flash_size / 1024); 535 c->flash_size / 1024);
533 } 536 }
534 537
535 if (c->flash_size < 5*c->sector_size) { 538 if (c->flash_size < 5*c->sector_size) {
536 printk(KERN_ERR "jffs2: Too few erase blocks (%d)\n", c->flash_size / c->sector_size); 539 pr_err("jffs2: Too few erase blocks (%d)\n",
540 c->flash_size / c->sector_size);
537 return -EINVAL; 541 return -EINVAL;
538 } 542 }
539 543
@@ -658,8 +662,8 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c,
658 return ERR_CAST(inode); 662 return ERR_CAST(inode);
659 } 663 }
660 if (is_bad_inode(inode)) { 664 if (is_bad_inode(inode)) {
661 printk(KERN_NOTICE "Eep. read_inode() failed for ino #%u. unlinked %d\n", 665 pr_notice("Eep. read_inode() failed for ino #%u. unlinked %d\n",
662 inum, unlinked); 666 inum, unlinked);
663 /* NB. This will happen again. We need to do something appropriate here. */ 667 /* NB. This will happen again. We need to do something appropriate here. */
664 iput(inode); 668 iput(inode);
665 return ERR_PTR(-EIO); 669 return ERR_PTR(-EIO);
diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c
index 85e703a29361..d7936d068b2e 100644
--- a/fs/jffs2/gc.c
+++ b/fs/jffs2/gc.c
@@ -97,7 +97,8 @@ again:
97 c->gcblock = ret; 97 c->gcblock = ret;
98 ret->gc_node = ret->first_node; 98 ret->gc_node = ret->first_node;
99 if (!ret->gc_node) { 99 if (!ret->gc_node) {
100 printk(KERN_WARNING "Eep. ret->gc_node for block at 0x%08x is NULL\n", ret->offset); 100 pr_warn("Eep. ret->gc_node for block at 0x%08x is NULL\n",
101 ret->offset);
101 BUG(); 102 BUG();
102 } 103 }
103 104
@@ -141,8 +142,8 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
141 142
142 /* checked_ino is protected by the alloc_sem */ 143 /* checked_ino is protected by the alloc_sem */
143 if (c->checked_ino > c->highest_ino && xattr) { 144 if (c->checked_ino > c->highest_ino && xattr) {
144 printk(KERN_CRIT "Checked all inodes but still 0x%x bytes of unchecked space?\n", 145 pr_crit("Checked all inodes but still 0x%x bytes of unchecked space?\n",
145 c->unchecked_size); 146 c->unchecked_size);
146 jffs2_dbg_dump_block_lists_nolock(c); 147 jffs2_dbg_dump_block_lists_nolock(c);
147 spin_unlock(&c->erase_completion_lock); 148 spin_unlock(&c->erase_completion_lock);
148 mutex_unlock(&c->alloc_sem); 149 mutex_unlock(&c->alloc_sem);
@@ -180,7 +181,8 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
180 181
181 case INO_STATE_GC: 182 case INO_STATE_GC:
182 case INO_STATE_CHECKING: 183 case INO_STATE_CHECKING:
183 printk(KERN_WARNING "Inode #%u is in state %d during CRC check phase!\n", ic->ino, ic->state); 184 pr_warn("Inode #%u is in state %d during CRC check phase!\n",
185 ic->ino, ic->state);
184 spin_unlock(&c->inocache_lock); 186 spin_unlock(&c->inocache_lock);
185 BUG(); 187 BUG();
186 188
@@ -212,7 +214,8 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
212 214
213 ret = jffs2_do_crccheck_inode(c, ic); 215 ret = jffs2_do_crccheck_inode(c, ic);
214 if (ret) 216 if (ret)
215 printk(KERN_WARNING "Returned error for crccheck of ino #%u. Expect badness...\n", ic->ino); 217 pr_warn("Returned error for crccheck of ino #%u. Expect badness...\n",
218 ic->ino);
216 219
217 jffs2_set_inocache_state(c, ic, INO_STATE_CHECKEDABSENT); 220 jffs2_set_inocache_state(c, ic, INO_STATE_CHECKEDABSENT);
218 mutex_unlock(&c->alloc_sem); 221 mutex_unlock(&c->alloc_sem);
@@ -270,9 +273,10 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
270 ref_offset(raw)); 273 ref_offset(raw));
271 raw = ref_next(raw); 274 raw = ref_next(raw);
272 if (unlikely(!raw)) { 275 if (unlikely(!raw)) {
273 printk(KERN_WARNING "eep. End of raw list while still supposedly nodes to GC\n"); 276 pr_warn("eep. End of raw list while still supposedly nodes to GC\n");
274 printk(KERN_WARNING "erase block at 0x%08x. free_size 0x%08x, dirty_size 0x%08x, used_size 0x%08x\n", 277 pr_warn("erase block at 0x%08x. free_size 0x%08x, dirty_size 0x%08x, used_size 0x%08x\n",
275 jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size); 278 jeb->offset, jeb->free_size,
279 jeb->dirty_size, jeb->used_size);
276 jeb->gc_node = raw; 280 jeb->gc_node = raw;
277 spin_unlock(&c->erase_completion_lock); 281 spin_unlock(&c->erase_completion_lock);
278 mutex_unlock(&c->alloc_sem); 282 mutex_unlock(&c->alloc_sem);
@@ -362,8 +366,8 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
362 we're holding the alloc_sem, no other garbage collection 366 we're holding the alloc_sem, no other garbage collection
363 can happen. 367 can happen.
364 */ 368 */
365 printk(KERN_CRIT "Inode #%u already in state %d in jffs2_garbage_collect_pass()!\n", 369 pr_crit("Inode #%u already in state %d in jffs2_garbage_collect_pass()!\n",
366 ic->ino, ic->state); 370 ic->ino, ic->state);
367 mutex_unlock(&c->alloc_sem); 371 mutex_unlock(&c->alloc_sem);
368 spin_unlock(&c->inocache_lock); 372 spin_unlock(&c->inocache_lock);
369 BUG(); 373 BUG();
@@ -442,7 +446,8 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
442 test_gcnode: 446 test_gcnode:
443 if (jeb->dirty_size == gcblock_dirty && !ref_obsolete(jeb->gc_node)) { 447 if (jeb->dirty_size == gcblock_dirty && !ref_obsolete(jeb->gc_node)) {
444 /* Eep. This really should never happen. GC is broken */ 448 /* Eep. This really should never happen. GC is broken */
445 printk(KERN_ERR "Error garbage collecting node at %08x!\n", ref_offset(jeb->gc_node)); 449 pr_err("Error garbage collecting node at %08x!\n",
450 ref_offset(jeb->gc_node));
446 ret = -ENOSPC; 451 ret = -ENOSPC;
447 } 452 }
448 release_sem: 453 release_sem:
@@ -546,10 +551,10 @@ static int jffs2_garbage_collect_live(struct jffs2_sb_info *c, struct jffs2_era
546 } else if (fd) { 551 } else if (fd) {
547 ret = jffs2_garbage_collect_deletion_dirent(c, jeb, f, fd); 552 ret = jffs2_garbage_collect_deletion_dirent(c, jeb, f, fd);
548 } else { 553 } else {
549 printk(KERN_WARNING "Raw node at 0x%08x wasn't in node lists for ino #%u\n", 554 pr_warn("Raw node at 0x%08x wasn't in node lists for ino #%u\n",
550 ref_offset(raw), f->inocache->ino); 555 ref_offset(raw), f->inocache->ino);
551 if (ref_obsolete(raw)) { 556 if (ref_obsolete(raw)) {
552 printk(KERN_WARNING "But it's obsolete so we don't mind too much\n"); 557 pr_warn("But it's obsolete so we don't mind too much\n");
553 } else { 558 } else {
554 jffs2_dbg_dump_node(c, ref_offset(raw)); 559 jffs2_dbg_dump_node(c, ref_offset(raw));
555 BUG(); 560 BUG();
@@ -606,8 +611,8 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
606 611
607 crc = crc32(0, node, sizeof(struct jffs2_unknown_node)-4); 612 crc = crc32(0, node, sizeof(struct jffs2_unknown_node)-4);
608 if (je32_to_cpu(node->u.hdr_crc) != crc) { 613 if (je32_to_cpu(node->u.hdr_crc) != crc) {
609 printk(KERN_WARNING "Header CRC failed on REF_PRISTINE node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", 614 pr_warn("Header CRC failed on REF_PRISTINE node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
610 ref_offset(raw), je32_to_cpu(node->u.hdr_crc), crc); 615 ref_offset(raw), je32_to_cpu(node->u.hdr_crc), crc);
611 goto bail; 616 goto bail;
612 } 617 }
613 618
@@ -615,16 +620,18 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
615 case JFFS2_NODETYPE_INODE: 620 case JFFS2_NODETYPE_INODE:
616 crc = crc32(0, node, sizeof(node->i)-8); 621 crc = crc32(0, node, sizeof(node->i)-8);
617 if (je32_to_cpu(node->i.node_crc) != crc) { 622 if (je32_to_cpu(node->i.node_crc) != crc) {
618 printk(KERN_WARNING "Node CRC failed on REF_PRISTINE data node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", 623 pr_warn("Node CRC failed on REF_PRISTINE data node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
619 ref_offset(raw), je32_to_cpu(node->i.node_crc), crc); 624 ref_offset(raw), je32_to_cpu(node->i.node_crc),
625 crc);
620 goto bail; 626 goto bail;
621 } 627 }
622 628
623 if (je32_to_cpu(node->i.dsize)) { 629 if (je32_to_cpu(node->i.dsize)) {
624 crc = crc32(0, node->i.data, je32_to_cpu(node->i.csize)); 630 crc = crc32(0, node->i.data, je32_to_cpu(node->i.csize));
625 if (je32_to_cpu(node->i.data_crc) != crc) { 631 if (je32_to_cpu(node->i.data_crc) != crc) {
626 printk(KERN_WARNING "Data CRC failed on REF_PRISTINE data node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", 632 pr_warn("Data CRC failed on REF_PRISTINE data node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
627 ref_offset(raw), je32_to_cpu(node->i.data_crc), crc); 633 ref_offset(raw),
634 je32_to_cpu(node->i.data_crc), crc);
628 goto bail; 635 goto bail;
629 } 636 }
630 } 637 }
@@ -633,21 +640,24 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
633 case JFFS2_NODETYPE_DIRENT: 640 case JFFS2_NODETYPE_DIRENT:
634 crc = crc32(0, node, sizeof(node->d)-8); 641 crc = crc32(0, node, sizeof(node->d)-8);
635 if (je32_to_cpu(node->d.node_crc) != crc) { 642 if (je32_to_cpu(node->d.node_crc) != crc) {
636 printk(KERN_WARNING "Node CRC failed on REF_PRISTINE dirent node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", 643 pr_warn("Node CRC failed on REF_PRISTINE dirent node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
637 ref_offset(raw), je32_to_cpu(node->d.node_crc), crc); 644 ref_offset(raw),
645 je32_to_cpu(node->d.node_crc), crc);
638 goto bail; 646 goto bail;
639 } 647 }
640 648
641 if (strnlen(node->d.name, node->d.nsize) != node->d.nsize) { 649 if (strnlen(node->d.name, node->d.nsize) != node->d.nsize) {
642 printk(KERN_WARNING "Name in dirent node at 0x%08x contains zeroes\n", ref_offset(raw)); 650 pr_warn("Name in dirent node at 0x%08x contains zeroes\n",
651 ref_offset(raw));
643 goto bail; 652 goto bail;
644 } 653 }
645 654
646 if (node->d.nsize) { 655 if (node->d.nsize) {
647 crc = crc32(0, node->d.name, node->d.nsize); 656 crc = crc32(0, node->d.name, node->d.nsize);
648 if (je32_to_cpu(node->d.name_crc) != crc) { 657 if (je32_to_cpu(node->d.name_crc) != crc) {
649 printk(KERN_WARNING "Name CRC failed on REF_PRISTINE dirent node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", 658 pr_warn("Name CRC failed on REF_PRISTINE dirent node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
650 ref_offset(raw), je32_to_cpu(node->d.name_crc), crc); 659 ref_offset(raw),
660 je32_to_cpu(node->d.name_crc), crc);
651 goto bail; 661 goto bail;
652 } 662 }
653 } 663 }
@@ -655,8 +665,8 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
655 default: 665 default:
656 /* If it's inode-less, we don't _know_ what it is. Just copy it intact */ 666 /* If it's inode-less, we don't _know_ what it is. Just copy it intact */
657 if (ic) { 667 if (ic) {
658 printk(KERN_WARNING "Unknown node type for REF_PRISTINE node at 0x%08x: 0x%04x\n", 668 pr_warn("Unknown node type for REF_PRISTINE node at 0x%08x: 0x%04x\n",
659 ref_offset(raw), je16_to_cpu(node->u.nodetype)); 669 ref_offset(raw), je16_to_cpu(node->u.nodetype));
660 goto bail; 670 goto bail;
661 } 671 }
662 } 672 }
@@ -668,12 +678,13 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
668 ret = jffs2_flash_write(c, phys_ofs, rawlen, &retlen, (char *)node); 678 ret = jffs2_flash_write(c, phys_ofs, rawlen, &retlen, (char *)node);
669 679
670 if (ret || (retlen != rawlen)) { 680 if (ret || (retlen != rawlen)) {
671 printk(KERN_NOTICE "Write of %d bytes at 0x%08x failed. returned %d, retlen %zd\n", 681 pr_notice("Write of %d bytes at 0x%08x failed. returned %d, retlen %zd\n",
672 rawlen, phys_ofs, ret, retlen); 682 rawlen, phys_ofs, ret, retlen);
673 if (retlen) { 683 if (retlen) {
674 jffs2_add_physical_node_ref(c, phys_ofs | REF_OBSOLETE, rawlen, NULL); 684 jffs2_add_physical_node_ref(c, phys_ofs | REF_OBSOLETE, rawlen, NULL);
675 } else { 685 } else {
676 printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", phys_ofs); 686 pr_notice("Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n",
687 phys_ofs);
677 } 688 }
678 if (!retried) { 689 if (!retried) {
679 /* Try to reallocate space and retry */ 690 /* Try to reallocate space and retry */
@@ -745,12 +756,13 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_
745 mdatalen = fn->size; 756 mdatalen = fn->size;
746 mdata = kmalloc(fn->size, GFP_KERNEL); 757 mdata = kmalloc(fn->size, GFP_KERNEL);
747 if (!mdata) { 758 if (!mdata) {
748 printk(KERN_WARNING "kmalloc of mdata failed in jffs2_garbage_collect_metadata()\n"); 759 pr_warn("kmalloc of mdata failed in jffs2_garbage_collect_metadata()\n");
749 return -ENOMEM; 760 return -ENOMEM;
750 } 761 }
751 ret = jffs2_read_dnode(c, f, fn, mdata, 0, mdatalen); 762 ret = jffs2_read_dnode(c, f, fn, mdata, 0, mdatalen);
752 if (ret) { 763 if (ret) {
753 printk(KERN_WARNING "read of old metadata failed in jffs2_garbage_collect_metadata(): %d\n", ret); 764 pr_warn("read of old metadata failed in jffs2_garbage_collect_metadata(): %d\n",
765 ret);
754 kfree(mdata); 766 kfree(mdata);
755 return ret; 767 return ret;
756 } 768 }
@@ -762,8 +774,8 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_
762 ret = jffs2_reserve_space_gc(c, sizeof(ri) + mdatalen, &alloclen, 774 ret = jffs2_reserve_space_gc(c, sizeof(ri) + mdatalen, &alloclen,
763 JFFS2_SUMMARY_INODE_SIZE); 775 JFFS2_SUMMARY_INODE_SIZE);
764 if (ret) { 776 if (ret) {
765 printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_metadata failed: %d\n", 777 pr_warn("jffs2_reserve_space_gc of %zd bytes for garbage_collect_metadata failed: %d\n",
766 sizeof(ri)+ mdatalen, ret); 778 sizeof(ri) + mdatalen, ret);
767 goto out; 779 goto out;
768 } 780 }
769 781
@@ -800,7 +812,7 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_
800 new_fn = jffs2_write_dnode(c, f, &ri, mdata, mdatalen, ALLOC_GC); 812 new_fn = jffs2_write_dnode(c, f, &ri, mdata, mdatalen, ALLOC_GC);
801 813
802 if (IS_ERR(new_fn)) { 814 if (IS_ERR(new_fn)) {
803 printk(KERN_WARNING "Error writing new dnode: %ld\n", PTR_ERR(new_fn)); 815 pr_warn("Error writing new dnode: %ld\n", PTR_ERR(new_fn));
804 ret = PTR_ERR(new_fn); 816 ret = PTR_ERR(new_fn);
805 goto out; 817 goto out;
806 } 818 }
@@ -843,14 +855,15 @@ static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_er
843 ret = jffs2_reserve_space_gc(c, sizeof(rd)+rd.nsize, &alloclen, 855 ret = jffs2_reserve_space_gc(c, sizeof(rd)+rd.nsize, &alloclen,
844 JFFS2_SUMMARY_DIRENT_SIZE(rd.nsize)); 856 JFFS2_SUMMARY_DIRENT_SIZE(rd.nsize));
845 if (ret) { 857 if (ret) {
846 printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_dirent failed: %d\n", 858 pr_warn("jffs2_reserve_space_gc of %zd bytes for garbage_collect_dirent failed: %d\n",
847 sizeof(rd)+rd.nsize, ret); 859 sizeof(rd)+rd.nsize, ret);
848 return ret; 860 return ret;
849 } 861 }
850 new_fd = jffs2_write_dirent(c, f, &rd, fd->name, rd.nsize, ALLOC_GC); 862 new_fd = jffs2_write_dirent(c, f, &rd, fd->name, rd.nsize, ALLOC_GC);
851 863
852 if (IS_ERR(new_fd)) { 864 if (IS_ERR(new_fd)) {
853 printk(KERN_WARNING "jffs2_write_dirent in garbage_collect_dirent failed: %ld\n", PTR_ERR(new_fd)); 865 pr_warn("jffs2_write_dirent in garbage_collect_dirent failed: %ld\n",
866 PTR_ERR(new_fd));
854 return PTR_ERR(new_fd); 867 return PTR_ERR(new_fd);
855 } 868 }
856 jffs2_add_fd_to_list(c, new_fd, &f->dents); 869 jffs2_add_fd_to_list(c, new_fd, &f->dents);
@@ -910,13 +923,15 @@ static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct
910 length. We need to take a closer look...*/ 923 length. We need to take a closer look...*/
911 ret = jffs2_flash_read(c, ref_offset(raw), rawlen, &retlen, (char *)rd); 924 ret = jffs2_flash_read(c, ref_offset(raw), rawlen, &retlen, (char *)rd);
912 if (ret) { 925 if (ret) {
913 printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Read error (%d) reading obsolete node at %08x\n", ret, ref_offset(raw)); 926 pr_warn("%s(): Read error (%d) reading obsolete node at %08x\n",
927 __func__, ret, ref_offset(raw));
914 /* If we can't read it, we don't need to continue to obsolete it. Continue */ 928 /* If we can't read it, we don't need to continue to obsolete it. Continue */
915 continue; 929 continue;
916 } 930 }
917 if (retlen != rawlen) { 931 if (retlen != rawlen) {
918 printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Short read (%zd not %u) reading header from obsolete node at %08x\n", 932 pr_warn("%s(): Short read (%zd not %u) reading header from obsolete node at %08x\n",
919 retlen, rawlen, ref_offset(raw)); 933 __func__, retlen, rawlen,
934 ref_offset(raw));
920 continue; 935 continue;
921 } 936 }
922 937
@@ -965,7 +980,8 @@ static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct
965 fdp = &(*fdp)->next; 980 fdp = &(*fdp)->next;
966 } 981 }
967 if (!found) { 982 if (!found) {
968 printk(KERN_WARNING "Deletion dirent \"%s\" not found in list for ino #%u\n", fd->name, f->inocache->ino); 983 pr_warn("Deletion dirent \"%s\" not found in list for ino #%u\n",
984 fd->name, f->inocache->ino);
969 } 985 }
970 jffs2_mark_node_obsolete(c, fd->raw); 986 jffs2_mark_node_obsolete(c, fd->raw);
971 jffs2_free_full_dirent(fd); 987 jffs2_free_full_dirent(fd);
@@ -994,35 +1010,37 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
994 write it out again with the _same_ version as before */ 1010 write it out again with the _same_ version as before */
995 ret = jffs2_flash_read(c, ref_offset(fn->raw), sizeof(ri), &readlen, (char *)&ri); 1011 ret = jffs2_flash_read(c, ref_offset(fn->raw), sizeof(ri), &readlen, (char *)&ri);
996 if (readlen != sizeof(ri) || ret) { 1012 if (readlen != sizeof(ri) || ret) {
997 printk(KERN_WARNING "Node read failed in jffs2_garbage_collect_hole. Ret %d, retlen %zd. Data will be lost by writing new hole node\n", ret, readlen); 1013 pr_warn("Node read failed in jffs2_garbage_collect_hole. Ret %d, retlen %zd. Data will be lost by writing new hole node\n",
1014 ret, readlen);
998 goto fill; 1015 goto fill;
999 } 1016 }
1000 if (je16_to_cpu(ri.nodetype) != JFFS2_NODETYPE_INODE) { 1017 if (je16_to_cpu(ri.nodetype) != JFFS2_NODETYPE_INODE) {
1001 printk(KERN_WARNING "jffs2_garbage_collect_hole: Node at 0x%08x had node type 0x%04x instead of JFFS2_NODETYPE_INODE(0x%04x)\n", 1018 pr_warn("%s(): Node at 0x%08x had node type 0x%04x instead of JFFS2_NODETYPE_INODE(0x%04x)\n",
1002 ref_offset(fn->raw), 1019 __func__, ref_offset(fn->raw),
1003 je16_to_cpu(ri.nodetype), JFFS2_NODETYPE_INODE); 1020 je16_to_cpu(ri.nodetype), JFFS2_NODETYPE_INODE);
1004 return -EIO; 1021 return -EIO;
1005 } 1022 }
1006 if (je32_to_cpu(ri.totlen) != sizeof(ri)) { 1023 if (je32_to_cpu(ri.totlen) != sizeof(ri)) {
1007 printk(KERN_WARNING "jffs2_garbage_collect_hole: Node at 0x%08x had totlen 0x%x instead of expected 0x%zx\n", 1024 pr_warn("%s(): Node at 0x%08x had totlen 0x%x instead of expected 0x%zx\n",
1008 ref_offset(fn->raw), 1025 __func__, ref_offset(fn->raw),
1009 je32_to_cpu(ri.totlen), sizeof(ri)); 1026 je32_to_cpu(ri.totlen), sizeof(ri));
1010 return -EIO; 1027 return -EIO;
1011 } 1028 }
1012 crc = crc32(0, &ri, sizeof(ri)-8); 1029 crc = crc32(0, &ri, sizeof(ri)-8);
1013 if (crc != je32_to_cpu(ri.node_crc)) { 1030 if (crc != je32_to_cpu(ri.node_crc)) {
1014 printk(KERN_WARNING "jffs2_garbage_collect_hole: Node at 0x%08x had CRC 0x%08x which doesn't match calculated CRC 0x%08x\n", 1031 pr_warn("%s: Node at 0x%08x had CRC 0x%08x which doesn't match calculated CRC 0x%08x\n",
1015 ref_offset(fn->raw), 1032 __func__, ref_offset(fn->raw),
1016 je32_to_cpu(ri.node_crc), crc); 1033 je32_to_cpu(ri.node_crc), crc);
1017 /* FIXME: We could possibly deal with this by writing new holes for each frag */ 1034 /* FIXME: We could possibly deal with this by writing new holes for each frag */
1018 printk(KERN_WARNING "Data in the range 0x%08x to 0x%08x of inode #%u will be lost\n", 1035 pr_warn("Data in the range 0x%08x to 0x%08x of inode #%u will be lost\n",
1019 start, end, f->inocache->ino); 1036 start, end, f->inocache->ino);
1020 goto fill; 1037 goto fill;
1021 } 1038 }
1022 if (ri.compr != JFFS2_COMPR_ZERO) { 1039 if (ri.compr != JFFS2_COMPR_ZERO) {
1023 printk(KERN_WARNING "jffs2_garbage_collect_hole: Node 0x%08x wasn't a hole node!\n", ref_offset(fn->raw)); 1040 pr_warn("%s(): Node 0x%08x wasn't a hole node!\n",
1024 printk(KERN_WARNING "Data in the range 0x%08x to 0x%08x of inode #%u will be lost\n", 1041 __func__, ref_offset(fn->raw));
1025 start, end, f->inocache->ino); 1042 pr_warn("Data in the range 0x%08x to 0x%08x of inode #%u will be lost\n",
1043 start, end, f->inocache->ino);
1026 goto fill; 1044 goto fill;
1027 } 1045 }
1028 } else { 1046 } else {
@@ -1061,14 +1079,14 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
1061 ret = jffs2_reserve_space_gc(c, sizeof(ri), &alloclen, 1079 ret = jffs2_reserve_space_gc(c, sizeof(ri), &alloclen,
1062 JFFS2_SUMMARY_INODE_SIZE); 1080 JFFS2_SUMMARY_INODE_SIZE);
1063 if (ret) { 1081 if (ret) {
1064 printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_hole failed: %d\n", 1082 pr_warn("jffs2_reserve_space_gc of %zd bytes for garbage_collect_hole failed: %d\n",
1065 sizeof(ri), ret); 1083 sizeof(ri), ret);
1066 return ret; 1084 return ret;
1067 } 1085 }
1068 new_fn = jffs2_write_dnode(c, f, &ri, NULL, 0, ALLOC_GC); 1086 new_fn = jffs2_write_dnode(c, f, &ri, NULL, 0, ALLOC_GC);
1069 1087
1070 if (IS_ERR(new_fn)) { 1088 if (IS_ERR(new_fn)) {
1071 printk(KERN_WARNING "Error writing new hole node: %ld\n", PTR_ERR(new_fn)); 1089 pr_warn("Error writing new hole node: %ld\n", PTR_ERR(new_fn));
1072 return PTR_ERR(new_fn); 1090 return PTR_ERR(new_fn);
1073 } 1091 }
1074 if (je32_to_cpu(ri.version) == f->highest_version) { 1092 if (je32_to_cpu(ri.version) == f->highest_version) {
@@ -1088,9 +1106,9 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
1088 * above.) 1106 * above.)
1089 */ 1107 */
1090 D1(if(unlikely(fn->frags <= 1)) { 1108 D1(if(unlikely(fn->frags <= 1)) {
1091 printk(KERN_WARNING "jffs2_garbage_collect_hole: Replacing fn with %d frag(s) but new ver %d != highest_version %d of ino #%d\n", 1109 pr_warn("%s(): Replacing fn with %d frag(s) but new ver %d != highest_version %d of ino #%d\n",
1092 fn->frags, je32_to_cpu(ri.version), f->highest_version, 1110 __func__, fn->frags, je32_to_cpu(ri.version),
1093 je32_to_cpu(ri.ino)); 1111 f->highest_version, je32_to_cpu(ri.ino));
1094 }); 1112 });
1095 1113
1096 /* This is a partially-overlapped hole node. Mark it REF_NORMAL not REF_PRISTINE */ 1114 /* This is a partially-overlapped hole node. Mark it REF_NORMAL not REF_PRISTINE */
@@ -1107,11 +1125,11 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
1107 } 1125 }
1108 } 1126 }
1109 if (fn->frags) { 1127 if (fn->frags) {
1110 printk(KERN_WARNING "jffs2_garbage_collect_hole: Old node still has frags!\n"); 1128 pr_warn("%s(): Old node still has frags!\n", __func__);
1111 BUG(); 1129 BUG();
1112 } 1130 }
1113 if (!new_fn->frags) { 1131 if (!new_fn->frags) {
1114 printk(KERN_WARNING "jffs2_garbage_collect_hole: New node has no frags!\n"); 1132 pr_warn("%s(): New node has no frags!\n", __func__);
1115 BUG(); 1133 BUG();
1116 } 1134 }
1117 1135
@@ -1286,7 +1304,8 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era
1286 pg_ptr = jffs2_gc_fetch_page(c, f, start, &pg); 1304 pg_ptr = jffs2_gc_fetch_page(c, f, start, &pg);
1287 1305
1288 if (IS_ERR(pg_ptr)) { 1306 if (IS_ERR(pg_ptr)) {
1289 printk(KERN_WARNING "read_cache_page() returned error: %ld\n", PTR_ERR(pg_ptr)); 1307 pr_warn("read_cache_page() returned error: %ld\n",
1308 PTR_ERR(pg_ptr));
1290 return PTR_ERR(pg_ptr); 1309 return PTR_ERR(pg_ptr);
1291 } 1310 }
1292 1311
@@ -1300,8 +1319,8 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era
1300 &alloclen, JFFS2_SUMMARY_INODE_SIZE); 1319 &alloclen, JFFS2_SUMMARY_INODE_SIZE);
1301 1320
1302 if (ret) { 1321 if (ret) {
1303 printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_dnode failed: %d\n", 1322 pr_warn("jffs2_reserve_space_gc of %zd bytes for garbage_collect_dnode failed: %d\n",
1304 sizeof(ri)+ JFFS2_MIN_DATA_LEN, ret); 1323 sizeof(ri) + JFFS2_MIN_DATA_LEN, ret);
1305 break; 1324 break;
1306 } 1325 }
1307 cdatalen = min_t(uint32_t, alloclen - sizeof(ri), end - offset); 1326 cdatalen = min_t(uint32_t, alloclen - sizeof(ri), end - offset);
@@ -1338,7 +1357,8 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era
1338 jffs2_free_comprbuf(comprbuf, writebuf); 1357 jffs2_free_comprbuf(comprbuf, writebuf);
1339 1358
1340 if (IS_ERR(new_fn)) { 1359 if (IS_ERR(new_fn)) {
1341 printk(KERN_WARNING "Error writing new dnode: %ld\n", PTR_ERR(new_fn)); 1360 pr_warn("Error writing new dnode: %ld\n",
1361 PTR_ERR(new_fn));
1342 ret = PTR_ERR(new_fn); 1362 ret = PTR_ERR(new_fn);
1343 break; 1363 break;
1344 } 1364 }
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c
index 5e03233c2363..fc16761d72e4 100644
--- a/fs/jffs2/nodelist.c
+++ b/fs/jffs2/nodelist.c
@@ -687,8 +687,8 @@ int jffs2_scan_dirty_space(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb
687 if (!size) 687 if (!size)
688 return 0; 688 return 0;
689 if (unlikely(size > jeb->free_size)) { 689 if (unlikely(size > jeb->free_size)) {
690 printk(KERN_CRIT "Dirty space 0x%x larger then free_size 0x%x (wasted 0x%x)\n", 690 pr_crit("Dirty space 0x%x larger then free_size 0x%x (wasted 0x%x)\n",
691 size, jeb->free_size, jeb->wasted_size); 691 size, jeb->free_size, jeb->wasted_size);
692 BUG(); 692 BUG();
693 } 693 }
694 /* REF_EMPTY_NODE is !obsolete, so that works OK */ 694 /* REF_EMPTY_NODE is !obsolete, so that works OK */
@@ -726,8 +726,10 @@ static inline uint32_t __ref_totlen(struct jffs2_sb_info *c,
726 726
727 /* Last node in block. Use free_space */ 727 /* Last node in block. Use free_space */
728 if (unlikely(ref != jeb->last_node)) { 728 if (unlikely(ref != jeb->last_node)) {
729 printk(KERN_CRIT "ref %p @0x%08x is not jeb->last_node (%p @0x%08x)\n", 729 pr_crit("ref %p @0x%08x is not jeb->last_node (%p @0x%08x)\n",
730 ref, ref_offset(ref), jeb->last_node, jeb->last_node?ref_offset(jeb->last_node):0); 730 ref, ref_offset(ref), jeb->last_node,
731 jeb->last_node ?
732 ref_offset(jeb->last_node) : 0);
731 BUG(); 733 BUG();
732 } 734 }
733 ref_end = jeb->offset + c->sector_size - jeb->free_size; 735 ref_end = jeb->offset + c->sector_size - jeb->free_size;
@@ -747,16 +749,20 @@ uint32_t __jffs2_ref_totlen(struct jffs2_sb_info *c, struct jffs2_eraseblock *je
747 if (!jeb) 749 if (!jeb)
748 jeb = &c->blocks[ref->flash_offset / c->sector_size]; 750 jeb = &c->blocks[ref->flash_offset / c->sector_size];
749 751
750 printk(KERN_CRIT "Totlen for ref at %p (0x%08x-0x%08x) miscalculated as 0x%x instead of %x\n", 752 pr_crit("Totlen for ref at %p (0x%08x-0x%08x) miscalculated as 0x%x instead of %x\n",
751 ref, ref_offset(ref), ref_offset(ref)+ref->__totlen, 753 ref, ref_offset(ref), ref_offset(ref) + ref->__totlen,
752 ret, ref->__totlen); 754 ret, ref->__totlen);
753 if (ref_next(ref)) { 755 if (ref_next(ref)) {
754 printk(KERN_CRIT "next %p (0x%08x-0x%08x)\n", ref_next(ref), ref_offset(ref_next(ref)), 756 pr_crit("next %p (0x%08x-0x%08x)\n",
755 ref_offset(ref_next(ref))+ref->__totlen); 757 ref_next(ref), ref_offset(ref_next(ref)),
758 ref_offset(ref_next(ref)) + ref->__totlen);
756 } else 759 } else
757 printk(KERN_CRIT "No next ref. jeb->last_node is %p\n", jeb->last_node); 760 pr_crit("No next ref. jeb->last_node is %p\n",
761 jeb->last_node);
758 762
759 printk(KERN_CRIT "jeb->wasted_size %x, dirty_size %x, used_size %x, free_size %x\n", jeb->wasted_size, jeb->dirty_size, jeb->used_size, jeb->free_size); 763 pr_crit("jeb->wasted_size %x, dirty_size %x, used_size %x, free_size %x\n",
764 jeb->wasted_size, jeb->dirty_size, jeb->used_size,
765 jeb->free_size);
760 766
761#if defined(JFFS2_DBG_DUMPS) || defined(JFFS2_DBG_PARANOIA_CHECKS) 767#if defined(JFFS2_DBG_DUMPS) || defined(JFFS2_DBG_PARANOIA_CHECKS)
762 __jffs2_dbg_dump_node_refs_nolock(c, jeb); 768 __jffs2_dbg_dump_node_refs_nolock(c, jeb);
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
index d76a268a1973..563a5f645ba7 100644
--- a/fs/jffs2/nodemgmt.c
+++ b/fs/jffs2/nodemgmt.c
@@ -262,9 +262,11 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)
262 if (!c->nr_erasing_blocks) { 262 if (!c->nr_erasing_blocks) {
263 /* Ouch. We're in GC, or we wouldn't have got here. 263 /* Ouch. We're in GC, or we wouldn't have got here.
264 And there's no space left. At all. */ 264 And there's no space left. At all. */
265 printk(KERN_CRIT "Argh. No free space left for GC. nr_erasing_blocks is %d. nr_free_blocks is %d. (erasableempty: %s, erasingempty: %s, erasependingempty: %s)\n", 265 pr_crit("Argh. No free space left for GC. nr_erasing_blocks is %d. nr_free_blocks is %d. (erasableempty: %s, erasingempty: %s, erasependingempty: %s)\n",
266 c->nr_erasing_blocks, c->nr_free_blocks, list_empty(&c->erasable_list)?"yes":"no", 266 c->nr_erasing_blocks, c->nr_free_blocks,
267 list_empty(&c->erasing_list)?"yes":"no", list_empty(&c->erase_pending_list)?"yes":"no"); 267 list_empty(&c->erasable_list) ? "yes" : "no",
268 list_empty(&c->erasing_list) ? "yes" : "no",
269 list_empty(&c->erase_pending_list) ? "yes" : "no");
268 return -ENOSPC; 270 return -ENOSPC;
269 } 271 }
270 272
@@ -403,7 +405,8 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
403 jeb = c->nextblock; 405 jeb = c->nextblock;
404 406
405 if (jeb->free_size != c->sector_size - c->cleanmarker_size) { 407 if (jeb->free_size != c->sector_size - c->cleanmarker_size) {
406 printk(KERN_WARNING "Eep. Block 0x%08x taken from free_list had free_size of 0x%08x!!\n", jeb->offset, jeb->free_size); 408 pr_warn("Eep. Block 0x%08x taken from free_list had free_size of 0x%08x!!\n",
409 jeb->offset, jeb->free_size);
407 goto restart; 410 goto restart;
408 } 411 }
409 } 412 }
@@ -459,12 +462,14 @@ struct jffs2_raw_node_ref *jffs2_add_physical_node_ref(struct jffs2_sb_info *c,
459 even after refiling c->nextblock */ 462 even after refiling c->nextblock */
460 if ((c->nextblock || ((ofs & 3) != REF_OBSOLETE)) 463 if ((c->nextblock || ((ofs & 3) != REF_OBSOLETE))
461 && (jeb != c->nextblock || (ofs & ~3) != jeb->offset + (c->sector_size - jeb->free_size))) { 464 && (jeb != c->nextblock || (ofs & ~3) != jeb->offset + (c->sector_size - jeb->free_size))) {
462 printk(KERN_WARNING "argh. node added in wrong place at 0x%08x(%d)\n", ofs & ~3, ofs & 3); 465 pr_warn("argh. node added in wrong place at 0x%08x(%d)\n",
466 ofs & ~3, ofs & 3);
463 if (c->nextblock) 467 if (c->nextblock)
464 printk(KERN_WARNING "nextblock 0x%08x", c->nextblock->offset); 468 pr_warn("nextblock 0x%08x", c->nextblock->offset);
465 else 469 else
466 printk(KERN_WARNING "No nextblock"); 470 pr_warn("No nextblock");
467 printk(", expected at %08x\n", jeb->offset + (c->sector_size - jeb->free_size)); 471 pr_cont(", expected at %08x\n",
472 jeb->offset + (c->sector_size - jeb->free_size));
468 return ERR_PTR(-EINVAL); 473 return ERR_PTR(-EINVAL);
469 } 474 }
470#endif 475#endif
@@ -529,7 +534,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
529 uint32_t freed_len; 534 uint32_t freed_len;
530 535
531 if(unlikely(!ref)) { 536 if(unlikely(!ref)) {
532 printk(KERN_NOTICE "EEEEEK. jffs2_mark_node_obsolete called with NULL node\n"); 537 pr_notice("EEEEEK. jffs2_mark_node_obsolete called with NULL node\n");
533 return; 538 return;
534 } 539 }
535 if (ref_obsolete(ref)) { 540 if (ref_obsolete(ref)) {
@@ -539,7 +544,8 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
539 } 544 }
540 blocknr = ref->flash_offset / c->sector_size; 545 blocknr = ref->flash_offset / c->sector_size;
541 if (blocknr >= c->nr_blocks) { 546 if (blocknr >= c->nr_blocks) {
542 printk(KERN_NOTICE "raw node at 0x%08x is off the end of device!\n", ref->flash_offset); 547 pr_notice("raw node at 0x%08x is off the end of device!\n",
548 ref->flash_offset);
543 BUG(); 549 BUG();
544 } 550 }
545 jeb = &c->blocks[blocknr]; 551 jeb = &c->blocks[blocknr];
@@ -561,8 +567,9 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
561 567
562 if (ref_flags(ref) == REF_UNCHECKED) { 568 if (ref_flags(ref) == REF_UNCHECKED) {
563 D1(if (unlikely(jeb->unchecked_size < freed_len)) { 569 D1(if (unlikely(jeb->unchecked_size < freed_len)) {
564 printk(KERN_NOTICE "raw unchecked node of size 0x%08x freed from erase block %d at 0x%08x, but unchecked_size was already 0x%08x\n", 570 pr_notice("raw unchecked node of size 0x%08x freed from erase block %d at 0x%08x, but unchecked_size was already 0x%08x\n",
565 freed_len, blocknr, ref->flash_offset, jeb->used_size); 571 freed_len, blocknr,
572 ref->flash_offset, jeb->used_size);
566 BUG(); 573 BUG();
567 }) 574 })
568 jffs2_dbg(1, "Obsoleting previously unchecked node at 0x%08x of len %x\n", 575 jffs2_dbg(1, "Obsoleting previously unchecked node at 0x%08x of len %x\n",
@@ -571,8 +578,9 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
571 c->unchecked_size -= freed_len; 578 c->unchecked_size -= freed_len;
572 } else { 579 } else {
573 D1(if (unlikely(jeb->used_size < freed_len)) { 580 D1(if (unlikely(jeb->used_size < freed_len)) {
574 printk(KERN_NOTICE "raw node of size 0x%08x freed from erase block %d at 0x%08x, but used_size was already 0x%08x\n", 581 pr_notice("raw node of size 0x%08x freed from erase block %d at 0x%08x, but used_size was already 0x%08x\n",
575 freed_len, blocknr, ref->flash_offset, jeb->used_size); 582 freed_len, blocknr,
583 ref->flash_offset, jeb->used_size);
576 BUG(); 584 BUG();
577 }) 585 })
578 jffs2_dbg(1, "Obsoleting node at 0x%08x of len %#x: ", 586 jffs2_dbg(1, "Obsoleting node at 0x%08x of len %#x: ",
@@ -697,15 +705,18 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
697 ref_offset(ref)); 705 ref_offset(ref));
698 ret = jffs2_flash_read(c, ref_offset(ref), sizeof(n), &retlen, (char *)&n); 706 ret = jffs2_flash_read(c, ref_offset(ref), sizeof(n), &retlen, (char *)&n);
699 if (ret) { 707 if (ret) {
700 printk(KERN_WARNING "Read error reading from obsoleted node at 0x%08x: %d\n", ref_offset(ref), ret); 708 pr_warn("Read error reading from obsoleted node at 0x%08x: %d\n",
709 ref_offset(ref), ret);
701 goto out_erase_sem; 710 goto out_erase_sem;
702 } 711 }
703 if (retlen != sizeof(n)) { 712 if (retlen != sizeof(n)) {
704 printk(KERN_WARNING "Short read from obsoleted node at 0x%08x: %zd\n", ref_offset(ref), retlen); 713 pr_warn("Short read from obsoleted node at 0x%08x: %zd\n",
714 ref_offset(ref), retlen);
705 goto out_erase_sem; 715 goto out_erase_sem;
706 } 716 }
707 if (PAD(je32_to_cpu(n.totlen)) != PAD(freed_len)) { 717 if (PAD(je32_to_cpu(n.totlen)) != PAD(freed_len)) {
708 printk(KERN_WARNING "Node totlen on flash (0x%08x) != totlen from node ref (0x%08x)\n", je32_to_cpu(n.totlen), freed_len); 718 pr_warn("Node totlen on flash (0x%08x) != totlen from node ref (0x%08x)\n",
719 je32_to_cpu(n.totlen), freed_len);
709 goto out_erase_sem; 720 goto out_erase_sem;
710 } 721 }
711 if (!(je16_to_cpu(n.nodetype) & JFFS2_NODE_ACCURATE)) { 722 if (!(je16_to_cpu(n.nodetype) & JFFS2_NODE_ACCURATE)) {
@@ -717,11 +728,13 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
717 n.nodetype = cpu_to_je16(je16_to_cpu(n.nodetype) & ~JFFS2_NODE_ACCURATE); 728 n.nodetype = cpu_to_je16(je16_to_cpu(n.nodetype) & ~JFFS2_NODE_ACCURATE);
718 ret = jffs2_flash_write(c, ref_offset(ref), sizeof(n), &retlen, (char *)&n); 729 ret = jffs2_flash_write(c, ref_offset(ref), sizeof(n), &retlen, (char *)&n);
719 if (ret) { 730 if (ret) {
720 printk(KERN_WARNING "Write error in obliterating obsoleted node at 0x%08x: %d\n", ref_offset(ref), ret); 731 pr_warn("Write error in obliterating obsoleted node at 0x%08x: %d\n",
732 ref_offset(ref), ret);
721 goto out_erase_sem; 733 goto out_erase_sem;
722 } 734 }
723 if (retlen != sizeof(n)) { 735 if (retlen != sizeof(n)) {
724 printk(KERN_WARNING "Short write in obliterating obsoleted node at 0x%08x: %zd\n", ref_offset(ref), retlen); 736 pr_warn("Short write in obliterating obsoleted node at 0x%08x: %zd\n",
737 ref_offset(ref), retlen);
725 goto out_erase_sem; 738 goto out_erase_sem;
726 } 739 }
727 740
diff --git a/fs/jffs2/read.c b/fs/jffs2/read.c
index 835dc5d28055..925ec6541504 100644
--- a/fs/jffs2/read.c
+++ b/fs/jffs2/read.c
@@ -36,13 +36,14 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
36 ret = jffs2_flash_read(c, ref_offset(fd->raw), sizeof(*ri), &readlen, (char *)ri); 36 ret = jffs2_flash_read(c, ref_offset(fd->raw), sizeof(*ri), &readlen, (char *)ri);
37 if (ret) { 37 if (ret) {
38 jffs2_free_raw_inode(ri); 38 jffs2_free_raw_inode(ri);
39 printk(KERN_WARNING "Error reading node from 0x%08x: %d\n", ref_offset(fd->raw), ret); 39 pr_warn("Error reading node from 0x%08x: %d\n",
40 ref_offset(fd->raw), ret);
40 return ret; 41 return ret;
41 } 42 }
42 if (readlen != sizeof(*ri)) { 43 if (readlen != sizeof(*ri)) {
43 jffs2_free_raw_inode(ri); 44 jffs2_free_raw_inode(ri);
44 printk(KERN_WARNING "Short read from 0x%08x: wanted 0x%zx bytes, got 0x%zx\n", 45 pr_warn("Short read from 0x%08x: wanted 0x%zx bytes, got 0x%zx\n",
45 ref_offset(fd->raw), sizeof(*ri), readlen); 46 ref_offset(fd->raw), sizeof(*ri), readlen);
46 return -EIO; 47 return -EIO;
47 } 48 }
48 crc = crc32(0, ri, sizeof(*ri)-8); 49 crc = crc32(0, ri, sizeof(*ri)-8);
@@ -52,8 +53,8 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
52 crc, je32_to_cpu(ri->dsize), je32_to_cpu(ri->csize), 53 crc, je32_to_cpu(ri->dsize), je32_to_cpu(ri->csize),
53 je32_to_cpu(ri->offset), buf); 54 je32_to_cpu(ri->offset), buf);
54 if (crc != je32_to_cpu(ri->node_crc)) { 55 if (crc != je32_to_cpu(ri->node_crc)) {
55 printk(KERN_WARNING "Node CRC %08x != calculated CRC %08x for node at %08x\n", 56 pr_warn("Node CRC %08x != calculated CRC %08x for node at %08x\n",
56 je32_to_cpu(ri->node_crc), crc, ref_offset(fd->raw)); 57 je32_to_cpu(ri->node_crc), crc, ref_offset(fd->raw));
57 ret = -EIO; 58 ret = -EIO;
58 goto out_ri; 59 goto out_ri;
59 } 60 }
@@ -66,8 +67,8 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
66 } 67 }
67 68
68 D1(if(ofs + len > je32_to_cpu(ri->dsize)) { 69 D1(if(ofs + len > je32_to_cpu(ri->dsize)) {
69 printk(KERN_WARNING "jffs2_read_dnode() asked for %d bytes at %d from %d-byte node\n", 70 pr_warn("jffs2_read_dnode() asked for %d bytes at %d from %d-byte node\n",
70 len, ofs, je32_to_cpu(ri->dsize)); 71 len, ofs, je32_to_cpu(ri->dsize));
71 ret = -EINVAL; 72 ret = -EINVAL;
72 goto out_ri; 73 goto out_ri;
73 }); 74 });
@@ -119,8 +120,8 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
119 120
120 crc = crc32(0, readbuf, je32_to_cpu(ri->csize)); 121 crc = crc32(0, readbuf, je32_to_cpu(ri->csize));
121 if (crc != je32_to_cpu(ri->data_crc)) { 122 if (crc != je32_to_cpu(ri->data_crc)) {
122 printk(KERN_WARNING "Data CRC %08x != calculated CRC %08x for node at %08x\n", 123 pr_warn("Data CRC %08x != calculated CRC %08x for node at %08x\n",
123 je32_to_cpu(ri->data_crc), crc, ref_offset(fd->raw)); 124 je32_to_cpu(ri->data_crc), crc, ref_offset(fd->raw));
124 ret = -EIO; 125 ret = -EIO;
125 goto out_decomprbuf; 126 goto out_decomprbuf;
126 } 127 }
@@ -131,7 +132,7 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
131 je32_to_cpu(ri->dsize), decomprbuf); 132 je32_to_cpu(ri->dsize), decomprbuf);
132 ret = jffs2_decompress(c, f, ri->compr | (ri->usercompr << 8), readbuf, decomprbuf, je32_to_cpu(ri->csize), je32_to_cpu(ri->dsize)); 133 ret = jffs2_decompress(c, f, ri->compr | (ri->usercompr << 8), readbuf, decomprbuf, je32_to_cpu(ri->csize), je32_to_cpu(ri->dsize));
133 if (ret) { 134 if (ret) {
134 printk(KERN_WARNING "Error: jffs2_decompress returned %d\n", ret); 135 pr_warn("Error: jffs2_decompress returned %d\n", ret);
135 goto out_decomprbuf; 136 goto out_decomprbuf;
136 } 137 }
137 } 138 }
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index b6c3d883b7d7..078cede67141 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -22,15 +22,15 @@
22 22
23#define DEFAULT_EMPTY_SCAN_SIZE 256 23#define DEFAULT_EMPTY_SCAN_SIZE 256
24 24
25#define noisy_printk(noise, args...) do { \ 25#define noisy_printk(noise, fmt, ...) \
26 if (*(noise)) { \ 26do { \
27 printk(KERN_NOTICE args); \ 27 if (*(noise)) { \
28 (*(noise))--; \ 28 pr_notice(fmt, ##__VA_ARGS__); \
29 if (!(*(noise))) { \ 29 (*(noise))--; \
30 printk(KERN_NOTICE "Further such events for this erase block will not be printed\n"); \ 30 if (!(*(noise))) \
31 } \ 31 pr_notice("Further such events for this erase block will not be printed\n"); \
32 } \ 32 } \
33} while(0) 33} while (0)
34 34
35static uint32_t pseudo_random; 35static uint32_t pseudo_random;
36 36
@@ -233,7 +233,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
233 bad_blocks++; 233 bad_blocks++;
234 break; 234 break;
235 default: 235 default:
236 printk(KERN_WARNING "jffs2_scan_medium(): unknown block state\n"); 236 pr_warn("%s(): unknown block state\n", __func__);
237 BUG(); 237 BUG();
238 } 238 }
239 } 239 }
@@ -261,8 +261,9 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
261#endif 261#endif
262 if (c->nr_erasing_blocks) { 262 if (c->nr_erasing_blocks) {
263 if ( !c->used_size && ((c->nr_free_blocks+empty_blocks+bad_blocks)!= c->nr_blocks || bad_blocks == c->nr_blocks) ) { 263 if ( !c->used_size && ((c->nr_free_blocks+empty_blocks+bad_blocks)!= c->nr_blocks || bad_blocks == c->nr_blocks) ) {
264 printk(KERN_NOTICE "Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes\n"); 264 pr_notice("Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes\n");
265 printk(KERN_NOTICE "empty_blocks %d, bad_blocks %d, c->nr_blocks %d\n",empty_blocks,bad_blocks,c->nr_blocks); 265 pr_notice("empty_blocks %d, bad_blocks %d, c->nr_blocks %d\n",
266 empty_blocks, bad_blocks, c->nr_blocks);
266 ret = -EIO; 267 ret = -EIO;
267 goto out; 268 goto out;
268 } 269 }
@@ -611,12 +612,13 @@ scan_more:
611 cond_resched(); 612 cond_resched();
612 613
613 if (ofs & 3) { 614 if (ofs & 3) {
614 printk(KERN_WARNING "Eep. ofs 0x%08x not word-aligned!\n", ofs); 615 pr_warn("Eep. ofs 0x%08x not word-aligned!\n", ofs);
615 ofs = PAD(ofs); 616 ofs = PAD(ofs);
616 continue; 617 continue;
617 } 618 }
618 if (ofs == prevofs) { 619 if (ofs == prevofs) {
619 printk(KERN_WARNING "ofs 0x%08x has already been seen. Skipping\n", ofs); 620 pr_warn("ofs 0x%08x has already been seen. Skipping\n",
621 ofs);
620 if ((err = jffs2_scan_dirty_space(c, jeb, 4))) 622 if ((err = jffs2_scan_dirty_space(c, jeb, 4)))
621 return err; 623 return err;
622 ofs += 4; 624 ofs += 4;
@@ -660,8 +662,8 @@ scan_more:
660 inbuf_ofs = ofs - buf_ofs; 662 inbuf_ofs = ofs - buf_ofs;
661 while (inbuf_ofs < scan_end) { 663 while (inbuf_ofs < scan_end) {
662 if (unlikely(*(uint32_t *)(&buf[inbuf_ofs]) != 0xffffffff)) { 664 if (unlikely(*(uint32_t *)(&buf[inbuf_ofs]) != 0xffffffff)) {
663 printk(KERN_WARNING "Empty flash at 0x%08x ends at 0x%08x\n", 665 pr_warn("Empty flash at 0x%08x ends at 0x%08x\n",
664 empty_start, ofs); 666 empty_start, ofs);
665 if ((err = jffs2_scan_dirty_space(c, jeb, ofs-empty_start))) 667 if ((err = jffs2_scan_dirty_space(c, jeb, ofs-empty_start)))
666 return err; 668 return err;
667 goto scan_more; 669 goto scan_more;
@@ -708,7 +710,8 @@ scan_more:
708 } 710 }
709 711
710 if (ofs == jeb->offset && je16_to_cpu(node->magic) == KSAMTIB_CIGAM_2SFFJ) { 712 if (ofs == jeb->offset && je16_to_cpu(node->magic) == KSAMTIB_CIGAM_2SFFJ) {
711 printk(KERN_WARNING "Magic bitmask is backwards at offset 0x%08x. Wrong endian filesystem?\n", ofs); 713 pr_warn("Magic bitmask is backwards at offset 0x%08x. Wrong endian filesystem?\n",
714 ofs);
712 if ((err = jffs2_scan_dirty_space(c, jeb, 4))) 715 if ((err = jffs2_scan_dirty_space(c, jeb, 4)))
713 return err; 716 return err;
714 ofs += 4; 717 ofs += 4;
@@ -722,8 +725,8 @@ scan_more:
722 continue; 725 continue;
723 } 726 }
724 if (je16_to_cpu(node->magic) == JFFS2_OLD_MAGIC_BITMASK) { 727 if (je16_to_cpu(node->magic) == JFFS2_OLD_MAGIC_BITMASK) {
725 printk(KERN_WARNING "Old JFFS2 bitmask found at 0x%08x\n", ofs); 728 pr_warn("Old JFFS2 bitmask found at 0x%08x\n", ofs);
726 printk(KERN_WARNING "You cannot use older JFFS2 filesystems with newer kernels\n"); 729 pr_warn("You cannot use older JFFS2 filesystems with newer kernels\n");
727 if ((err = jffs2_scan_dirty_space(c, jeb, 4))) 730 if ((err = jffs2_scan_dirty_space(c, jeb, 4)))
728 return err; 731 return err;
729 ofs += 4; 732 ofs += 4;
@@ -731,7 +734,8 @@ scan_more:
731 } 734 }
732 if (je16_to_cpu(node->magic) != JFFS2_MAGIC_BITMASK) { 735 if (je16_to_cpu(node->magic) != JFFS2_MAGIC_BITMASK) {
733 /* OK. We're out of possibilities. Whinge and move on */ 736 /* OK. We're out of possibilities. Whinge and move on */
734 noisy_printk(&noise, "jffs2_scan_eraseblock(): Magic bitmask 0x%04x not found at 0x%08x: 0x%04x instead\n", 737 noisy_printk(&noise, "%s(): Magic bitmask 0x%04x not found at 0x%08x: 0x%04x instead\n",
738 __func__,
735 JFFS2_MAGIC_BITMASK, ofs, 739 JFFS2_MAGIC_BITMASK, ofs,
736 je16_to_cpu(node->magic)); 740 je16_to_cpu(node->magic));
737 if ((err = jffs2_scan_dirty_space(c, jeb, 4))) 741 if ((err = jffs2_scan_dirty_space(c, jeb, 4)))
@@ -746,7 +750,8 @@ scan_more:
746 hdr_crc = crc32(0, &crcnode, sizeof(crcnode)-4); 750 hdr_crc = crc32(0, &crcnode, sizeof(crcnode)-4);
747 751
748 if (hdr_crc != je32_to_cpu(node->hdr_crc)) { 752 if (hdr_crc != je32_to_cpu(node->hdr_crc)) {
749 noisy_printk(&noise, "jffs2_scan_eraseblock(): Node at 0x%08x {0x%04x, 0x%04x, 0x%08x) has invalid CRC 0x%08x (calculated 0x%08x)\n", 753 noisy_printk(&noise, "%s(): Node at 0x%08x {0x%04x, 0x%04x, 0x%08x) has invalid CRC 0x%08x (calculated 0x%08x)\n",
754 __func__,
750 ofs, je16_to_cpu(node->magic), 755 ofs, je16_to_cpu(node->magic),
751 je16_to_cpu(node->nodetype), 756 je16_to_cpu(node->nodetype),
752 je32_to_cpu(node->totlen), 757 je32_to_cpu(node->totlen),
@@ -760,9 +765,9 @@ scan_more:
760 765
761 if (ofs + je32_to_cpu(node->totlen) > jeb->offset + c->sector_size) { 766 if (ofs + je32_to_cpu(node->totlen) > jeb->offset + c->sector_size) {
762 /* Eep. Node goes over the end of the erase block. */ 767 /* Eep. Node goes over the end of the erase block. */
763 printk(KERN_WARNING "Node at 0x%08x with length 0x%08x would run over the end of the erase block\n", 768 pr_warn("Node at 0x%08x with length 0x%08x would run over the end of the erase block\n",
764 ofs, je32_to_cpu(node->totlen)); 769 ofs, je32_to_cpu(node->totlen));
765 printk(KERN_WARNING "Perhaps the file system was created with the wrong erase size?\n"); 770 pr_warn("Perhaps the file system was created with the wrong erase size?\n");
766 if ((err = jffs2_scan_dirty_space(c, jeb, 4))) 771 if ((err = jffs2_scan_dirty_space(c, jeb, 4)))
767 return err; 772 return err;
768 ofs += 4; 773 ofs += 4;
@@ -854,13 +859,15 @@ scan_more:
854 case JFFS2_NODETYPE_CLEANMARKER: 859 case JFFS2_NODETYPE_CLEANMARKER:
855 jffs2_dbg(1, "CLEANMARKER node found at 0x%08x\n", ofs); 860 jffs2_dbg(1, "CLEANMARKER node found at 0x%08x\n", ofs);
856 if (je32_to_cpu(node->totlen) != c->cleanmarker_size) { 861 if (je32_to_cpu(node->totlen) != c->cleanmarker_size) {
857 printk(KERN_NOTICE "CLEANMARKER node found at 0x%08x has totlen 0x%x != normal 0x%x\n", 862 pr_notice("CLEANMARKER node found at 0x%08x has totlen 0x%x != normal 0x%x\n",
858 ofs, je32_to_cpu(node->totlen), c->cleanmarker_size); 863 ofs, je32_to_cpu(node->totlen),
864 c->cleanmarker_size);
859 if ((err = jffs2_scan_dirty_space(c, jeb, PAD(sizeof(struct jffs2_unknown_node))))) 865 if ((err = jffs2_scan_dirty_space(c, jeb, PAD(sizeof(struct jffs2_unknown_node)))))
860 return err; 866 return err;
861 ofs += PAD(sizeof(struct jffs2_unknown_node)); 867 ofs += PAD(sizeof(struct jffs2_unknown_node));
862 } else if (jeb->first_node) { 868 } else if (jeb->first_node) {
863 printk(KERN_NOTICE "CLEANMARKER node found at 0x%08x, not first node in block (0x%08x)\n", ofs, jeb->offset); 869 pr_notice("CLEANMARKER node found at 0x%08x, not first node in block (0x%08x)\n",
870 ofs, jeb->offset);
864 if ((err = jffs2_scan_dirty_space(c, jeb, PAD(sizeof(struct jffs2_unknown_node))))) 871 if ((err = jffs2_scan_dirty_space(c, jeb, PAD(sizeof(struct jffs2_unknown_node)))))
865 return err; 872 return err;
866 ofs += PAD(sizeof(struct jffs2_unknown_node)); 873 ofs += PAD(sizeof(struct jffs2_unknown_node));
@@ -882,7 +889,8 @@ scan_more:
882 default: 889 default:
883 switch (je16_to_cpu(node->nodetype) & JFFS2_COMPAT_MASK) { 890 switch (je16_to_cpu(node->nodetype) & JFFS2_COMPAT_MASK) {
884 case JFFS2_FEATURE_ROCOMPAT: 891 case JFFS2_FEATURE_ROCOMPAT:
885 printk(KERN_NOTICE "Read-only compatible feature node (0x%04x) found at offset 0x%08x\n", je16_to_cpu(node->nodetype), ofs); 892 pr_notice("Read-only compatible feature node (0x%04x) found at offset 0x%08x\n",
893 je16_to_cpu(node->nodetype), ofs);
886 c->flags |= JFFS2_SB_FLAG_RO; 894 c->flags |= JFFS2_SB_FLAG_RO;
887 if (!(jffs2_is_readonly(c))) 895 if (!(jffs2_is_readonly(c)))
888 return -EROFS; 896 return -EROFS;
@@ -892,7 +900,8 @@ scan_more:
892 break; 900 break;
893 901
894 case JFFS2_FEATURE_INCOMPAT: 902 case JFFS2_FEATURE_INCOMPAT:
895 printk(KERN_NOTICE "Incompatible feature node (0x%04x) found at offset 0x%08x\n", je16_to_cpu(node->nodetype), ofs); 903 pr_notice("Incompatible feature node (0x%04x) found at offset 0x%08x\n",
904 je16_to_cpu(node->nodetype), ofs);
896 return -EINVAL; 905 return -EINVAL;
897 906
898 case JFFS2_FEATURE_RWCOMPAT_DELETE: 907 case JFFS2_FEATURE_RWCOMPAT_DELETE:
@@ -954,7 +963,7 @@ struct jffs2_inode_cache *jffs2_scan_make_ino_cache(struct jffs2_sb_info *c, uin
954 963
955 ic = jffs2_alloc_inode_cache(); 964 ic = jffs2_alloc_inode_cache();
956 if (!ic) { 965 if (!ic) {
957 printk(KERN_NOTICE "jffs2_scan_make_inode_cache(): allocation of inode cache failed\n"); 966 pr_notice("%s(): allocation of inode cache failed\n", __func__);
958 return NULL; 967 return NULL;
959 } 968 }
960 memset(ic, 0, sizeof(*ic)); 969 memset(ic, 0, sizeof(*ic));
@@ -987,9 +996,8 @@ static int jffs2_scan_inode_node(struct jffs2_sb_info *c, struct jffs2_erasebloc
987 /* Check the node CRC in any case. */ 996 /* Check the node CRC in any case. */
988 crc = crc32(0, ri, sizeof(*ri)-8); 997 crc = crc32(0, ri, sizeof(*ri)-8);
989 if (crc != je32_to_cpu(ri->node_crc)) { 998 if (crc != je32_to_cpu(ri->node_crc)) {
990 printk(KERN_NOTICE "jffs2_scan_inode_node(): CRC failed on " 999 pr_notice("%s(): CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
991 "node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", 1000 __func__, ofs, je32_to_cpu(ri->node_crc), crc);
992 ofs, je32_to_cpu(ri->node_crc), crc);
993 /* 1001 /*
994 * We believe totlen because the CRC on the node 1002 * We believe totlen because the CRC on the node
995 * _header_ was OK, just the node itself failed. 1003 * _header_ was OK, just the node itself failed.
@@ -1038,8 +1046,8 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
1038 crc = crc32(0, rd, sizeof(*rd)-8); 1046 crc = crc32(0, rd, sizeof(*rd)-8);
1039 1047
1040 if (crc != je32_to_cpu(rd->node_crc)) { 1048 if (crc != je32_to_cpu(rd->node_crc)) {
1041 printk(KERN_NOTICE "jffs2_scan_dirent_node(): Node CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", 1049 pr_notice("%s(): Node CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
1042 ofs, je32_to_cpu(rd->node_crc), crc); 1050 __func__, ofs, je32_to_cpu(rd->node_crc), crc);
1043 /* We believe totlen because the CRC on the node _header_ was OK, just the node itself failed. */ 1051 /* We believe totlen because the CRC on the node _header_ was OK, just the node itself failed. */
1044 if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(rd->totlen))))) 1052 if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(rd->totlen)))))
1045 return err; 1053 return err;
@@ -1051,7 +1059,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
1051 /* Should never happen. Did. (OLPC trac #4184)*/ 1059 /* Should never happen. Did. (OLPC trac #4184)*/
1052 checkedlen = strnlen(rd->name, rd->nsize); 1060 checkedlen = strnlen(rd->name, rd->nsize);
1053 if (checkedlen < rd->nsize) { 1061 if (checkedlen < rd->nsize) {
1054 printk(KERN_ERR "Dirent at %08x has zeroes in name. Truncating to %d chars\n", 1062 pr_err("Dirent at %08x has zeroes in name. Truncating to %d chars\n",
1055 ofs, checkedlen); 1063 ofs, checkedlen);
1056 } 1064 }
1057 fd = jffs2_alloc_full_dirent(checkedlen+1); 1065 fd = jffs2_alloc_full_dirent(checkedlen+1);
@@ -1063,8 +1071,8 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
1063 1071
1064 crc = crc32(0, fd->name, rd->nsize); 1072 crc = crc32(0, fd->name, rd->nsize);
1065 if (crc != je32_to_cpu(rd->name_crc)) { 1073 if (crc != je32_to_cpu(rd->name_crc)) {
1066 printk(KERN_NOTICE "jffs2_scan_dirent_node(): Name CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", 1074 pr_notice("%s(): Name CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
1067 ofs, je32_to_cpu(rd->name_crc), crc); 1075 __func__, ofs, je32_to_cpu(rd->name_crc), crc);
1068 jffs2_dbg(1, "Name for which CRC failed is (now) '%s', ino #%d\n", 1076 jffs2_dbg(1, "Name for which CRC failed is (now) '%s', ino #%d\n",
1069 fd->name, je32_to_cpu(rd->ino)); 1077 fd->name, je32_to_cpu(rd->ino));
1070 jffs2_free_full_dirent(fd); 1078 jffs2_free_full_dirent(fd);
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c
index e537fb0e0184..0789e4e3a061 100644
--- a/fs/jffs2/summary.c
+++ b/fs/jffs2/summary.c
@@ -442,13 +442,16 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
442 /* This should never happen, but https://dev.laptop.org/ticket/4184 */ 442 /* This should never happen, but https://dev.laptop.org/ticket/4184 */
443 checkedlen = strnlen(spd->name, spd->nsize); 443 checkedlen = strnlen(spd->name, spd->nsize);
444 if (!checkedlen) { 444 if (!checkedlen) {
445 printk(KERN_ERR "Dirent at %08x has zero at start of name. Aborting mount.\n", 445 pr_err("Dirent at %08x has zero at start of name. Aborting mount.\n",
446 jeb->offset + je32_to_cpu(spd->offset)); 446 jeb->offset +
447 je32_to_cpu(spd->offset));
447 return -EIO; 448 return -EIO;
448 } 449 }
449 if (checkedlen < spd->nsize) { 450 if (checkedlen < spd->nsize) {
450 printk(KERN_ERR "Dirent at %08x has zeroes in name. Truncating to %d chars\n", 451 pr_err("Dirent at %08x has zeroes in name. Truncating to %d chars\n",
451 jeb->offset + je32_to_cpu(spd->offset), checkedlen); 452 jeb->offset +
453 je32_to_cpu(spd->offset),
454 checkedlen);
452 } 455 }
453 456
454 457
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 3600e3e508e5..9e3ba7f0a893 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -214,8 +214,8 @@ static int jffs2_parse_options(struct jffs2_sb_info *c, char *data)
214 JFFS2_COMPR_MODE_FORCEZLIB; 214 JFFS2_COMPR_MODE_FORCEZLIB;
215#endif 215#endif
216 else { 216 else {
217 printk(KERN_ERR "JFFS2 Error: unknown compressor \"%s\"", 217 pr_err("JFFS2 Error: unknown compressor \"%s\"",
218 name); 218 name);
219 kfree(name); 219 kfree(name);
220 return -EINVAL; 220 return -EINVAL;
221 } 221 }
@@ -223,8 +223,8 @@ static int jffs2_parse_options(struct jffs2_sb_info *c, char *data)
223 c->mount_opts.override_compr = true; 223 c->mount_opts.override_compr = true;
224 break; 224 break;
225 default: 225 default:
226 printk(KERN_ERR "JFFS2 Error: unrecognized mount option '%s' or missing value\n", 226 pr_err("JFFS2 Error: unrecognized mount option '%s' or missing value\n",
227 p); 227 p);
228 return -EINVAL; 228 return -EINVAL;
229 } 229 }
230 } 230 }
@@ -371,7 +371,7 @@ static int __init init_jffs2_fs(void)
371 BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68); 371 BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68);
372 BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32); 372 BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32);
373 373
374 printk(KERN_INFO "JFFS2 version 2.2." 374 pr_info("JFFS2 version 2.2."
375#ifdef CONFIG_JFFS2_FS_WRITEBUFFER 375#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
376 " (NAND)" 376 " (NAND)"
377#endif 377#endif
@@ -386,22 +386,22 @@ static int __init init_jffs2_fs(void)
386 SLAB_MEM_SPREAD), 386 SLAB_MEM_SPREAD),
387 jffs2_i_init_once); 387 jffs2_i_init_once);
388 if (!jffs2_inode_cachep) { 388 if (!jffs2_inode_cachep) {
389 printk(KERN_ERR "JFFS2 error: Failed to initialise inode cache\n"); 389 pr_err("JFFS2 error: Failed to initialise inode cache\n");
390 return -ENOMEM; 390 return -ENOMEM;
391 } 391 }
392 ret = jffs2_compressors_init(); 392 ret = jffs2_compressors_init();
393 if (ret) { 393 if (ret) {
394 printk(KERN_ERR "JFFS2 error: Failed to initialise compressors\n"); 394 pr_err("JFFS2 error: Failed to initialise compressors\n");
395 goto out; 395 goto out;
396 } 396 }
397 ret = jffs2_create_slab_caches(); 397 ret = jffs2_create_slab_caches();
398 if (ret) { 398 if (ret) {
399 printk(KERN_ERR "JFFS2 error: Failed to initialise slab caches\n"); 399 pr_err("JFFS2 error: Failed to initialise slab caches\n");
400 goto out_compressors; 400 goto out_compressors;
401 } 401 }
402 ret = register_filesystem(&jffs2_fs_type); 402 ret = register_filesystem(&jffs2_fs_type);
403 if (ret) { 403 if (ret) {
404 printk(KERN_ERR "JFFS2 error: Failed to register filesystem\n"); 404 pr_err("JFFS2 error: Failed to register filesystem\n");
405 goto out_slab; 405 goto out_slab;
406 } 406 }
407 return 0; 407 return 0;
diff --git a/fs/jffs2/symlink.c b/fs/jffs2/symlink.c
index 5188f4d39a5c..56eeed5269c8 100644
--- a/fs/jffs2/symlink.c
+++ b/fs/jffs2/symlink.c
@@ -47,7 +47,7 @@ static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd)
47 */ 47 */
48 48
49 if (!p) { 49 if (!p) {
50 printk(KERN_ERR "jffs2_follow_link(): can't find symlink target\n"); 50 pr_err("%s(): can't find symlink target\n", __func__);
51 p = ERR_PTR(-EIO); 51 p = ERR_PTR(-EIO);
52 } 52 }
53 jffs2_dbg(1, "%s(): target path is '%s'\n", 53 jffs2_dbg(1, "%s(): target path is '%s'\n",
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index d626eb2113e1..89a6ec0fa766 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -233,10 +233,12 @@ static int jffs2_verify_write(struct jffs2_sb_info *c, unsigned char *buf,
233 233
234 ret = mtd_read(c->mtd, ofs, c->wbuf_pagesize, &retlen, c->wbuf_verify); 234 ret = mtd_read(c->mtd, ofs, c->wbuf_pagesize, &retlen, c->wbuf_verify);
235 if (ret && ret != -EUCLEAN && ret != -EBADMSG) { 235 if (ret && ret != -EUCLEAN && ret != -EBADMSG) {
236 printk(KERN_WARNING "jffs2_verify_write(): Read back of page at %08x failed: %d\n", c->wbuf_ofs, ret); 236 pr_warn("%s(): Read back of page at %08x failed: %d\n",
237 __func__, c->wbuf_ofs, ret);
237 return ret; 238 return ret;
238 } else if (retlen != c->wbuf_pagesize) { 239 } else if (retlen != c->wbuf_pagesize) {
239 printk(KERN_WARNING "jffs2_verify_write(): Read back of page at %08x gave short read: %zd not %d.\n", ofs, retlen, c->wbuf_pagesize); 240 pr_warn("%s(): Read back of page at %08x gave short read: %zd not %d\n",
241 __func__, ofs, retlen, c->wbuf_pagesize);
240 return -EIO; 242 return -EIO;
241 } 243 }
242 if (!memcmp(buf, c->wbuf_verify, c->wbuf_pagesize)) 244 if (!memcmp(buf, c->wbuf_verify, c->wbuf_pagesize))
@@ -249,12 +251,12 @@ static int jffs2_verify_write(struct jffs2_sb_info *c, unsigned char *buf,
249 else 251 else
250 eccstr = "OK or unused"; 252 eccstr = "OK or unused";
251 253
252 printk(KERN_WARNING "Write verify error (ECC %s) at %08x. Wrote:\n", 254 pr_warn("Write verify error (ECC %s) at %08x. Wrote:\n",
253 eccstr, c->wbuf_ofs); 255 eccstr, c->wbuf_ofs);
254 print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1, 256 print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1,
255 c->wbuf, c->wbuf_pagesize, 0); 257 c->wbuf, c->wbuf_pagesize, 0);
256 258
257 printk(KERN_WARNING "Read back:\n"); 259 pr_warn("Read back:\n");
258 print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1, 260 print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1,
259 c->wbuf_verify, c->wbuf_pagesize, 0); 261 c->wbuf_verify, c->wbuf_pagesize, 0);
260 262
@@ -334,7 +336,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
334 336
335 buf = kmalloc(end - start, GFP_KERNEL); 337 buf = kmalloc(end - start, GFP_KERNEL);
336 if (!buf) { 338 if (!buf) {
337 printk(KERN_CRIT "Malloc failure in wbuf recovery. Data loss ensues.\n"); 339 pr_crit("Malloc failure in wbuf recovery. Data loss ensues.\n");
338 340
339 goto read_failed; 341 goto read_failed;
340 } 342 }
@@ -349,7 +351,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
349 ret = 0; 351 ret = 0;
350 352
351 if (ret || retlen != c->wbuf_ofs - start) { 353 if (ret || retlen != c->wbuf_ofs - start) {
352 printk(KERN_CRIT "Old data are already lost in wbuf recovery. Data loss ensues.\n"); 354 pr_crit("Old data are already lost in wbuf recovery. Data loss ensues.\n");
353 355
354 kfree(buf); 356 kfree(buf);
355 buf = NULL; 357 buf = NULL;
@@ -383,7 +385,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
383 /* ... and get an allocation of space from a shiny new block instead */ 385 /* ... and get an allocation of space from a shiny new block instead */
384 ret = jffs2_reserve_space_gc(c, end-start, &len, JFFS2_SUMMARY_NOSUM_SIZE); 386 ret = jffs2_reserve_space_gc(c, end-start, &len, JFFS2_SUMMARY_NOSUM_SIZE);
385 if (ret) { 387 if (ret) {
386 printk(KERN_WARNING "Failed to allocate space for wbuf recovery. Data loss ensues.\n"); 388 pr_warn("Failed to allocate space for wbuf recovery. Data loss ensues.\n");
387 kfree(buf); 389 kfree(buf);
388 return; 390 return;
389 } 391 }
@@ -393,7 +395,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
393 395
394 ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, nr_refile); 396 ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, nr_refile);
395 if (ret) { 397 if (ret) {
396 printk(KERN_WARNING "Failed to allocate node refs for wbuf recovery. Data loss ensues.\n"); 398 pr_warn("Failed to allocate node refs for wbuf recovery. Data loss ensues.\n");
397 kfree(buf); 399 kfree(buf);
398 return; 400 return;
399 } 401 }
@@ -415,7 +417,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
415#ifdef BREAKMEHEADER 417#ifdef BREAKMEHEADER
416 static int breakme; 418 static int breakme;
417 if (breakme++ == 20) { 419 if (breakme++ == 20) {
418 printk(KERN_NOTICE "Faking write error at 0x%08x\n", ofs); 420 pr_notice("Faking write error at 0x%08x\n", ofs);
419 breakme = 0; 421 breakme = 0;
420 mtd_write(c->mtd, ofs, towrite, &retlen, brokenbuf); 422 mtd_write(c->mtd, ofs, towrite, &retlen, brokenbuf);
421 ret = -EIO; 423 ret = -EIO;
@@ -426,7 +428,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
426 428
427 if (ret || retlen != towrite || jffs2_verify_write(c, rewrite_buf, ofs)) { 429 if (ret || retlen != towrite || jffs2_verify_write(c, rewrite_buf, ofs)) {
428 /* Argh. We tried. Really we did. */ 430 /* Argh. We tried. Really we did. */
429 printk(KERN_CRIT "Recovery of wbuf failed due to a second write error\n"); 431 pr_crit("Recovery of wbuf failed due to a second write error\n");
430 kfree(buf); 432 kfree(buf);
431 433
432 if (retlen) 434 if (retlen)
@@ -434,7 +436,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
434 436
435 return; 437 return;
436 } 438 }
437 printk(KERN_NOTICE "Recovery of wbuf succeeded to %08x\n", ofs); 439 pr_notice("Recovery of wbuf succeeded to %08x\n", ofs);
438 440
439 c->wbuf_len = (end - start) - towrite; 441 c->wbuf_len = (end - start) - towrite;
440 c->wbuf_ofs = ofs + towrite; 442 c->wbuf_ofs = ofs + towrite;
@@ -584,7 +586,7 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
584 return 0; 586 return 0;
585 587
586 if (!mutex_is_locked(&c->alloc_sem)) { 588 if (!mutex_is_locked(&c->alloc_sem)) {
587 printk(KERN_CRIT "jffs2_flush_wbuf() called with alloc_sem not locked!\n"); 589 pr_crit("jffs2_flush_wbuf() called with alloc_sem not locked!\n");
588 BUG(); 590 BUG();
589 } 591 }
590 592
@@ -622,7 +624,7 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
622#ifdef BREAKME 624#ifdef BREAKME
623 static int breakme; 625 static int breakme;
624 if (breakme++ == 20) { 626 if (breakme++ == 20) {
625 printk(KERN_NOTICE "Faking write error at 0x%08x\n", c->wbuf_ofs); 627 pr_notice("Faking write error at 0x%08x\n", c->wbuf_ofs);
626 breakme = 0; 628 breakme = 0;
627 mtd_write(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen, 629 mtd_write(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen,
628 brokenbuf); 630 brokenbuf);
@@ -634,11 +636,11 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
634 &retlen, c->wbuf); 636 &retlen, c->wbuf);
635 637
636 if (ret) { 638 if (ret) {
637 printk(KERN_WARNING "jffs2_flush_wbuf(): Write failed with %d\n", ret); 639 pr_warn("jffs2_flush_wbuf(): Write failed with %d\n", ret);
638 goto wfail; 640 goto wfail;
639 } else if (retlen != c->wbuf_pagesize) { 641 } else if (retlen != c->wbuf_pagesize) {
640 printk(KERN_WARNING "jffs2_flush_wbuf(): Write was short: %zd instead of %d\n", 642 pr_warn("jffs2_flush_wbuf(): Write was short: %zd instead of %d\n",
641 retlen, c->wbuf_pagesize); 643 retlen, c->wbuf_pagesize);
642 ret = -EIO; 644 ret = -EIO;
643 goto wfail; 645 goto wfail;
644 } else if ((ret = jffs2_verify_write(c, c->wbuf, c->wbuf_ofs))) { 646 } else if ((ret = jffs2_verify_write(c, c->wbuf, c->wbuf_ofs))) {
@@ -660,10 +662,10 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
660 padded. If there is less free space in the block than that, 662 padded. If there is less free space in the block than that,
661 something screwed up */ 663 something screwed up */
662 if (wbuf_jeb->free_size < waste) { 664 if (wbuf_jeb->free_size < waste) {
663 printk(KERN_CRIT "jffs2_flush_wbuf(): Accounting error. wbuf at 0x%08x has 0x%03x bytes, 0x%03x left.\n", 665 pr_crit("jffs2_flush_wbuf(): Accounting error. wbuf at 0x%08x has 0x%03x bytes, 0x%03x left.\n",
664 c->wbuf_ofs, c->wbuf_len, waste); 666 c->wbuf_ofs, c->wbuf_len, waste);
665 printk(KERN_CRIT "jffs2_flush_wbuf(): But free_size for block at 0x%08x is only 0x%08x\n", 667 pr_crit("jffs2_flush_wbuf(): But free_size for block at 0x%08x is only 0x%08x\n",
666 wbuf_jeb->offset, wbuf_jeb->free_size); 668 wbuf_jeb->offset, wbuf_jeb->free_size);
667 BUG(); 669 BUG();
668 } 670 }
669 671
@@ -831,11 +833,11 @@ int jffs2_flash_writev(struct jffs2_sb_info *c, const struct kvec *invecs,
831 833
832 if (to != PAD(c->wbuf_ofs + c->wbuf_len)) { 834 if (to != PAD(c->wbuf_ofs + c->wbuf_len)) {
833 /* We're not writing immediately after the writebuffer. Bad. */ 835 /* We're not writing immediately after the writebuffer. Bad. */
834 printk(KERN_CRIT "%s(): Non-contiguous write to %08lx\n", 836 pr_crit("%s(): Non-contiguous write to %08lx\n",
835 __func__, (unsigned long)to); 837 __func__, (unsigned long)to);
836 if (c->wbuf_len) 838 if (c->wbuf_len)
837 printk(KERN_CRIT "wbuf was previously %08x-%08x\n", 839 pr_crit("wbuf was previously %08x-%08x\n",
838 c->wbuf_ofs, c->wbuf_ofs+c->wbuf_len); 840 c->wbuf_ofs, c->wbuf_ofs + c->wbuf_len);
839 BUG(); 841 BUG();
840 } 842 }
841 843
@@ -963,8 +965,8 @@ int jffs2_flash_read(struct jffs2_sb_info *c, loff_t ofs, size_t len, size_t *re
963 965
964 if ( (ret == -EBADMSG || ret == -EUCLEAN) && (*retlen == len) ) { 966 if ( (ret == -EBADMSG || ret == -EUCLEAN) && (*retlen == len) ) {
965 if (ret == -EBADMSG) 967 if (ret == -EBADMSG)
966 printk(KERN_WARNING "mtd->read(0x%zx bytes from 0x%llx)" 968 pr_warn("mtd->read(0x%zx bytes from 0x%llx) returned ECC error\n",
967 " returned ECC error\n", len, ofs); 969 len, ofs);
968 /* 970 /*
969 * We have the raw data without ECC correction in the buffer, 971 * We have the raw data without ECC correction in the buffer,
970 * maybe we are lucky and all data or parts are correct. We 972 * maybe we are lucky and all data or parts are correct. We
@@ -1040,9 +1042,8 @@ int jffs2_check_oob_empty(struct jffs2_sb_info *c,
1040 1042
1041 ret = mtd_read_oob(c->mtd, jeb->offset, &ops); 1043 ret = mtd_read_oob(c->mtd, jeb->offset, &ops);
1042 if (ret || ops.oobretlen != ops.ooblen) { 1044 if (ret || ops.oobretlen != ops.ooblen) {
1043 printk(KERN_ERR "cannot read OOB for EB at %08x, requested %zd" 1045 pr_err("cannot read OOB for EB at %08x, requested %zd bytes, read %zd bytes, error %d\n",
1044 " bytes, read %zd bytes, error %d\n", 1046 jeb->offset, ops.ooblen, ops.oobretlen, ret);
1045 jeb->offset, ops.ooblen, ops.oobretlen, ret);
1046 if (!ret) 1047 if (!ret)
1047 ret = -EIO; 1048 ret = -EIO;
1048 return ret; 1049 return ret;
@@ -1083,9 +1084,8 @@ int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c,
1083 1084
1084 ret = mtd_read_oob(c->mtd, jeb->offset, &ops); 1085 ret = mtd_read_oob(c->mtd, jeb->offset, &ops);
1085 if (ret || ops.oobretlen != ops.ooblen) { 1086 if (ret || ops.oobretlen != ops.ooblen) {
1086 printk(KERN_ERR "cannot read OOB for EB at %08x, requested %zd" 1087 pr_err("cannot read OOB for EB at %08x, requested %zd bytes, read %zd bytes, error %d\n",
1087 " bytes, read %zd bytes, error %d\n", 1088 jeb->offset, ops.ooblen, ops.oobretlen, ret);
1088 jeb->offset, ops.ooblen, ops.oobretlen, ret);
1089 if (!ret) 1089 if (!ret)
1090 ret = -EIO; 1090 ret = -EIO;
1091 return ret; 1091 return ret;
@@ -1109,9 +1109,8 @@ int jffs2_write_nand_cleanmarker(struct jffs2_sb_info *c,
1109 1109
1110 ret = mtd_write_oob(c->mtd, jeb->offset, &ops); 1110 ret = mtd_write_oob(c->mtd, jeb->offset, &ops);
1111 if (ret || ops.oobretlen != ops.ooblen) { 1111 if (ret || ops.oobretlen != ops.ooblen) {
1112 printk(KERN_ERR "cannot write OOB for EB at %08x, requested %zd" 1112 pr_err("cannot write OOB for EB at %08x, requested %zd bytes, read %zd bytes, error %d\n",
1113 " bytes, read %zd bytes, error %d\n", 1113 jeb->offset, ops.ooblen, ops.oobretlen, ret);
1114 jeb->offset, ops.ooblen, ops.oobretlen, ret);
1115 if (!ret) 1114 if (!ret)
1116 ret = -EIO; 1115 ret = -EIO;
1117 return ret; 1116 return ret;
@@ -1136,7 +1135,7 @@ int jffs2_write_nand_badblock(struct jffs2_sb_info *c, struct jffs2_eraseblock *
1136 if( ++jeb->bad_count < MAX_ERASE_FAILURES) 1135 if( ++jeb->bad_count < MAX_ERASE_FAILURES)
1137 return 0; 1136 return 0;
1138 1137
1139 printk(KERN_WARNING "JFFS2: marking eraseblock at %08x\n as bad", bad_offset); 1138 pr_warn("JFFS2: marking eraseblock at %08x as bad\n", bad_offset);
1140 ret = mtd_block_markbad(c->mtd, bad_offset); 1139 ret = mtd_block_markbad(c->mtd, bad_offset);
1141 1140
1142 if (ret) { 1141 if (ret) {
@@ -1158,7 +1157,7 @@ int jffs2_nand_flash_setup(struct jffs2_sb_info *c)
1158 c->cleanmarker_size = 0; 1157 c->cleanmarker_size = 0;
1159 1158
1160 if (!oinfo || oinfo->oobavail == 0) { 1159 if (!oinfo || oinfo->oobavail == 0) {
1161 printk(KERN_ERR "inconsistent device description\n"); 1160 pr_err("inconsistent device description\n");
1162 return -EINVAL; 1161 return -EINVAL;
1163 } 1162 }
1164 1163
@@ -1229,7 +1228,7 @@ int jffs2_dataflash_setup(struct jffs2_sb_info *c) {
1229 1228
1230 if ((c->flash_size % c->sector_size) != 0) { 1229 if ((c->flash_size % c->sector_size) != 0) {
1231 c->flash_size = (c->flash_size / c->sector_size) * c->sector_size; 1230 c->flash_size = (c->flash_size / c->sector_size) * c->sector_size;
1232 printk(KERN_WARNING "JFFS2 flash size adjusted to %dKiB\n", c->flash_size); 1231 pr_warn("JFFS2 flash size adjusted to %dKiB\n", c->flash_size);
1233 }; 1232 };
1234 1233
1235 c->wbuf_ofs = 0xFFFFFFFF; 1234 c->wbuf_ofs = 0xFFFFFFFF;
@@ -1246,7 +1245,8 @@ int jffs2_dataflash_setup(struct jffs2_sb_info *c) {
1246 } 1245 }
1247#endif 1246#endif
1248 1247
1249 printk(KERN_INFO "JFFS2 write-buffering enabled buffer (%d) erasesize (%d)\n", c->wbuf_pagesize, c->sector_size); 1248 pr_info("JFFS2 write-buffering enabled buffer (%d) erasesize (%d)\n",
1249 c->wbuf_pagesize, c->sector_size);
1250 1250
1251 return 0; 1251 return 0;
1252} 1252}
@@ -1304,7 +1304,8 @@ int jffs2_ubivol_setup(struct jffs2_sb_info *c) {
1304 if (!c->wbuf) 1304 if (!c->wbuf)
1305 return -ENOMEM; 1305 return -ENOMEM;
1306 1306
1307 printk(KERN_INFO "JFFS2 write-buffering enabled buffer (%d) erasesize (%d)\n", c->wbuf_pagesize, c->sector_size); 1307 pr_info("JFFS2 write-buffering enabled buffer (%d) erasesize (%d)\n",
1308 c->wbuf_pagesize, c->sector_size);
1308 1309
1309 return 0; 1310 return 0;
1310} 1311}
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c
index e137839a157d..d98b22036738 100644
--- a/fs/jffs2/write.c
+++ b/fs/jffs2/write.c
@@ -68,7 +68,7 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
68 unsigned long cnt = 2; 68 unsigned long cnt = 2;
69 69
70 D1(if(je32_to_cpu(ri->hdr_crc) != crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)) { 70 D1(if(je32_to_cpu(ri->hdr_crc) != crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)) {
71 printk(KERN_CRIT "Eep. CRC not correct in jffs2_write_dnode()\n"); 71 pr_crit("Eep. CRC not correct in jffs2_write_dnode()\n");
72 BUG(); 72 BUG();
73 } 73 }
74 ); 74 );
@@ -78,7 +78,9 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
78 vecs[1].iov_len = datalen; 78 vecs[1].iov_len = datalen;
79 79
80 if (je32_to_cpu(ri->totlen) != sizeof(*ri) + datalen) { 80 if (je32_to_cpu(ri->totlen) != sizeof(*ri) + datalen) {
81 printk(KERN_WARNING "jffs2_write_dnode: ri->totlen (0x%08x) != sizeof(*ri) (0x%08zx) + datalen (0x%08x)\n", je32_to_cpu(ri->totlen), sizeof(*ri), datalen); 81 pr_warn("%s(): ri->totlen (0x%08x) != sizeof(*ri) (0x%08zx) + datalen (0x%08x)\n",
82 __func__, je32_to_cpu(ri->totlen),
83 sizeof(*ri), datalen);
82 } 84 }
83 85
84 fn = jffs2_alloc_full_dnode(); 86 fn = jffs2_alloc_full_dnode();
@@ -106,8 +108,8 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
106 (alloc_mode==ALLOC_GC)?0:f->inocache->ino); 108 (alloc_mode==ALLOC_GC)?0:f->inocache->ino);
107 109
108 if (ret || (retlen != sizeof(*ri) + datalen)) { 110 if (ret || (retlen != sizeof(*ri) + datalen)) {
109 printk(KERN_NOTICE "Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n", 111 pr_notice("Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n",
110 sizeof(*ri)+datalen, flash_ofs, ret, retlen); 112 sizeof(*ri) + datalen, flash_ofs, ret, retlen);
111 113
112 /* Mark the space as dirtied */ 114 /* Mark the space as dirtied */
113 if (retlen) { 115 if (retlen) {
@@ -118,7 +120,8 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
118 this node */ 120 this node */
119 jffs2_add_physical_node_ref(c, flash_ofs | REF_OBSOLETE, PAD(sizeof(*ri)+datalen), NULL); 121 jffs2_add_physical_node_ref(c, flash_ofs | REF_OBSOLETE, PAD(sizeof(*ri)+datalen), NULL);
120 } else { 122 } else {
121 printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", flash_ofs); 123 pr_notice("Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n",
124 flash_ofs);
122 } 125 }
123 if (!retried && alloc_mode != ALLOC_NORETRY) { 126 if (!retried && alloc_mode != ALLOC_NORETRY) {
124 /* Try to reallocate space and retry */ 127 /* Try to reallocate space and retry */
@@ -214,17 +217,17 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
214 je32_to_cpu(rd->name_crc)); 217 je32_to_cpu(rd->name_crc));
215 218
216 D1(if(je32_to_cpu(rd->hdr_crc) != crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)) { 219 D1(if(je32_to_cpu(rd->hdr_crc) != crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)) {
217 printk(KERN_CRIT "Eep. CRC not correct in jffs2_write_dirent()\n"); 220 pr_crit("Eep. CRC not correct in jffs2_write_dirent()\n");
218 BUG(); 221 BUG();
219 }); 222 });
220 223
221 if (strnlen(name, namelen) != namelen) { 224 if (strnlen(name, namelen) != namelen) {
222 /* This should never happen, but seems to have done on at least one 225 /* This should never happen, but seems to have done on at least one
223 occasion: https://dev.laptop.org/ticket/4184 */ 226 occasion: https://dev.laptop.org/ticket/4184 */
224 printk(KERN_CRIT "Error in jffs2_write_dirent() -- name contains zero bytes!\n"); 227 pr_crit("Error in jffs2_write_dirent() -- name contains zero bytes!\n");
225 printk(KERN_CRIT "Directory inode #%u, name at *0x%p \"%s\"->ino #%u, name_crc 0x%08x\n", 228 pr_crit("Directory inode #%u, name at *0x%p \"%s\"->ino #%u, name_crc 0x%08x\n",
226 je32_to_cpu(rd->pino), name, name, je32_to_cpu(rd->ino), 229 je32_to_cpu(rd->pino), name, name, je32_to_cpu(rd->ino),
227 je32_to_cpu(rd->name_crc)); 230 je32_to_cpu(rd->name_crc));
228 WARN_ON(1); 231 WARN_ON(1);
229 return ERR_PTR(-EIO); 232 return ERR_PTR(-EIO);
230 } 233 }
@@ -263,13 +266,14 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
263 ret = jffs2_flash_writev(c, vecs, 2, flash_ofs, &retlen, 266 ret = jffs2_flash_writev(c, vecs, 2, flash_ofs, &retlen,
264 (alloc_mode==ALLOC_GC)?0:je32_to_cpu(rd->pino)); 267 (alloc_mode==ALLOC_GC)?0:je32_to_cpu(rd->pino));
265 if (ret || (retlen != sizeof(*rd) + namelen)) { 268 if (ret || (retlen != sizeof(*rd) + namelen)) {
266 printk(KERN_NOTICE "Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n", 269 pr_notice("Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n",
267 sizeof(*rd)+namelen, flash_ofs, ret, retlen); 270 sizeof(*rd) + namelen, flash_ofs, ret, retlen);
268 /* Mark the space as dirtied */ 271 /* Mark the space as dirtied */
269 if (retlen) { 272 if (retlen) {
270 jffs2_add_physical_node_ref(c, flash_ofs | REF_OBSOLETE, PAD(sizeof(*rd)+namelen), NULL); 273 jffs2_add_physical_node_ref(c, flash_ofs | REF_OBSOLETE, PAD(sizeof(*rd)+namelen), NULL);
271 } else { 274 } else {
272 printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", flash_ofs); 275 pr_notice("Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n",
276 flash_ofs);
273 } 277 }
274 if (!retried) { 278 if (!retried) {
275 /* Try to reallocate space and retry */ 279 /* Try to reallocate space and retry */
@@ -417,7 +421,7 @@ int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
417 mutex_unlock(&f->sem); 421 mutex_unlock(&f->sem);
418 jffs2_complete_reservation(c); 422 jffs2_complete_reservation(c);
419 if (!datalen) { 423 if (!datalen) {
420 printk(KERN_WARNING "Eep. We didn't actually write any data in jffs2_write_inode_range()\n"); 424 pr_warn("Eep. We didn't actually write any data in jffs2_write_inode_range()\n");
421 ret = -EIO; 425 ret = -EIO;
422 break; 426 break;
423 } 427 }
@@ -634,8 +638,9 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f,
634 dead_f->dents = fd->next; 638 dead_f->dents = fd->next;
635 639
636 if (fd->ino) { 640 if (fd->ino) {
637 printk(KERN_WARNING "Deleting inode #%u with active dentry \"%s\"->ino #%u\n", 641 pr_warn("Deleting inode #%u with active dentry \"%s\"->ino #%u\n",
638 dead_f->inocache->ino, fd->name, fd->ino); 642 dead_f->inocache->ino,
643 fd->name, fd->ino);
639 } else { 644 } else {
640 jffs2_dbg(1, "Removing deletion dirent for \"%s\" from dir ino #%u\n", 645 jffs2_dbg(1, "Removing deletion dirent for \"%s\" from dir ino #%u\n",
641 fd->name, 646 fd->name,