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
429429 return 0;
430430 r = v->check(v, (struct dm_block *) buf, dm_bufio_get_block_size(bm->bufio));
431431 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));
434434 return r;
435435 }
436436 aux->validator = v;
437437 } else {
438438 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));
443442 return -EINVAL;
444443 }
445444 }
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
4545 uint32_t flags;
4646
4747 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));
5050 return -ENOTBLK;
5151 }
5252
@@ -54,8 +54,8 @@ static int node_check(struct dm_block_validator *v, · 1 unmodified line
5454 block_size - sizeof(__le32),
5555 BTREE_CSUM_XOR));
5656 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));
5959 return -EILSEQ;
6060 }
6161
@@ -63,12 +63,12 @@ static int node_check(struct dm_block_validator *v, · 1 unmodified line
6363
6464 if (sizeof(struct node_header) +
6565 (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");
6767 return -EILSEQ;
6868 }
6969
7070 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");
7272 return -EILSEQ;
7373 }
7474
@@ -77,7 +77,7 @@ static int node_check(struct dm_block_validator *v, · 2 unmodified lines
7777 */
7878 flags = le32_to_cpu(h->flags);
7979 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");
8181 return -EILSEQ;
8282 }
8383
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
3939 __le32 csum_disk;
4040
4141 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));
4444 return -ENOTBLK;
4545 }
4646
@@ -48,8 +48,8 @@ static int index_check(struct dm_block_validator *v, · 1 unmodified line
4848 block_size - sizeof(__le32),
4949 INDEX_CSUM_XOR));
5050 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));
5353 return -EILSEQ;
5454 }
5555
@@ -89,8 +89,8 @@ static int bitmap_check(struct dm_block_validator *v, · 33 unmodified lines
8989 __le32 csum_disk;
9090
9191 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));
9494 return -ENOTBLK;
9595 }
9696
@@ -98,8 +98,8 @@ static int bitmap_check(struct dm_block_validator *v, · 1 unmodified line
9898 block_size - sizeof(__le32),
9999 BITMAP_CSUM_XOR));
100100 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));
103103 return -EILSEQ;
104104 }
105105