diff options
Diffstat (limited to 'fs/jffs2/gc.c')
-rw-r--r-- | fs/jffs2/gc.c | 158 |
1 files changed, 89 insertions, 69 deletions
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 | } |