aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/persistent-data
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2012-12-21 15:23:34 -0500
committerAlasdair G Kergon <agk@redhat.com>2012-12-21 15:23:34 -0500
commit89ddeb8cb1383bfdfaaeb458f1c4a91e890cc60b (patch)
tree6dfbbe972b14927897b6cab55b833b64260d8329 /drivers/md/persistent-data
parenta5bd968aeb87af4a3a96ecdd78912832997e8a9d (diff)
dm persistent data: use DMERR_LIMIT for errors
Nearly all of persistent-data is in the IO path so throttle error messages with DMERR_LIMIT to limit the amount logged when something has gone wrong. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/persistent-data')
-rw-r--r--drivers/md/persistent-data/dm-block-manager.c11
-rw-r--r--drivers/md/persistent-data/dm-btree-spine.c14
-rw-r--r--drivers/md/persistent-data/dm-space-map-common.c16
3 files changed, 20 insertions, 21 deletions
diff --git a/drivers/md/persistent-data/dm-block-manager.c b/drivers/md/persistent-data/dm-block-manager.c
index 47b683e67a7c..ec4cb3c58a0c 100644
--- a/drivers/md/persistent-data/dm-block-manager.c
+++ b/drivers/md/persistent-data/dm-block-manager.c
@@ -429,17 +429,16 @@ static int dm_bm_validate_buffer(struct dm_block_manager *bm,
429 return 0; 429 return 0;
430 r = v->check(v, (struct dm_block *) buf, dm_bufio_get_block_size(bm->bufio)); 430 r = v->check(v, (struct dm_block *) buf, dm_bufio_get_block_size(bm->bufio));
431 if (unlikely(r)) { 431 if (unlikely(r)) {
432 DMERR("%s validator check failed for block %llu", v->name, 432 DMERR_LIMIT("%s validator check failed for block %llu", v->name,
433 (unsigned long long) dm_bufio_get_block_number(buf)); 433 (unsigned long long) dm_bufio_get_block_number(buf));
434 return r; 434 return r;
435 } 435 }
436 aux->validator = v; 436 aux->validator = v;
437 } else { 437 } else {
438 if (unlikely(aux->validator != v)) { 438 if (unlikely(aux->validator != v)) {
439 DMERR("validator mismatch (old=%s vs new=%s) for block %llu", 439 DMERR_LIMIT("validator mismatch (old=%s vs new=%s) for block %llu",
440 aux->validator->name, v ? v->name : "NULL", 440 aux->validator->name, v ? v->name : "NULL",
441 (unsigned long long) 441 (unsigned long long) dm_bufio_get_block_number(buf));
442 dm_bufio_get_block_number(buf));
443 return -EINVAL; 442 return -EINVAL;
444 } 443 }
445 } 444 }
diff --git a/drivers/md/persistent-data/dm-btree-spine.c b/drivers/md/persistent-data/dm-btree-spine.c
index 2f0805c3263e..f199a0c4ed04 100644
--- a/drivers/md/persistent-data/dm-btree-spine.c
+++ b/drivers/md/persistent-data/dm-btree-spine.c
@@ -45,8 +45,8 @@ static int node_check(struct dm_block_validator *v,
45 uint32_t flags; 45 uint32_t flags;
46 46
47 if (dm_block_location(b) != le64_to_cpu(h->blocknr)) { 47 if (dm_block_location(b) != le64_to_cpu(h->blocknr)) {
48 DMERR("node_check failed blocknr %llu wanted %llu", 48 DMERR_LIMIT("node_check failed: blocknr %llu != wanted %llu",
49 le64_to_cpu(h->blocknr), dm_block_location(b)); 49 le64_to_cpu(h->blocknr), dm_block_location(b));
50 return -ENOTBLK; 50 return -ENOTBLK;
51 } 51 }
52 52
@@ -54,8 +54,8 @@ static int node_check(struct dm_block_validator *v,
54 block_size - sizeof(__le32), 54 block_size - sizeof(__le32),
55 BTREE_CSUM_XOR)); 55 BTREE_CSUM_XOR));
56 if (csum_disk != h->csum) { 56 if (csum_disk != h->csum) {
57 DMERR("node_check failed csum %u wanted %u", 57 DMERR_LIMIT("node_check failed: csum %u != wanted %u",
58 le32_to_cpu(csum_disk), le32_to_cpu(h->csum)); 58 le32_to_cpu(csum_disk), le32_to_cpu(h->csum));
59 return -EILSEQ; 59 return -EILSEQ;
60 } 60 }
61 61
@@ -63,12 +63,12 @@ static int node_check(struct dm_block_validator *v,
63 63
64 if (sizeof(struct node_header) + 64 if (sizeof(struct node_header) +
65 (sizeof(__le64) + value_size) * le32_to_cpu(h->max_entries) > block_size) { 65 (sizeof(__le64) + value_size) * le32_to_cpu(h->max_entries) > block_size) {
66 DMERR("node_check failed: max_entries too large"); 66 DMERR_LIMIT("node_check failed: max_entries too large");
67 return -EILSEQ; 67 return -EILSEQ;
68 } 68 }
69 69
70 if (le32_to_cpu(h->nr_entries) > le32_to_cpu(h->max_entries)) { 70 if (le32_to_cpu(h->nr_entries) > le32_to_cpu(h->max_entries)) {
71 DMERR("node_check failed, too many entries"); 71 DMERR_LIMIT("node_check failed: too many entries");
72 return -EILSEQ; 72 return -EILSEQ;
73 } 73 }
74 74
@@ -77,7 +77,7 @@ static int node_check(struct dm_block_validator *v,
77 */ 77 */
78 flags = le32_to_cpu(h->flags); 78 flags = le32_to_cpu(h->flags);
79 if (!(flags & INTERNAL_NODE) && !(flags & LEAF_NODE)) { 79 if (!(flags & INTERNAL_NODE) && !(flags & LEAF_NODE)) {
80 DMERR("node_check failed, node is neither INTERNAL or LEAF"); 80 DMERR_LIMIT("node_check failed: node is neither INTERNAL or LEAF");
81 return -EILSEQ; 81 return -EILSEQ;
82 } 82 }
83 83
diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/persistent-data/dm-space-map-common.c
index f3a9af8cdec3..3e7a88d99eb0 100644
--- a/drivers/md/persistent-data/dm-space-map-common.c
+++ b/drivers/md/persistent-data/dm-space-map-common.c
@@ -39,8 +39,8 @@ static int index_check(struct dm_block_validator *v,
39 __le32 csum_disk; 39 __le32 csum_disk;
40 40
41 if (dm_block_location(b) != le64_to_cpu(mi_le->blocknr)) { 41 if (dm_block_location(b) != le64_to_cpu(mi_le->blocknr)) {
42 DMERR("index_check failed blocknr %llu wanted %llu", 42 DMERR_LIMIT("index_check failed: blocknr %llu != wanted %llu",
43 le64_to_cpu(mi_le->blocknr), dm_block_location(b)); 43 le64_to_cpu(mi_le->blocknr), dm_block_location(b));
44 return -ENOTBLK; 44 return -ENOTBLK;
45 } 45 }
46 46
@@ -48,8 +48,8 @@ static int index_check(struct dm_block_validator *v,
48 block_size - sizeof(__le32), 48 block_size - sizeof(__le32),
49 INDEX_CSUM_XOR)); 49 INDEX_CSUM_XOR));
50 if (csum_disk != mi_le->csum) { 50 if (csum_disk != mi_le->csum) {
51 DMERR("index_check failed csum %u wanted %u", 51 DMERR_LIMIT("index_check failed: csum %u != wanted %u",
52 le32_to_cpu(csum_disk), le32_to_cpu(mi_le->csum)); 52 le32_to_cpu(csum_disk), le32_to_cpu(mi_le->csum));
53 return -EILSEQ; 53 return -EILSEQ;
54 } 54 }
55 55
@@ -89,8 +89,8 @@ static int bitmap_check(struct dm_block_validator *v,
89 __le32 csum_disk; 89 __le32 csum_disk;
90 90
91 if (dm_block_location(b) != le64_to_cpu(disk_header->blocknr)) { 91 if (dm_block_location(b) != le64_to_cpu(disk_header->blocknr)) {
92 DMERR("bitmap check failed blocknr %llu wanted %llu", 92 DMERR_LIMIT("bitmap check failed: blocknr %llu != wanted %llu",
93 le64_to_cpu(disk_header->blocknr), dm_block_location(b)); 93 le64_to_cpu(disk_header->blocknr), dm_block_location(b));
94 return -ENOTBLK; 94 return -ENOTBLK;
95 } 95 }
96 96
@@ -98,8 +98,8 @@ static int bitmap_check(struct dm_block_validator *v,
98 block_size - sizeof(__le32), 98 block_size - sizeof(__le32),
99 BITMAP_CSUM_XOR)); 99 BITMAP_CSUM_XOR));
100 if (csum_disk != disk_header->csum) { 100 if (csum_disk != disk_header->csum) {
101 DMERR("bitmap check failed csum %u wanted %u", 101 DMERR_LIMIT("bitmap check failed: csum %u != wanted %u",
102 le32_to_cpu(csum_disk), le32_to_cpu(disk_header->csum)); 102 le32_to_cpu(csum_disk), le32_to_cpu(disk_header->csum));
103 return -EILSEQ; 103 return -EILSEQ;
104 } 104 }
105 105