Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a12f57a authored by Tanya Brokhman's avatar Tanya Brokhman
Browse files

Revert "mtd: ubi: Add kconfig to handle RD at attach"



This reverts commit 47edb451.

This patch is part of the "read-disturb implementation" set of patches.
It was decided to take different approach in addressing the read disturb,
thus the whole patch series is reverted in order to simplify the code
and reduce memory footprint.

Change-Id: I598f27892f0fddf4159393b28c4446b4abf329e5
Signed-off-by: default avatarTanya Brokhman <tlinder@codeaurora.org>
parent dfc13902
Loading
Loading
Loading
Loading
+0 −13
Original line number Original line Diff line number Diff line
@@ -77,19 +77,6 @@ config MTD_UBI_FASTMAP


	   If in doubt, say "N".
	   If in doubt, say "N".


config MTD_UBI_ENABLE_RD_AT_ATTACH
	bool "UBI handle read disturb at attach. (Experimental feature)"
	help
	   Important: this feature is experimental so far and may be removed
	   entirely in the future.

	   Handle the read disturb errors that can happen in NAND devices
	   by checking the last erased timestamp and the read count of the
	   PEB's at attach time in addition to runtime. This can cause
	   significant overhead during attach and must be used with caution.

	   If in doubt, say "N".

config MTD_UBI_GLUEBI
config MTD_UBI_GLUEBI
	tristate "MTD devices emulation driver (gluebi)"
	tristate "MTD devices emulation driver (gluebi)"
	help
	help
+5 −31
Original line number Original line Diff line number Diff line
@@ -2090,21 +2090,6 @@ static void cancel_pending(struct ubi_device *ubi)
	}
	}
}
}


/**
 * enable_check_rd_at_attach - Enable the check read disturb at attach.
 */
#ifdef CONFIG_MTD_UBI_ENABLE_RD_AT_ATTACH
static bool enable_check_rd_at_attach(void)
{
	return true;
}
#else
static bool enable_check_rd_at_attach(void)
{
	return false;
}
#endif

/**
/**
 * ubi_wl_init - initialize the WL sub-system using attaching information.
 * ubi_wl_init - initialize the WL sub-system using attaching information.
 * @ubi: UBI device description object
 * @ubi: UBI device description object
@@ -2121,13 +2106,6 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
	struct ubi_ainf_peb *aeb, *tmp;
	struct ubi_ainf_peb *aeb, *tmp;
	struct ubi_wl_entry *e;
	struct ubi_wl_entry *e;
	struct timeval tv;
	struct timeval tv;
	bool check_rd_at_attach;

	check_rd_at_attach = enable_check_rd_at_attach();
	if (check_rd_at_attach)
		ubi_msg(ubi->ubi_num, "Read disturb check ENABLED at attach");
	else
		ubi_msg(ubi->ubi_num, "Read disturb check DISABLED at attach");


	do_gettimeofday(&tv);
	do_gettimeofday(&tv);
	ubi->used = ubi->erroneous = ubi->free = ubi->scrub = RB_ROOT;
	ubi->used = ubi->erroneous = ubi->free = ubi->scrub = RB_ROOT;
@@ -2214,11 +2192,9 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
		ubi_assert(e->ec >= 0);
		ubi_assert(e->ec >= 0);
		ubi_assert(!ubi_is_fm_block(ubi, e->pnum));
		ubi_assert(!ubi_is_fm_block(ubi, e->pnum));
		ubi->lookuptbl[e->pnum] = e;
		ubi->lookuptbl[e->pnum] = e;

		/* Check last erase timestamp (in days) */
		/* Check last erase timestamp (in days) */
		if (check_rd_at_attach &&
		if (e->last_erase_time + ubi->dt_threshold <
			(e->last_erase_time + ubi->dt_threshold <
			(tv.tv_sec / NUM_SEC_IN_DAY)) {
			(tv.tv_sec / NUM_SEC_IN_DAY))) {
			if (schedule_erase(ubi, e, aeb->vol_id, aeb->lnum, 0)) {
			if (schedule_erase(ubi, e, aeb->vol_id, aeb->lnum, 0)) {
				kmem_cache_free(ubi_wl_entry_slab, e);
				kmem_cache_free(ubi_wl_entry_slab, e);
				goto out_free;
				goto out_free;
@@ -2262,16 +2238,14 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
			 * Verify last erase timestamp
			 * Verify last erase timestamp
			 * (in days) and read counter
			 * (in days) and read counter
			 */
			 */
			if (check_rd_at_attach &&
			if (e->last_erase_time + ubi->dt_threshold <
				(e->last_erase_time + ubi->dt_threshold <
				(tv.tv_sec / NUM_SEC_IN_DAY) ||
				(tv.tv_sec / NUM_SEC_IN_DAY) ||
				e->rc > ubi->rd_threshold)) {
				e->rc > ubi->rd_threshold) {
				ubi_msg(ubi->ubi_num,
				ubi_msg(ubi->ubi_num,
					"scrub PEB %d rc = %d",
					"scrub PEB %d rc = %d",
				       e->pnum, e->rc);
				       e->pnum, e->rc);
				aeb->scrub = 1;
				aeb->scrub = 1;
			}
			}

			if (!aeb->scrub) {
			if (!aeb->scrub) {
				dbg_wl("add PEB %d EC %d to the used tree",
				dbg_wl("add PEB %d EC %d to the used tree",
				       e->pnum, e->ec);
				       e->pnum, e->ec);