diff options
author | Tanya Brokhman <tlinder@codeaurora.org> | 2014-04-01 04:02:07 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2014-05-05 02:31:33 -0400 |
commit | 3d21bb7667c4b57a15077d60d23385d9a1c01d08 (patch) | |
tree | 57b08041e00f9b3c50accc2783c79a0004eed358 | |
parent | 87ed89d21ede38f86be9419ca7c6dd4761764bbb (diff) |
UBI: fix ubi free PEBs count calculation
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>
Reviewed-by: Dolev Raviv <draviv@codeaurora.org>
Acked-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
-rw-r--r-- | drivers/mtd/ubi/wl.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 457ead32105c..0f3425dac910 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c | |||
@@ -671,6 +671,8 @@ static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi) | |||
671 | 671 | ||
672 | e = find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF); | 672 | e = find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF); |
673 | self_check_in_wl_tree(ubi, e, &ubi->free); | 673 | self_check_in_wl_tree(ubi, e, &ubi->free); |
674 | ubi->free_count--; | ||
675 | ubi_assert(ubi->free_count >= 0); | ||
674 | rb_erase(&e->u.rb, &ubi->free); | 676 | rb_erase(&e->u.rb, &ubi->free); |
675 | 677 | ||
676 | return e; | 678 | return e; |
@@ -1071,6 +1073,7 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk, | |||
1071 | 1073 | ||
1072 | /* Give the unused PEB back */ | 1074 | /* Give the unused PEB back */ |
1073 | wl_tree_add(e2, &ubi->free); | 1075 | wl_tree_add(e2, &ubi->free); |
1076 | ubi->free_count++; | ||
1074 | goto out_cancel; | 1077 | goto out_cancel; |
1075 | } | 1078 | } |
1076 | self_check_in_wl_tree(ubi, e1, &ubi->used); | 1079 | self_check_in_wl_tree(ubi, e1, &ubi->used); |