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.
Unified · Split
| @@ -429,17 +429,16 @@ static int dm_bm_validate_buffer(struct dm_block_manager *bm, · 428 unmodified lines | ||
| 429 | 429 | return 0; |
| 430 | 430 | r = v->check(v, (struct dm_block *) buf, dm_bufio_get_block_size(bm->bufio)); |
| 431 | 431 | if (unlikely(r)) { |
| 432 | − DMERR("%s validator check failed for block %llu", v->name, | |
| 433 | − (unsigned long long) dm_bufio_get_block_number(buf)); | |
| 432 | + DMERR_LIMIT("%s validator check failed for block %llu", v->name, | |
| 433 | + (unsigned long long) dm_bufio_get_block_number(buf)); | |
| 434 | 434 | return r; |
| 435 | 435 | } |
| 436 | 436 | aux->validator = v; |
| 437 | 437 | } else { |
| 438 | 438 | if (unlikely(aux->validator != v)) { |
| 439 | − DMERR("validator mismatch (old=%s vs new=%s) for block %llu", | |
| 440 | − aux->validator->name, v ? v->name : "NULL", | |
| 441 | − (unsigned long long) | |
| 442 | − dm_bufio_get_block_number(buf)); | |
| 439 | + DMERR_LIMIT("validator mismatch (old=%s vs new=%s) for block %llu", | |
| 440 | + aux->validator->name, v ? v->name : "NULL", | |
| 441 | + (unsigned long long) dm_bufio_get_block_number(buf)); | |
| 443 | 442 | return -EINVAL; |
| 444 | 443 | } |
| 445 | 444 | } |
| @@ -45,8 +45,8 @@ static int node_check(struct dm_block_validator *v, · 44 unmodified lines | ||
| 45 | 45 | uint32_t flags; |
| 46 | 46 | |
| 47 | 47 | if (dm_block_location(b) != le64_to_cpu(h->blocknr)) { |
| 48 | − DMERR("node_check failed blocknr %llu wanted %llu", | |
| 49 | − le64_to_cpu(h->blocknr), dm_block_location(b)); | |
| 48 | + DMERR_LIMIT("node_check failed: blocknr %llu != wanted %llu", | |
| 49 | + le64_to_cpu(h->blocknr), dm_block_location(b)); | |
| 50 | 50 | return -ENOTBLK; |
| 51 | 51 | } |
| 52 | 52 | |
| @@ -54,8 +54,8 @@ static int node_check(struct dm_block_validator *v, · 1 unmodified line | ||
| 54 | 54 | block_size - sizeof(__le32), |
| 55 | 55 | BTREE_CSUM_XOR)); |
| 56 | 56 | if (csum_disk != h->csum) { |
| 57 | − DMERR("node_check failed csum %u wanted %u", | |
| 58 | − le32_to_cpu(csum_disk), le32_to_cpu(h->csum)); | |
| 57 | + DMERR_LIMIT("node_check failed: csum %u != wanted %u", | |
| 58 | + le32_to_cpu(csum_disk), le32_to_cpu(h->csum)); | |
| 59 | 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 | 64 | if (sizeof(struct node_header) + |
| 65 | 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 | 67 | return -EILSEQ; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 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 | 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 | 78 | flags = le32_to_cpu(h->flags); |
| 79 | 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 | 81 | return -EILSEQ; |
| 82 | 82 | } |
| 83 | 83 | |
| @@ -39,8 +39,8 @@ static int index_check(struct dm_block_validator *v, · 38 unmodified lines | ||
| 39 | 39 | __le32 csum_disk; |
| 40 | 40 | |
| 41 | 41 | if (dm_block_location(b) != le64_to_cpu(mi_le->blocknr)) { |
| 42 | − DMERR("index_check failed blocknr %llu wanted %llu", | |
| 43 | − le64_to_cpu(mi_le->blocknr), dm_block_location(b)); | |
| 42 | + DMERR_LIMIT("index_check failed: blocknr %llu != wanted %llu", | |
| 43 | + le64_to_cpu(mi_le->blocknr), dm_block_location(b)); | |
| 44 | 44 | return -ENOTBLK; |
| 45 | 45 | } |
| 46 | 46 | |
| @@ -48,8 +48,8 @@ static int index_check(struct dm_block_validator *v, · 1 unmodified line | ||
| 48 | 48 | block_size - sizeof(__le32), |
| 49 | 49 | INDEX_CSUM_XOR)); |
| 50 | 50 | if (csum_disk != mi_le->csum) { |
| 51 | − DMERR("index_check failed csum %u wanted %u", | |
| 52 | − le32_to_cpu(csum_disk), le32_to_cpu(mi_le->csum)); | |
| 51 | + DMERR_LIMIT("index_check failed: csum %u != wanted %u", | |
| 52 | + le32_to_cpu(csum_disk), le32_to_cpu(mi_le->csum)); | |
| 53 | 53 | return -EILSEQ; |
| 54 | 54 | } |
| 55 | 55 | |
| @@ -89,8 +89,8 @@ static int bitmap_check(struct dm_block_validator *v, · 33 unmodified lines | ||
| 89 | 89 | __le32 csum_disk; |
| 90 | 90 | |
| 91 | 91 | if (dm_block_location(b) != le64_to_cpu(disk_header->blocknr)) { |
| 92 | − DMERR("bitmap check failed blocknr %llu wanted %llu", | |
| 93 | − le64_to_cpu(disk_header->blocknr), dm_block_location(b)); | |
| 92 | + DMERR_LIMIT("bitmap check failed: blocknr %llu != wanted %llu", | |
| 93 | + le64_to_cpu(disk_header->blocknr), dm_block_location(b)); | |
| 94 | 94 | return -ENOTBLK; |
| 95 | 95 | } |
| 96 | 96 | |
| @@ -98,8 +98,8 @@ static int bitmap_check(struct dm_block_validator *v, · 1 unmodified line | ||
| 98 | 98 | block_size - sizeof(__le32), |
| 99 | 99 | BITMAP_CSUM_XOR)); |
| 100 | 100 | if (csum_disk != disk_header->csum) { |
| 101 | − DMERR("bitmap check failed csum %u wanted %u", | |
| 102 | − le32_to_cpu(csum_disk), le32_to_cpu(disk_header->csum)); | |
| 101 | + DMERR_LIMIT("bitmap check failed: csum %u != wanted %u", | |
| 102 | + le32_to_cpu(csum_disk), le32_to_cpu(disk_header->csum)); | |
| 103 | 103 | return -EILSEQ; |
| 104 | 104 | } |
| 105 | 105 | |