diff options
Diffstat (limited to 'fs/jffs2/gc.c')
-rw-r--r-- | fs/jffs2/gc.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c index 153755bc1d53..f9e982a65ac2 100644 --- a/fs/jffs2/gc.c +++ b/fs/jffs2/gc.c | |||
@@ -545,7 +545,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c, | |||
545 | if (ic && alloclen > sizeof(struct jffs2_raw_inode) + JFFS2_MIN_DATA_LEN) | 545 | if (ic && alloclen > sizeof(struct jffs2_raw_inode) + JFFS2_MIN_DATA_LEN) |
546 | alloclen = sizeof(struct jffs2_raw_inode) + JFFS2_MIN_DATA_LEN; | 546 | alloclen = sizeof(struct jffs2_raw_inode) + JFFS2_MIN_DATA_LEN; |
547 | 547 | ||
548 | ret = jffs2_reserve_space_gc(c, alloclen, &phys_ofs, &alloclen, rawlen); | 548 | ret = jffs2_reserve_space_gc(c, alloclen, &alloclen, rawlen); |
549 | /* 'rawlen' is not the exact summary size; it is only an upper estimation */ | 549 | /* 'rawlen' is not the exact summary size; it is only an upper estimation */ |
550 | 550 | ||
551 | if (ret) | 551 | if (ret) |
@@ -626,13 +626,13 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c, | |||
626 | 626 | ||
627 | /* OK, all the CRCs are good; this node can just be copied as-is. */ | 627 | /* OK, all the CRCs are good; this node can just be copied as-is. */ |
628 | retry: | 628 | retry: |
629 | nraw->flash_offset = phys_ofs; | 629 | nraw->flash_offset = phys_ofs = write_ofs(c); |
630 | 630 | ||
631 | ret = jffs2_flash_write(c, phys_ofs, rawlen, &retlen, (char *)node); | 631 | ret = jffs2_flash_write(c, phys_ofs, rawlen, &retlen, (char *)node); |
632 | 632 | ||
633 | if (ret || (retlen != rawlen)) { | 633 | if (ret || (retlen != rawlen)) { |
634 | printk(KERN_NOTICE "Write of %d bytes at 0x%08x failed. returned %d, retlen %zd\n", | 634 | printk(KERN_NOTICE "Write of %d bytes at 0x%08x failed. returned %d, retlen %zd\n", |
635 | rawlen, phys_ofs, ret, retlen); | 635 | rawlen, nraw->flash_offset, ret, retlen); |
636 | if (retlen) { | 636 | if (retlen) { |
637 | nraw->flash_offset |= REF_OBSOLETE; | 637 | nraw->flash_offset |= REF_OBSOLETE; |
638 | jffs2_add_physical_node_ref(c, nraw, rawlen, NULL); | 638 | jffs2_add_physical_node_ref(c, nraw, rawlen, NULL); |
@@ -653,7 +653,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c, | |||
653 | jffs2_dbg_acct_sanity_check(c,jeb); | 653 | jffs2_dbg_acct_sanity_check(c,jeb); |
654 | jffs2_dbg_acct_paranoia_check(c, jeb); | 654 | jffs2_dbg_acct_paranoia_check(c, jeb); |
655 | 655 | ||
656 | ret = jffs2_reserve_space_gc(c, rawlen, &phys_ofs, &dummy, rawlen); | 656 | ret = jffs2_reserve_space_gc(c, rawlen, &dummy, rawlen); |
657 | /* this is not the exact summary size of it, | 657 | /* this is not the exact summary size of it, |
658 | it is only an upper estimation */ | 658 | it is only an upper estimation */ |
659 | 659 | ||
@@ -696,7 +696,7 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_ | |||
696 | struct jffs2_node_frag *last_frag; | 696 | struct jffs2_node_frag *last_frag; |
697 | union jffs2_device_node dev; | 697 | union jffs2_device_node dev; |
698 | char *mdata = NULL, mdatalen = 0; | 698 | char *mdata = NULL, mdatalen = 0; |
699 | uint32_t alloclen, phys_ofs, ilen; | 699 | uint32_t alloclen, ilen; |
700 | int ret; | 700 | int ret; |
701 | 701 | ||
702 | if (S_ISBLK(JFFS2_F_I_MODE(f)) || | 702 | if (S_ISBLK(JFFS2_F_I_MODE(f)) || |
@@ -722,7 +722,7 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_ | |||
722 | 722 | ||
723 | } | 723 | } |
724 | 724 | ||
725 | ret = jffs2_reserve_space_gc(c, sizeof(ri) + mdatalen, &phys_ofs, &alloclen, | 725 | ret = jffs2_reserve_space_gc(c, sizeof(ri) + mdatalen, &alloclen, |
726 | JFFS2_SUMMARY_INODE_SIZE); | 726 | JFFS2_SUMMARY_INODE_SIZE); |
727 | if (ret) { | 727 | if (ret) { |
728 | printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_metadata failed: %d\n", | 728 | printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_metadata failed: %d\n", |
@@ -760,7 +760,7 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_ | |||
760 | ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8)); | 760 | ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8)); |
761 | ri.data_crc = cpu_to_je32(crc32(0, mdata, mdatalen)); | 761 | ri.data_crc = cpu_to_je32(crc32(0, mdata, mdatalen)); |
762 | 762 | ||
763 | new_fn = jffs2_write_dnode(c, f, &ri, mdata, mdatalen, phys_ofs, ALLOC_GC); | 763 | new_fn = jffs2_write_dnode(c, f, &ri, mdata, mdatalen, ALLOC_GC); |
764 | 764 | ||
765 | if (IS_ERR(new_fn)) { | 765 | if (IS_ERR(new_fn)) { |
766 | printk(KERN_WARNING "Error writing new dnode: %ld\n", PTR_ERR(new_fn)); | 766 | printk(KERN_WARNING "Error writing new dnode: %ld\n", PTR_ERR(new_fn)); |
@@ -781,7 +781,7 @@ static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_er | |||
781 | { | 781 | { |
782 | struct jffs2_full_dirent *new_fd; | 782 | struct jffs2_full_dirent *new_fd; |
783 | struct jffs2_raw_dirent rd; | 783 | struct jffs2_raw_dirent rd; |
784 | uint32_t alloclen, phys_ofs; | 784 | uint32_t alloclen; |
785 | int ret; | 785 | int ret; |
786 | 786 | ||
787 | rd.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); | 787 | rd.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); |
@@ -803,14 +803,14 @@ static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_er | |||
803 | rd.node_crc = cpu_to_je32(crc32(0, &rd, sizeof(rd)-8)); | 803 | rd.node_crc = cpu_to_je32(crc32(0, &rd, sizeof(rd)-8)); |
804 | rd.name_crc = cpu_to_je32(crc32(0, fd->name, rd.nsize)); | 804 | rd.name_crc = cpu_to_je32(crc32(0, fd->name, rd.nsize)); |
805 | 805 | ||
806 | ret = jffs2_reserve_space_gc(c, sizeof(rd)+rd.nsize, &phys_ofs, &alloclen, | 806 | ret = jffs2_reserve_space_gc(c, sizeof(rd)+rd.nsize, &alloclen, |
807 | JFFS2_SUMMARY_DIRENT_SIZE(rd.nsize)); | 807 | JFFS2_SUMMARY_DIRENT_SIZE(rd.nsize)); |
808 | if (ret) { | 808 | if (ret) { |
809 | printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_dirent failed: %d\n", | 809 | printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_dirent failed: %d\n", |
810 | sizeof(rd)+rd.nsize, ret); | 810 | sizeof(rd)+rd.nsize, ret); |
811 | return ret; | 811 | return ret; |
812 | } | 812 | } |
813 | new_fd = jffs2_write_dirent(c, f, &rd, fd->name, rd.nsize, phys_ofs, ALLOC_GC); | 813 | new_fd = jffs2_write_dirent(c, f, &rd, fd->name, rd.nsize, ALLOC_GC); |
814 | 814 | ||
815 | if (IS_ERR(new_fd)) { | 815 | if (IS_ERR(new_fd)) { |
816 | printk(KERN_WARNING "jffs2_write_dirent in garbage_collect_dirent failed: %ld\n", PTR_ERR(new_fd)); | 816 | printk(KERN_WARNING "jffs2_write_dirent in garbage_collect_dirent failed: %ld\n", PTR_ERR(new_fd)); |
@@ -938,7 +938,7 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras | |||
938 | struct jffs2_raw_inode ri; | 938 | struct jffs2_raw_inode ri; |
939 | struct jffs2_node_frag *frag; | 939 | struct jffs2_node_frag *frag; |
940 | struct jffs2_full_dnode *new_fn; | 940 | struct jffs2_full_dnode *new_fn; |
941 | uint32_t alloclen, phys_ofs, ilen; | 941 | uint32_t alloclen, ilen; |
942 | int ret; | 942 | int ret; |
943 | 943 | ||
944 | D1(printk(KERN_DEBUG "Writing replacement hole node for ino #%u from offset 0x%x to 0x%x\n", | 944 | D1(printk(KERN_DEBUG "Writing replacement hole node for ino #%u from offset 0x%x to 0x%x\n", |
@@ -1017,14 +1017,14 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras | |||
1017 | ri.data_crc = cpu_to_je32(0); | 1017 | ri.data_crc = cpu_to_je32(0); |
1018 | ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8)); | 1018 | ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8)); |
1019 | 1019 | ||
1020 | ret = jffs2_reserve_space_gc(c, sizeof(ri), &phys_ofs, &alloclen, | 1020 | ret = jffs2_reserve_space_gc(c, sizeof(ri), &alloclen, |
1021 | JFFS2_SUMMARY_INODE_SIZE); | 1021 | JFFS2_SUMMARY_INODE_SIZE); |
1022 | if (ret) { | 1022 | if (ret) { |
1023 | printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_hole failed: %d\n", | 1023 | printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_hole failed: %d\n", |
1024 | sizeof(ri), ret); | 1024 | sizeof(ri), ret); |
1025 | return ret; | 1025 | return ret; |
1026 | } | 1026 | } |
1027 | new_fn = jffs2_write_dnode(c, f, &ri, NULL, 0, phys_ofs, ALLOC_GC); | 1027 | new_fn = jffs2_write_dnode(c, f, &ri, NULL, 0, ALLOC_GC); |
1028 | 1028 | ||
1029 | if (IS_ERR(new_fn)) { | 1029 | if (IS_ERR(new_fn)) { |
1030 | printk(KERN_WARNING "Error writing new hole node: %ld\n", PTR_ERR(new_fn)); | 1030 | printk(KERN_WARNING "Error writing new hole node: %ld\n", PTR_ERR(new_fn)); |
@@ -1086,7 +1086,7 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era | |||
1086 | { | 1086 | { |
1087 | struct jffs2_full_dnode *new_fn; | 1087 | struct jffs2_full_dnode *new_fn; |
1088 | struct jffs2_raw_inode ri; | 1088 | struct jffs2_raw_inode ri; |
1089 | uint32_t alloclen, phys_ofs, offset, orig_end, orig_start; | 1089 | uint32_t alloclen, offset, orig_end, orig_start; |
1090 | int ret = 0; | 1090 | int ret = 0; |
1091 | unsigned char *comprbuf = NULL, *writebuf; | 1091 | unsigned char *comprbuf = NULL, *writebuf; |
1092 | unsigned long pg; | 1092 | unsigned long pg; |
@@ -1243,7 +1243,7 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era | |||
1243 | uint32_t cdatalen; | 1243 | uint32_t cdatalen; |
1244 | uint16_t comprtype = JFFS2_COMPR_NONE; | 1244 | uint16_t comprtype = JFFS2_COMPR_NONE; |
1245 | 1245 | ||
1246 | ret = jffs2_reserve_space_gc(c, sizeof(ri) + JFFS2_MIN_DATA_LEN, &phys_ofs, | 1246 | ret = jffs2_reserve_space_gc(c, sizeof(ri) + JFFS2_MIN_DATA_LEN, |
1247 | &alloclen, JFFS2_SUMMARY_INODE_SIZE); | 1247 | &alloclen, JFFS2_SUMMARY_INODE_SIZE); |
1248 | 1248 | ||
1249 | if (ret) { | 1249 | if (ret) { |
@@ -1280,7 +1280,7 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era | |||
1280 | ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8)); | 1280 | ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8)); |
1281 | ri.data_crc = cpu_to_je32(crc32(0, comprbuf, cdatalen)); | 1281 | ri.data_crc = cpu_to_je32(crc32(0, comprbuf, cdatalen)); |
1282 | 1282 | ||
1283 | new_fn = jffs2_write_dnode(c, f, &ri, comprbuf, cdatalen, phys_ofs, ALLOC_GC); | 1283 | new_fn = jffs2_write_dnode(c, f, &ri, comprbuf, cdatalen, ALLOC_GC); |
1284 | 1284 | ||
1285 | jffs2_free_comprbuf(comprbuf, writebuf); | 1285 | jffs2_free_comprbuf(comprbuf, writebuf); |
1286 | 1286 | ||