summaryrefslogtreecommitdiffstats
path: root/common/state/backend_storage.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-03-23 11:41:53 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-31 18:43:53 +0200
commita5986ff8177e0f44b7d521a3cd824a8aa328d46f (patch)
treedd6c85dcd41a03d351ab33ea79fd2d746468544d /common/state/backend_storage.c
parent5207445cfd1f5fcb592cf4337691ec4b85170c65 (diff)
downloadbarebox-a5986ff8177e0f44b7d521a3cd824a8aa328d46f.tar.gz
barebox-a5986ff8177e0f44b7d521a3cd824a8aa328d46f.tar.xz
state: bucket: Make output more informative
Print offset and number of the bucket along with the bucket specific messages to give a hint which bucket a message is for. Also it's pretty much expected that buckets sometimes have no data or need cleanup, so instead of complaining loudly, only write which bucket is used and which buckets are cleaned up. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/state/backend_storage.c')
-rw-r--r--common/state/backend_storage.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c
index 218c67f2d7..4e0548af85 100644
--- a/common/state/backend_storage.c
+++ b/common/state/backend_storage.c
@@ -89,7 +89,11 @@ refresh:
ret = bucket->write(bucket, buf, len);
if (ret)
- dev_warn(storage->dev, "Failed to restore bucket\n");
+ dev_warn(storage->dev, "Failed to restore bucket %d@0x%08lx\n",
+ bucket->num, bucket->offset);
+ else
+ dev_info(storage->dev, "restored bucket %d@0x%08lx\n",
+ bucket->num, bucket->offset);
return ret;
}
@@ -122,13 +126,10 @@ int state_storage_read(struct state_backend_storage *storage,
*/
list_for_each_entry(bucket, &storage->buckets, bucket_list) {
ret = bucket->read(bucket, &bucket->buf, &bucket->len);
- if (ret == -EUCLEAN) {
+ if (ret == -EUCLEAN)
bucket->needs_refresh = 1;
- } else if (ret) {
- dev_warn(storage->dev, "Failed to read from state backend bucket, trying next, %d\n",
- ret);
+ else if (ret)
continue;
- }
/*
* Verify the buffer crcs. The buffer length is passed in the len argument,
@@ -137,10 +138,6 @@ int state_storage_read(struct state_backend_storage *storage,
ret = format->verify(format, magic, bucket->buf, &bucket->len);
if (!ret && !bucket_used)
bucket_used = bucket;
-
- if (ret)
- dev_warn(storage->dev, "Failed to verify read copy, trying next bucket, %d\n",
- ret);
}
if (!bucket_used) {
@@ -149,6 +146,8 @@ int state_storage_read(struct state_backend_storage *storage,
return -ENOENT;
}
+ dev_info(storage->dev, "Using bucket %d@0x%08lx\n", bucket_used->num, bucket_used->offset);
+
/*
* Restore/refresh all buckets except the one we currently use (in case
* it's the only usable bucket at the moment)
@@ -254,6 +253,9 @@ static int state_storage_mtd_buckets_init(struct state_backend_storage *storage,
continue;
}
+ bucket->offset = offset;
+ bucket->num = nr_copies;
+
list_add_tail(&bucket->bucket_list, &storage->buckets);
++nr_copies;
if (nr_copies >= desired_copies)
@@ -313,6 +315,9 @@ static int state_storage_file_buckets_init(struct state_backend_storage *storage
continue;
}
+ bucket->offset = offset;
+ bucket->num = nr_copies;
+
list_add_tail(&bucket->bucket_list, &storage->buckets);
++nr_copies;
}