* @ubi_num: number to assign to the new UBI device
  * @vid_hdr_offset: VID header offset
  * @max_beb_per1024: maximum expected number of bad PEB per 1024 PEBs
+ * @disable_fm: whether disable fastmap
  *
  * This function attaches MTD device @mtd_dev to UBI and assign @ubi_num number
  * to the newly created UBI device, unless @ubi_num is %UBI_DEV_NUM_AUTO, in
  * automatically. Returns the new UBI device number in case of success and a
  * negative error code in case of failure.
  *
+ * If @disable_fm is true, ubi doesn't create new fastmap even the module param
+ * 'fm_autoconvert' is set, and existed old fastmap will be destroyed after
+ * doing full scanning.
+ *
  * Note, the invocations of this function has to be serialized by the
  * @ubi_devices_mutex.
  */
 int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
-                      int vid_hdr_offset, int max_beb_per1024)
+                      int vid_hdr_offset, int max_beb_per1024, bool disable_fm)
 {
        struct ubi_device *ubi;
        int i, err;
                UBI_FM_MIN_POOL_SIZE);
 
        ubi->fm_wl_pool.max_size = ubi->fm_pool.max_size / 2;
-       ubi->fm_disabled = !fm_autoconvert;
+       ubi->fm_disabled = (!fm_autoconvert || disable_fm) ? 1 : 0;
        if (fm_debug)
                ubi_enable_dbg_chk_fastmap(ubi);
 
        if (!ubi->fm_buf)
                goto out_free;
 #endif
-       err = ubi_attach(ubi, 0);
+       err = ubi_attach(ubi, disable_fm ? 1 : 0);
        if (err) {
                ubi_err(ubi, "failed to attach mtd%d, error %d",
                        mtd->index, err);
 
                mutex_lock(&ubi_devices_mutex);
                err = ubi_attach_mtd_dev(mtd, p->ubi_num,
-                                        p->vid_hdr_offs, p->max_beb_per1024);
+                                        p->vid_hdr_offs, p->max_beb_per1024,
+                                        false);
                mutex_unlock(&ubi_devices_mutex);
                if (err < 0) {
                        pr_err("UBI error: cannot attach mtd%d\n",
 
 
 /* build.c */
 int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
-                      int vid_hdr_offset, int max_beb_per1024);
+                      int vid_hdr_offset, int max_beb_per1024,
+                      bool disable_fm);
 int ubi_detach_mtd_dev(int ubi_num, int anyway);
 struct ubi_device *ubi_get_device(int ubi_num);
 void ubi_put_device(struct ubi_device *ubi);
 
  * @vid_hdr_offset: VID header offset (use defaults if %0)
  * @max_beb_per1024: maximum expected number of bad PEB per 1024 PEBs
  * @padding: reserved for future, not used, has to be zeroed
+ * @disable_fm: whether disable fastmap
  *
  * This data structure is used to specify MTD device UBI has to attach and the
  * parameters it has to use. The number which should be assigned to the new UBI
  * eraseblocks for new bad eraseblocks, but attempts to use available
  * eraseblocks (if any). The accepted range is 0-768. If 0 is given, the
  * default kernel value of %CONFIG_MTD_UBI_BEB_LIMIT will be used.
+ *
+ * If @disable_fm is not zero, ubi doesn't create new fastmap even the module
+ * param 'fm_autoconvert' is set, and existed old fastmap will be destroyed
+ * after doing full scanning.
  */
 struct ubi_attach_req {
        __s32 ubi_num;
        __s32 mtd_num;
        __s32 vid_hdr_offset;
        __s16 max_beb_per1024;
-       __s8 padding[10];
+       __s8 disable_fm;
+       __s8 padding[9];
 };
 
 /*