History

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.

Mike Snitzer committed 13 years ago

Commit 89ddeb81 parent a5bd9683 files · +20 −21Browse files

Unified · Split

3 files
  1. drivers/md/persistent-data/dm-block-manager.c +5 −6
  2. drivers/md/persistent-data/dm-btree-spine.c +7 −7
  3. drivers/md/persistent-data/dm-space-map-common.c +8 −8
drivers/md/persistent-data/dm-block-manager.c+5−6
@@ -429,17 +429,16 @@ static int dm_bm_validate_buffer(struct dm_block_manager *bm, · 428 unmodified lines
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 }
drivers/md/persistent-data/dm-btree-spine.c+7−7
@@ -45,8 +45,8 @@ static int node_check(struct dm_block_validator *v, · 44 unmodified lines
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, · 1 unmodified line
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, · 1 unmodified line
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, · 2 unmodified lines
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
drivers/md/persistent-data/dm-space-map-common.c+8−8
@@ -39,8 +39,8 @@ static int index_check(struct dm_block_validator *v, · 38 unmodified lines
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, · 1 unmodified line
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, · 33 unmodified lines
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, · 1 unmodified line
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