aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/recovery.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 22:30:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 22:30:27 -0400
commit6133308ad1a386e7e7f776003a1c44e8b54e2166 (patch)
treeb2102f3bd3b25e0f105cd91b6a22bd96a351c5d7 /fs/ubifs/recovery.c
parente8650a08232e75274304b812ff04cfce9af9671c (diff)
parent62f384552b6756cf1ea71f8762d1e97dc77dbd90 (diff)
Merge tag 'upstream-3.5-rc1' of git://git.infradead.org/linux-ubifs
Pull UBI and UBIFS updates from Artem Bityutskiy: UBIFS: * Always support xattrs (remove the Kconfig option) * Always support debugging (remove the Kconfig option) * A fix for a memory leak on error path * A number of clean-ups UBI: * Always support debugging (remove the Kconfig option) * Remove "data type" hint support * Huge amount of renames to prepare for the fastmap wor * A lot of clean-ups * tag 'upstream-3.5-rc1' of git://git.infradead.org/linux-ubifs: (54 commits) UBI: modify ubi_wl_flush function to clear work queue for a lnum UBI: introduce UBI_ALL constant UBI: add lnum and vol_id to struct ubi_work UBI: add volume id struct ubi_ainf_peb UBI: add in hex the value for UBI_INTERNAL_VOL_START to comment UBI: rename scan.c to attach.c UBI: remove scan.h UBI: rename UBI_SCAN_UNKNOWN_EC UBI: move and rename attach_by_scanning UBI: rename _init_scan functions UBI: amend comments after all the renamings UBI: rename ubi_scan_leb_slab UBI: rename ubi_scan_move_to_list UBI: rename ubi_scan_destroy_ai UBI: rename ubi_scan_get_free_peb UBI: rename ubi_scan_rm_volume UBI: rename ubi_scan_find_av UBI: rename ubi_scan_add_used UBI: remove unused function UBI: make ubi_scan_erase_peb static and rename ...
Diffstat (limited to 'fs/ubifs/recovery.c')
-rw-r--r--fs/ubifs/recovery.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
index 2a935b317232..c30d976b4be8 100644
--- a/fs/ubifs/recovery.c
+++ b/fs/ubifs/recovery.c
@@ -213,10 +213,10 @@ static int write_rcvrd_mst_node(struct ubifs_info *c,
213 mst->flags |= cpu_to_le32(UBIFS_MST_RCVRY); 213 mst->flags |= cpu_to_le32(UBIFS_MST_RCVRY);
214 214
215 ubifs_prepare_node(c, mst, UBIFS_MST_NODE_SZ, 1); 215 ubifs_prepare_node(c, mst, UBIFS_MST_NODE_SZ, 1);
216 err = ubifs_leb_change(c, lnum, mst, sz, UBI_SHORTTERM); 216 err = ubifs_leb_change(c, lnum, mst, sz);
217 if (err) 217 if (err)
218 goto out; 218 goto out;
219 err = ubifs_leb_change(c, lnum + 1, mst, sz, UBI_SHORTTERM); 219 err = ubifs_leb_change(c, lnum + 1, mst, sz);
220 if (err) 220 if (err)
221 goto out; 221 goto out;
222out: 222out:
@@ -362,12 +362,12 @@ out_err:
362out_free: 362out_free:
363 ubifs_err("failed to recover master node"); 363 ubifs_err("failed to recover master node");
364 if (mst1) { 364 if (mst1) {
365 dbg_err("dumping first master node"); 365 ubifs_err("dumping first master node");
366 dbg_dump_node(c, mst1); 366 ubifs_dump_node(c, mst1);
367 } 367 }
368 if (mst2) { 368 if (mst2) {
369 dbg_err("dumping second master node"); 369 ubifs_err("dumping second master node");
370 dbg_dump_node(c, mst2); 370 ubifs_dump_node(c, mst2);
371 } 371 }
372 vfree(buf2); 372 vfree(buf2);
373 vfree(buf1); 373 vfree(buf1);
@@ -555,8 +555,7 @@ static int fix_unclean_leb(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
555 ubifs_pad(c, buf, pad_len); 555 ubifs_pad(c, buf, pad_len);
556 } 556 }
557 } 557 }
558 err = ubifs_leb_change(c, lnum, sleb->buf, len, 558 err = ubifs_leb_change(c, lnum, sleb->buf, len);
559 UBI_UNKNOWN);
560 if (err) 559 if (err)
561 return err; 560 return err;
562 } 561 }
@@ -683,7 +682,7 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum,
683 ret, lnum, offs); 682 ret, lnum, offs);
684 break; 683 break;
685 } else { 684 } else {
686 dbg_err("unexpected return value %d", ret); 685 ubifs_err("unexpected return value %d", ret);
687 err = -EINVAL; 686 err = -EINVAL;
688 goto error; 687 goto error;
689 } 688 }
@@ -789,7 +788,7 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum,
789 788
790corrupted_rescan: 789corrupted_rescan:
791 /* Re-scan the corrupted data with verbose messages */ 790 /* Re-scan the corrupted data with verbose messages */
792 dbg_err("corruptio %d", ret); 791 ubifs_err("corruptio %d", ret);
793 ubifs_scan_a_node(c, buf, len, lnum, offs, 1); 792 ubifs_scan_a_node(c, buf, len, lnum, offs, 1);
794corrupted: 793corrupted:
795 ubifs_scanned_corruption(c, lnum, offs, buf); 794 ubifs_scanned_corruption(c, lnum, offs, buf);
@@ -827,17 +826,17 @@ static int get_cs_sqnum(struct ubifs_info *c, int lnum, int offs,
827 goto out_free; 826 goto out_free;
828 ret = ubifs_scan_a_node(c, cs_node, UBIFS_CS_NODE_SZ, lnum, offs, 0); 827 ret = ubifs_scan_a_node(c, cs_node, UBIFS_CS_NODE_SZ, lnum, offs, 0);
829 if (ret != SCANNED_A_NODE) { 828 if (ret != SCANNED_A_NODE) {
830 dbg_err("Not a valid node"); 829 ubifs_err("Not a valid node");
831 goto out_err; 830 goto out_err;
832 } 831 }
833 if (cs_node->ch.node_type != UBIFS_CS_NODE) { 832 if (cs_node->ch.node_type != UBIFS_CS_NODE) {
834 dbg_err("Node a CS node, type is %d", cs_node->ch.node_type); 833 ubifs_err("Node a CS node, type is %d", cs_node->ch.node_type);
835 goto out_err; 834 goto out_err;
836 } 835 }
837 if (le64_to_cpu(cs_node->cmt_no) != c->cmt_no) { 836 if (le64_to_cpu(cs_node->cmt_no) != c->cmt_no) {
838 dbg_err("CS node cmt_no %llu != current cmt_no %llu", 837 ubifs_err("CS node cmt_no %llu != current cmt_no %llu",
839 (unsigned long long)le64_to_cpu(cs_node->cmt_no), 838 (unsigned long long)le64_to_cpu(cs_node->cmt_no),
840 c->cmt_no); 839 c->cmt_no);
841 goto out_err; 840 goto out_err;
842 } 841 }
843 *cs_sqnum = le64_to_cpu(cs_node->ch.sqnum); 842 *cs_sqnum = le64_to_cpu(cs_node->ch.sqnum);
@@ -941,7 +940,7 @@ static int recover_head(struct ubifs_info *c, int lnum, int offs, void *sbuf)
941 err = ubifs_leb_read(c, lnum, sbuf, 0, offs, 1); 940 err = ubifs_leb_read(c, lnum, sbuf, 0, offs, 1);
942 if (err) 941 if (err)
943 return err; 942 return err;
944 return ubifs_leb_change(c, lnum, sbuf, offs, UBI_UNKNOWN); 943 return ubifs_leb_change(c, lnum, sbuf, offs);
945 } 944 }
946 945
947 return 0; 946 return 0;
@@ -1071,7 +1070,7 @@ static int clean_an_unclean_leb(struct ubifs_info *c,
1071 } 1070 }
1072 1071
1073 /* Write back the LEB atomically */ 1072 /* Write back the LEB atomically */
1074 err = ubifs_leb_change(c, lnum, sbuf, len, UBI_UNKNOWN); 1073 err = ubifs_leb_change(c, lnum, sbuf, len);
1075 if (err) 1074 if (err)
1076 return err; 1075 return err;
1077 1076
@@ -1138,9 +1137,9 @@ static int grab_empty_leb(struct ubifs_info *c)
1138 */ 1137 */
1139 lnum = ubifs_find_free_leb_for_idx(c); 1138 lnum = ubifs_find_free_leb_for_idx(c);
1140 if (lnum < 0) { 1139 if (lnum < 0) {
1141 dbg_err("could not find an empty LEB"); 1140 ubifs_err("could not find an empty LEB");
1142 dbg_dump_lprops(c); 1141 ubifs_dump_lprops(c);
1143 dbg_dump_budg(c, &c->bi); 1142 ubifs_dump_budg(c, &c->bi);
1144 return lnum; 1143 return lnum;
1145 } 1144 }
1146 1145
@@ -1218,7 +1217,7 @@ int ubifs_rcvry_gc_commit(struct ubifs_info *c)
1218 } 1217 }
1219 mutex_unlock(&wbuf->io_mutex); 1218 mutex_unlock(&wbuf->io_mutex);
1220 if (err < 0) { 1219 if (err < 0) {
1221 dbg_err("GC failed, error %d", err); 1220 ubifs_err("GC failed, error %d", err);
1222 if (err == -EAGAIN) 1221 if (err == -EAGAIN)
1223 err = -EINVAL; 1222 err = -EINVAL;
1224 return err; 1223 return err;
@@ -1472,7 +1471,7 @@ static int fix_size_in_place(struct ubifs_info *c, struct size_entry *e)
1472 len -= 1; 1471 len -= 1;
1473 len = ALIGN(len + 1, c->min_io_size); 1472 len = ALIGN(len + 1, c->min_io_size);
1474 /* Atomically write the fixed LEB back again */ 1473 /* Atomically write the fixed LEB back again */
1475 err = ubifs_leb_change(c, lnum, c->sbuf, len, UBI_UNKNOWN); 1474 err = ubifs_leb_change(c, lnum, c->sbuf, len);
1476 if (err) 1475 if (err)
1477 goto out; 1476 goto out;
1478 dbg_rcvry("inode %lu at %d:%d size %lld -> %lld", 1477 dbg_rcvry("inode %lu at %d:%d size %lld -> %lld",