mtd: ubi: Fix ubi free PEBs count calculation
Subsystems (2)
The ubi->free_count should be updated with every insert/remove to/from the ubi->free list.
drivers/mtd/ubi/wl.c +3 -0
@@ -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);
Signature · 4 lines
1.7.6 -- QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundat
Dolev Raviv
Reviewed-byThanks,
Dolev
Signature · 2 lines
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
-----Original Message-----
From: linux-mtd [mailto:[email protected]] On Behalf Of Tanya Brokhman
Sent: Tuesday, April 01, 2014 11:02 AM
To: [email protected]
Cc: [email protected]; open list; Tanya Brokhman
Subject: [RFC/PATCH] mtd: ubi: Fix ubi free PEBs count calculation
The ubi->free_count should be updated with every insert/remove to/from the ubi->free list.
drivers/mtd/ubi/wl.c index renamed from drivers/mtd/ubi/wl.c +0 -0
9a36f78..ca74d19 100644
drivers/mtd/ubi/wl.c +0 -0
@@ -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);
--
1.7.6
--
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundat
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Richard Weinberger
Acked-byQuoted 19 lines · Tanya Brokhman
The
ubi->free_countshould be updated with every insert/remove to/from theubi->freelist.Signed-off-by Tanya Brokhman <[email protected]>drivers/mtd/ubi/wl.c +2
-0@@ -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;
drivers/mtd/ubi/wl.c static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
Quoted 8 lines
drivers/mtd/ubi/wl.c +1
-1@@ -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); --
Signature · 2 lines
Thanks, //richard
Artem Bityutskiy
AppliedQuoted 4 lines · Tanya Brokhman
The
ubi->free_countshould be updated with every insert/remove to/from theubi->freelist.Signed-off-by Tanya Brokhman <[email protected]>
Pushed to linux-ubifs.git / master, thanks!
Signature · 2 lines
Best Regards, Artem Bityutskiy