From: Richard Weinberger Date: Wed, 8 Oct 2014 13:14:09 +0000 (+0200) Subject: UBI: Fastmap: Add new module parameter fm_debug X-Git-Tag: v4.1-rc1~122^2~11 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=479c2c0cac0c1d23655df15cf039b4f8e3623d23;p=karo-tx-linux.git 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 --- 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]; #ifdef CONFIG_MTD_UBI_FASTMAP /* UBI module parameter to enable fastmap automatically on non-fastmap images */ static bool fm_autoconvert; +static bool fm_debug; #endif /* Root UBI "class" object (corresponds to '//class/ubi/') */ struct class *ubi_class; @@ -951,6 +952,8 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, ubi->fm_wl_pool.max_size = ubi->fm_pool.max_size / 2; ubi->fm_disabled = !fm_autoconvert; + if (fm_debug) + ubi_enable_dbg_chk_fastmap(ubi); if (!ubi->fm_disabled && (int)mtd_div_by_eb(ubi->mtd->size, ubi->mtd) <= UBI_FM_MAX_START) { @@ -1503,6 +1506,8 @@ MODULE_PARM_DESC(mtd, "MTD devices to attach. Parameter format: mtd=dbg.chk_fastmap; } + +static inline void ubi_enable_dbg_chk_fastmap(struct ubi_device *ubi) +{ + ubi->dbg.chk_fastmap = 1; +} #endif /* !__UBI_DEBUG_H__ */