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>
This commit is contained in:
Artem Bityutskiy
2011-03-14 18:17:40 +02:00
parent b342efd4a4
commit 92d124f531
8 changed files with 70 additions and 25 deletions

View File

@@ -62,7 +62,7 @@
#include <asm/div64.h>
#include "ubi.h"
#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
#ifdef CONFIG_MTD_UBI_DEBUG
static void paranoid_vtbl_check(const struct ubi_device *ubi);
#else
#define paranoid_vtbl_check(ubi)
@@ -870,7 +870,7 @@ out_free:
return err;
}
#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
#ifdef CONFIG_MTD_UBI_DEBUG
/**
* paranoid_vtbl_check - check volume table.
@@ -878,10 +878,13 @@ out_free:
*/
static void paranoid_vtbl_check(const struct ubi_device *ubi)
{
if (!(ubi_chk_flags & UBI_CHK_GEN))
return;
if (vtbl_check(ubi, ubi->vtbl)) {
ubi_err("paranoid check failed");
BUG();
}
}
#endif /* CONFIG_MTD_UBI_DEBUG_PARANOID */
#endif /* CONFIG_MTD_UBI_DEBUG */