diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-29 16:27:01 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-31 13:58:00 +0200 |
commit | 791a2404116d8049a3f1e6317876fd76a9e2f228 (patch) | |
tree | 505a9f6c7b1b83718496c64dab8904a5bef977e9 | |
parent | 51d390cc2c7e41bc7778c6010cc62664239ce88d (diff) | |
download | dt-utils-791a2404116d8049a3f1e6317876fd76a9e2f228.tar.gz dt-utils-791a2404116d8049a3f1e6317876fd76a9e2f228.tar.xz |
state: Remove -EUCLEAN check from userspace tool
The state code is used for the userspace tool aswell, kept in sync
manually. This patch only introduces a change for the userspace
tool, not for barebox.
In Linux userspace there is no direct possibility to check for -EUCLEAN.
To indirectly check for -EUCLEAN the state tool reads the number of
corrected bits before and after reading a block. Unfortunately it does
not take the number of acceptable bitflips into account, but instead
returns -EUCLEAN even when only a single bitflip occurred on a whole
page. To be correct the algorithm must be more complicated: We would
have to read the bitflip_threshold from sysfs. This value is per ECC
step (often 512 byte), not per page. We would have to read the page
in ECC step size chunks, testing for bitflips lower than the threshold
for each chunk. Even if we would do that, there's still another issue.
The eccstats ioctl delivers the eccstats for the whole device, so a
concurrent reader would falsify the result.
Let's decide that this is not worth the hassle and assume that no
device has enough uptime that a cleanup in barebox is not sufficient.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | src/barebox-state/backend_bucket_circular.c | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/src/barebox-state/backend_bucket_circular.c b/src/barebox-state/backend_bucket_circular.c index d99ba39..135a43a 100644 --- a/src/barebox-state/backend_bucket_circular.c +++ b/src/barebox-state/backend_bucket_circular.c @@ -171,9 +171,6 @@ static int state_mtd_peb_read(struct state_backend_storage_bucket_circular *circ dev_dbg(circ->dev, "Read state from %ld length %zd\n", offset, len); - ret = ioctl(circ->fd, ECCGETSTATS, &stat1); - if (ret) - nostats = true; ret = read_full(circ->fd, buf, len); if (ret < 0) { @@ -183,24 +180,7 @@ static int state_mtd_peb_read(struct state_backend_storage_bucket_circular *circ return ret; } - if (nostats) - return 0; - - ret = ioctl(circ->fd, ECCGETSTATS, &stat2); - if (ret) - return 0; - - if (stat2.failed - stat1.failed > 0) { - ret = -EUCLEAN; - dev_dbg(circ->dev, "PEB %u has ECC error, forcing rewrite\n", - circ->eraseblock); - } else if (stat2.corrected - stat1.corrected > 0) { - ret = -EUCLEAN; - dev_dbg(circ->dev, "PEB %u is unclean, forcing rewrite\n", - circ->eraseblock); - } - - return ret; + return 0; } static int state_mtd_peb_write(struct state_backend_storage_bucket_circular *circ, |