Message ID | 1396339327-16090-1-git-send-email-tlinder@codeaurora.org |
---|---|
State | Accepted |
Commit | 3d21bb7667c4b57a15077d60d23385d9a1c01d08 |
Headers | show |
On Tue, Apr 1, 2014 at 10:02 AM, Tanya Brokhman <tlinder@codeaurora.org> wrote: > The ubi->free_count should be updated with every insert/remove to/from > the ubi->free list. > > Signed-off-by: Tanya Brokhman <tlinder@codeaurora.org> > > diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c > index 9a36f78..ca74d19 100644 > --- a/drivers/mtd/ubi/wl.c > +++ b/drivers/mtd/ubi/wl.c > @@ -690,6 +690,8 @@ static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi) > > e = find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF); > self_check_in_wl_tree(ubi, e, &ubi->free); > + ubi->free_count--; > + ubi_assert(ubi->free_count >= 0); > rb_erase(&e->u.rb, &ubi->free); > > return e; > @@ -1090,6 +1092,7 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk, > > /* Give the unused PEB back */ > wl_tree_add(e2, &ubi->free); > + ubi->free_count++; > goto out_cancel; > } > self_check_in_wl_tree(ubi, e1, &ubi->used); > -- Acked-by: Richard Weinberger <richard@nod.at>
On Tue, 2014-04-01 at 11:02 +0300, Tanya Brokhman wrote: > The ubi->free_count should be updated with every insert/remove to/from > the ubi->free list. > > Signed-off-by: Tanya Brokhman <tlinder@codeaurora.org> Pushed to linux-ubifs.git / master, thanks!
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 9a36f78..ca74d19 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -690,6 +690,8 @@ static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi) e = find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF); self_check_in_wl_tree(ubi, e, &ubi->free); + ubi->free_count--; + ubi_assert(ubi->free_count >= 0); rb_erase(&e->u.rb, &ubi->free); return e; @@ -1090,6 +1092,7 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk, /* Give the unused PEB back */ wl_tree_add(e2, &ubi->free); + ubi->free_count++; goto out_cancel; } self_check_in_wl_tree(ubi, e1, &ubi->used);
The ubi->free_count should be updated with every insert/remove to/from the ubi->free list. Signed-off-by: Tanya Brokhman <tlinder@codeaurora.org>