Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion arch/arm/configs/mdm9607-perf_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,8 @@ CONFIG_MTD_NAND_IDS=y
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MTD_UBI_BEB_LIMIT=20
# CONFIG_MTD_UBI_FASTMAP is not set
CONFIG_MTD_UBI_FASTMAP=y
CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
# CONFIG_MTD_UBI_GLUEBI is not set
# CONFIG_MTD_UBI_BLOCK is not set
CONFIG_DTC=y
Expand Down
15 changes: 15 additions & 0 deletions drivers/mtd/ubi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ config MTD_UBI_FASTMAP

If in doubt, say "N".

config MTD_UBI_FASTMAP_AUTOCONVERT
int "enable UBI Fastmap autoconvert"
depends on MTD_UBI_FASTMAP
default 0
help
Set this parameter to enable fastmap automatically on images
without a fastmap.

config MTD_UBI_FM_DEBUG
int "Enable UBI fastmap debug"
depends on MTD_UBI_FASTMAP
default 0
help
Enable UBI fastmap debug

config MTD_UBI_GLUEBI
tristate "MTD devices emulation driver (gluebi)"
help
Expand Down
10 changes: 8 additions & 2 deletions drivers/mtd/ubi/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,14 @@ static int __initdata mtd_devs;
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;
#if !defined(CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT)
#define CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT 0
#endif
static bool fm_autoconvert = CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT;
#if !defined(CONFIG_MTD_UBI_FM_DEBUG)
#define CONFIG_MTD_UBI_FM_DEBUG 0
#endif
static bool fm_debug = CONFIG_MTD_UBI_FM_DEBUG;
#endif

/* Slab cache for wear-leveling entries */
Expand Down
18 changes: 9 additions & 9 deletions drivers/mtd/ubi/eba.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ int ubi_eba_unmap_leb(struct ubi_device *ubi, struct ubi_volume *vol,
* Returns 0 on success, negative error code in case of failure.
*/
static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
int *pnum)
int pnum)
{
int err;
struct ubi_vid_hdr *vid_hdr;
Expand All @@ -381,7 +381,7 @@ static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnu
if (!vid_hdr)
return -ENOMEM;

err = ubi_io_read_vid_hdr(ubi, *pnum, vid_hdr, 0);
err = ubi_io_read_vid_hdr(ubi, pnum, vid_hdr, 0);
if (err > 0 && err != UBI_IO_BITFLIPS) {
int torture = 0;

Expand All @@ -398,15 +398,15 @@ static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnu
if (err == UBI_IO_BAD_HDR_EBADMSG || err == UBI_IO_FF_BITFLIPS)
torture = 1;

down_read(&ubi->fm_sem);
down_read(&ubi->fm_eba_sem);
vol->eba_tbl[lnum] = UBI_LEB_UNMAPPED;
up_read(&ubi->fm_sem);
ubi_wl_put_peb(ubi, vol->vol_id, lnum, *pnum, torture);
up_read(&ubi->fm_eba_sem);
ubi_wl_put_peb(ubi, vol->vol_id, lnum, pnum, torture);

*pnum = UBI_LEB_UNMAPPED;
pnum = UBI_LEB_UNMAPPED;
} else if (err < 0) {
ubi_err("unable to read VID header back from PEB %i: %i",
*pnum, err);
ubi_err(ubi, "unable to read VID header back from PEB %i: %i",
pnum, err);

goto out_free;
}
Expand All @@ -420,7 +420,7 @@ static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnu
}
#else
static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
int *pnum)
int pnum)
{
return 0;
}
Expand Down