UBI: fix mean EC calculation
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sat, 19 Apr 2008 17:44:31 +0000 (20:44 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Mon, 25 May 2009 14:08:37 +0000 (17:08 +0300)
commit91d452faa8b9bc0e1c9c3cd8e0feeca796344982
treee2e693d763e0de6627ba0428dee2bcff0b1f9fd3
parent129b6464bd541f439e34c3debedac76e285945a6
UBI: fix mean EC calculation

(a + b) / (c + d) != a / c + b / d. The old code errornously
assumed this incorrect formuld. Instead, just sum all erase
counters in a 64-bit variable and divide to the number of EBs
at the end.

Thanks to Adrian Hunter for pointing this out.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
drivers/mtd/ubi/scan.c
drivers/mtd/ubi/scan.h