diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-03-14 18:17:40 +0200 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-03-16 13:50:16 +0200 |
commit | 92d124f5314913a21f7fa98b22ee457dab171edd (patch) | |
tree | 8a8c187f12290424419f0a05caeb202cd73253cc /drivers/mtd/ubi/wl.c | |
parent | b342efd4a49cef9cf1a260c1814aad97722f38f8 (diff) |
UBI: make self-checks dynamic
This patch adds a possibility to dynamically switch UBI self-checks
on and off, instead of toggling them compile-time from the configuration
menu. This is much more flexible, and consistent with UBIFS, and this
also simplifies UBI Kconfig menu and the code.
This patch introduces two levels of self-checks - general, which
includes all self-checks which are relatively fast, and I/O, which
includes write-verify checks and erase-verify checks, which are
relatively slow and involve flash I/O.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/wl.c')
-rw-r--r-- | drivers/mtd/ubi/wl.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 655bbbe415d9..4e5529014c9b 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -161,7 +161,7 @@ struct ubi_work { int torture; }; -#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID +#ifdef CONFIG_MTD_UBI_DEBUG static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec); static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e, struct rb_root *root); @@ -1561,7 +1561,7 @@ void ubi_wl_close(struct ubi_device *ubi) kfree(ubi->lookuptbl); } -#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID +#ifdef CONFIG_MTD_UBI_DEBUG /** * paranoid_check_ec - make sure that the erase counter of a PEB is correct. @@ -1578,6 +1578,9 @@ static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec) long long read_ec; struct ubi_ec_hdr *ec_hdr; + if (!(ubi_chk_flags & UBI_CHK_GEN)) + return 0; + ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS); if (!ec_hdr) return -ENOMEM; @@ -1614,6 +1617,9 @@ out_free: static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e, struct rb_root *root) { + if (!(ubi_chk_flags & UBI_CHK_GEN)) + return 0; + if (in_wl_tree(e, root)) return 0; @@ -1636,6 +1642,9 @@ static int paranoid_check_in_pq(struct ubi_device *ubi, struct ubi_wl_entry *e) struct ubi_wl_entry *p; int i; + if (!(ubi_chk_flags & UBI_CHK_GEN)) + return 0; + for (i = 0; i < UBI_PROT_QUEUE_LEN; ++i) list_for_each_entry(p, &ubi->pq[i], u.list) if (p == e) @@ -1646,4 +1655,5 @@ static int paranoid_check_in_pq(struct ubi_device *ubi, struct ubi_wl_entry *e) ubi_dbg_dump_stack(); return -EINVAL; } -#endif /* CONFIG_MTD_UBI_DEBUG_PARANOID */ + +#endif /* CONFIG_MTD_UBI_DEBUG */ |