linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: linux-mtd@lists.infradead.org
Cc: Richard Weinberger <richard@nod.at>,
	adrian.hunter@intel.com, Heinz.Egger@linutronix.de,
	shmulik.ladkani@gmail.com, tglx@linutronix.de,
	tim.bird@am.sony.com
Subject: [PATCH 01/21] UBI: Fastmap: enhance find_early_wl_entry()
Date: Wed, 13 Jun 2012 12:41:58 +0200	[thread overview]
Message-ID: <1339584138-69914-2-git-send-email-richard@nod.at> (raw)
In-Reply-To: <1339584138-69914-1-git-send-email-richard@nod.at>

Select always the PEB with the lowest pnum and ec.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 drivers/mtd/ubi/wl.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 2325d3d..8f6321a 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -418,11 +418,13 @@ static struct ubi_wl_entry *find_early_wl_entry(struct rb_root *root,
 {
 	struct rb_node *p;
 	struct ubi_wl_entry *e, *victim = NULL;
+	int max_ec = UBI_MAX_ERASECOUNTER;
 
 	ubi_rb_for_each_entry(p, e, root, u.rb) {
-		if (e->pnum < max_pnum) {
+		if (e->pnum < max_pnum && e->ec < max_ec) {
 			victim = e;
 			max_pnum = e->pnum;
+			max_ec = e->ec;
 		}
 	}
 
-- 
1.7.6.5

  reply	other threads:[~2012-06-13 10:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-13 10:41 UBI Fastmap updates (v7++) Richard Weinberger
2012-06-13 10:41 ` Richard Weinberger [this message]
2012-06-13 10:41 ` [PATCH 02/21] UBI: Fastmap: Add PEB leak detection Richard Weinberger
2012-06-13 10:42 ` [PATCH 03/21] UBI: Fastmap: Remove useless code Richard Weinberger
2012-06-13 10:42 ` [PATCH 04/21] UBI: Fastmap: Check for duplicated PEBs in add_aeb() Richard Weinberger
2012-06-13 10:42 ` [PATCH 05/21] UBI: Fastmap: Rewrite scan_pool() Richard Weinberger
2012-06-13 10:42 ` [PATCH 06/21] UBI: Fastmap: Ensure that new_fm->e[0]->ec is always set Richard Weinberger
2012-06-13 10:42 ` [PATCH 07/21] UBI: Fastmap: Prevent PEB leak Richard Weinberger
2012-06-13 10:42 ` [PATCH 08/21] UBI: Fastmap: Add scrub support to add_aeb() Richard Weinberger
2012-06-13 10:42 ` [PATCH 09/21] UBI: Fastmap: Make ubi_wl_get_fm_peb() return a ubi_wl_entry Richard Weinberger
2012-06-13 10:42 ` [PATCH 10/21] UBI: Fastmap: Detect whether a PEB has to be unmapped Richard Weinberger
2012-06-13 10:42 ` [PATCH 11/21] UBI: Fastmap: Adjust comment above ubi_wl_flush() Richard Weinberger
2012-06-13 10:42 ` [PATCH 12/21] UBI: Fastmap: Handle unused "used" PEBs better Richard Weinberger
2012-06-13 10:42 ` [PATCH 13/21] UBI: Fastmap: Introduce WL pool Signed-off-by: Richard Weinberger <richard@nod.at> Richard Weinberger
2012-06-27  4:13   ` Artem Bityutskiy
2012-06-27  8:20     ` Richard Weinberger
2012-06-27  8:30       ` Artem Bityutskiy
2012-06-13 10:42 ` [PATCH 14/21] UBI: Fastmap: Erase PEBs synchronous in wear_leveling_worker() Richard Weinberger
2012-06-13 10:42 ` [PATCH 15/21] UBI: Fastmap: Fix NULL-pointer bug Richard Weinberger
2012-06-13 10:42 ` [PATCH 16/21] UBI: Fastmap: Fix loglevel Richard Weinberger
2012-06-13 10:42 ` [PATCH 17/21] UBI: Fastmap: Relax EC self check Richard Weinberger
2012-06-13 10:42 ` [PATCH 18/21] UBI: Fastmap: Store magic values in be32 Richard Weinberger
2012-06-13 10:42 ` [PATCH 19/21] UBI: Fastmap: Minor fixes Richard Weinberger
2012-06-13 10:42 ` [PATCH 20/21] UBI: Fastmap: Torture fastmap PEBs that showed bit flips Richard Weinberger
2012-06-13 10:42 ` [PATCH 21/21] UBI: Fastmap: make checkpatch.pl happy Signed-off-by: Richard Weinberger <richard@nod.at> Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339584138-69914-2-git-send-email-richard@nod.at \
    --to=richard@nod.at \
    --cc=Heinz.Egger@linutronix.de \
    --cc=adrian.hunter@intel.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=shmulik.ladkani@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=tim.bird@am.sony.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).