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>
This commit is contained in:
Artem Bityutskiy
2008-04-19 20:44:31 +03:00
parent cbd8a9d2cd
commit 4bc1dca4b0
2 changed files with 9 additions and 34 deletions

View File

@@ -124,7 +124,7 @@ struct ubi_scan_info {
int max_ec;
unsigned long long max_sqnum;
int mean_ec;
int ec_sum;
uint64_t ec_sum;
int ec_count;
};