aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2014-10-08 09:14:09 -0400
committerRichard Weinberger <richard@nod.at>2015-03-26 17:46:06 -0400
commit479c2c0cac0c1d23655df15cf039b4f8e3623d23 (patch)
treef184d88172064640bdfa9418df8b191b964507b3
parent560d86a1a210000b33859cd66e051fcb516a3559 (diff)
UBI: Fastmap: Add new module parameter fm_debug
If fm_debug is set fastmap debugging is enabled by default. This is useful if one wants to debug fastmap on an UBI device with serves the rootfs. The the UBI attach mechanism runs long before debugfs can be mounted and chk_fastmap set. Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r--drivers/mtd/ubi/build.c5
-rw-r--r--drivers/mtd/ubi/debug.h5
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index e26fe12b1aae..9690cf9aaef5 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -81,6 +81,7 @@ static struct mtd_dev_param __initdata mtd_dev_param[UBI_MAX_DEVICES];
81#ifdef CONFIG_MTD_UBI_FASTMAP 81#ifdef CONFIG_MTD_UBI_FASTMAP
82/* UBI module parameter to enable fastmap automatically on non-fastmap images */ 82/* UBI module parameter to enable fastmap automatically on non-fastmap images */
83static bool fm_autoconvert; 83static bool fm_autoconvert;
84static bool fm_debug;
84#endif 85#endif
85/* Root UBI "class" object (corresponds to '/<sysfs>/class/ubi/') */ 86/* Root UBI "class" object (corresponds to '/<sysfs>/class/ubi/') */
86struct class *ubi_class; 87struct class *ubi_class;
@@ -951,6 +952,8 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
951 952
952 ubi->fm_wl_pool.max_size = ubi->fm_pool.max_size / 2; 953 ubi->fm_wl_pool.max_size = ubi->fm_pool.max_size / 2;
953 ubi->fm_disabled = !fm_autoconvert; 954 ubi->fm_disabled = !fm_autoconvert;
955 if (fm_debug)
956 ubi_enable_dbg_chk_fastmap(ubi);
954 957
955 if (!ubi->fm_disabled && (int)mtd_div_by_eb(ubi->mtd->size, ubi->mtd) 958 if (!ubi->fm_disabled && (int)mtd_div_by_eb(ubi->mtd->size, ubi->mtd)
956 <= UBI_FM_MAX_START) { 959 <= UBI_FM_MAX_START) {
@@ -1503,6 +1506,8 @@ MODULE_PARM_DESC(mtd, "MTD devices to attach. Parameter format: mtd=<name|num|pa
1503#ifdef CONFIG_MTD_UBI_FASTMAP 1506#ifdef CONFIG_MTD_UBI_FASTMAP
1504module_param(fm_autoconvert, bool, 0644); 1507module_param(fm_autoconvert, bool, 0644);
1505MODULE_PARM_DESC(fm_autoconvert, "Set this parameter to enable fastmap automatically on images without a fastmap."); 1508MODULE_PARM_DESC(fm_autoconvert, "Set this parameter to enable fastmap automatically on images without a fastmap.");
1509module_param(fm_debug, bool, 0);
1510MODULE_PARM_DESC(fm_debug, "Set this parameter to enable fastmap debugging by default. Warning, this will make fastmap slow!");
1506#endif 1511#endif
1507MODULE_VERSION(__stringify(UBI_VERSION)); 1512MODULE_VERSION(__stringify(UBI_VERSION));
1508MODULE_DESCRIPTION("UBI - Unsorted Block Images"); 1513MODULE_DESCRIPTION("UBI - Unsorted Block Images");
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h
index e99ef37a321e..c6ea4431acf3 100644
--- a/drivers/mtd/ubi/debug.h
+++ b/drivers/mtd/ubi/debug.h
@@ -132,4 +132,9 @@ static inline int ubi_dbg_chk_fastmap(const struct ubi_device *ubi)
132{ 132{
133 return ubi->dbg.chk_fastmap; 133 return ubi->dbg.chk_fastmap;
134} 134}
135
136static inline void ubi_enable_dbg_chk_fastmap(struct ubi_device *ubi)
137{
138 ubi->dbg.chk_fastmap = 1;
139}
135#endif /* !__UBI_DEBUG_H__ */ 140#endif /* !__UBI_DEBUG_H__ */