aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/nodemgmt.c
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 /fs/jffs2/nodemgmt.c
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>
Diffstat (limited to 'fs/jffs2/nodemgmt.c')
-rw-r--r--fs/jffs2/nodemgmt.c51
1 files changed, 32 insertions, 19 deletions
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