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

Commit 0ddc54af authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mtd: ubi: in case of failed fm, re-erase free blocks"

parents 420abfb5 32953298
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1492,6 +1492,7 @@ int ubi_attach(struct ubi_device *ubi, int force_scan)
					return -ENOMEM;

				err = scan_all(ubi, ai, 0);
				ai->failed_fm = 1;
			} else {
				err = scan_all(ubi, ai, UBI_FM_MAX_START);
			}
+2 −0
Original line number Diff line number Diff line
@@ -722,6 +722,7 @@ struct ubi_ainf_volume {
 * @mean_ec: mean erase counter value
 * @ec_sum: a temporary variable used when calculating @mean_ec
 * @ec_count: a temporary variable used when calculating @mean_ec
 * @failed_fm: set to true if fm faound invalid during attach
 * @aeb_slab_cache: slab cache for &struct ubi_ainf_peb objects
 * @mean_last_erase_time: mean late erase timestamp value
 * @last_erase_time_sum: temporary variable, used to calculate
@@ -753,6 +754,7 @@ struct ubi_attach_info {
	int mean_ec;
	uint64_t ec_sum;
	int ec_count;
	int failed_fm;
	struct kmem_cache *aeb_slab_cache;
	long long  mean_last_erase_time;
	long long last_erase_time_sum;
+5 −5
Original line number Diff line number Diff line
@@ -2012,7 +2012,7 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
		e->last_erase_time = aeb->last_erase_time;
		ubi_assert(e->ec >= 0);
		ubi_assert(!ubi_is_fm_block(ubi, e->pnum));

		ubi->lookuptbl[e->pnum] = e;
		/* Check last erase timestamp (in days) */
		if (e->last_erase_time + ubi->dt_threshold <
			(tv.tv_sec / NUM_SEC_IN_DAY)) {
@@ -2020,13 +2020,13 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
				kmem_cache_free(ubi_wl_entry_slab, e);
				goto out_free;
			}
		} else {
		} else if (!ai->failed_fm) {
			wl_tree_add(e, &ubi->free);
			ubi->free_count++;
		} else if (schedule_erase(ubi, e, aeb->vol_id, aeb->lnum, 0)) {
			kmem_cache_free(ubi_wl_entry_slab, e);
			goto out_free;
		}

		ubi->lookuptbl[e->pnum] = e;

		found_pebs++;
	}