Skip to content

Commit c397741

Browse files
snitmkergon
authored andcommitted
dm thin: use DMERR_LIMIT for errors
Throttle all errors logged from the IO path by dm thin. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
1 parent 89ddeb8 commit c397741

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

drivers/md/dm-thin.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ static void process_prepared_mapping(struct dm_thin_new_mapping *m)
567567
*/
568568
r = dm_thin_insert_block(tc->td, m->virt_block, m->data_block);
569569
if (r) {
570-
DMERR("dm_thin_insert_block() failed");
570+
DMERR_LIMIT("dm_thin_insert_block() failed");
571571
dm_cell_error(m->cell);
572572
goto out;
573573
}
@@ -622,7 +622,7 @@ static void process_prepared_discard(struct dm_thin_new_mapping *m)
622622

623623
r = dm_thin_remove_block(tc->td, m->virt_block);
624624
if (r)
625-
DMERR("dm_thin_remove_block() failed");
625+
DMERR_LIMIT("dm_thin_remove_block() failed");
626626

627627
process_prepared_discard_passdown(m);
628628
}
@@ -736,7 +736,7 @@ static void schedule_copy(struct thin_c *tc, dm_block_t virt_block,
736736
0, copy_complete, m);
737737
if (r < 0) {
738738
mempool_free(m, pool->mapping_pool);
739-
DMERR("dm_kcopyd_copy() failed");
739+
DMERR_LIMIT("dm_kcopyd_copy() failed");
740740
dm_cell_error(cell);
741741
}
742742
}
@@ -802,7 +802,7 @@ static void schedule_zero(struct thin_c *tc, dm_block_t virt_block,
802802
r = dm_kcopyd_zero(pool->copier, 1, &to, 0, copy_complete, m);
803803
if (r < 0) {
804804
mempool_free(m, pool->mapping_pool);
805-
DMERR("dm_kcopyd_zero() failed");
805+
DMERR_LIMIT("dm_kcopyd_zero() failed");
806806
dm_cell_error(cell);
807807
}
808808
}
@@ -814,7 +814,7 @@ static int commit(struct pool *pool)
814814

815815
r = dm_pool_commit_metadata(pool->pmd);
816816
if (r)
817-
DMERR("commit failed, error = %d", r);
817+
DMERR_LIMIT("commit failed: error = %d", r);
818818

819819
return r;
820820
}
@@ -997,7 +997,8 @@ static void process_discard(struct thin_c *tc, struct bio *bio)
997997
break;
998998

999999
default:
1000-
DMERR("discard: find block unexpectedly returned %d", r);
1000+
DMERR_LIMIT("%s: dm_thin_find_block() failed: error = %d",
1001+
__func__, r);
10011002
cell_defer_no_holder(tc, cell);
10021003
bio_io_error(bio);
10031004
break;
@@ -1024,7 +1025,8 @@ static void break_sharing(struct thin_c *tc, struct bio *bio, dm_block_t block,
10241025
break;
10251026

10261027
default:
1027-
DMERR("%s: alloc_data_block() failed, error = %d", __func__, r);
1028+
DMERR_LIMIT("%s: alloc_data_block() failed: error = %d",
1029+
__func__, r);
10281030
dm_cell_error(cell);
10291031
break;
10301032
}
@@ -1100,7 +1102,8 @@ static void provision_block(struct thin_c *tc, struct bio *bio, dm_block_t block
11001102
break;
11011103

11021104
default:
1103-
DMERR("%s: alloc_data_block() failed, error = %d", __func__, r);
1105+
DMERR_LIMIT("%s: alloc_data_block() failed: error = %d",
1106+
__func__, r);
11041107
set_pool_mode(tc->pool, PM_READ_ONLY);
11051108
dm_cell_error(cell);
11061109
break;
@@ -1148,7 +1151,8 @@ static void process_bio(struct thin_c *tc, struct bio *bio)
11481151
break;
11491152

11501153
default:
1151-
DMERR("dm_thin_find_block() failed, error = %d", r);
1154+
DMERR_LIMIT("%s: dm_thin_find_block() failed: error = %d",
1155+
__func__, r);
11521156
cell_defer_no_holder(tc, cell);
11531157
bio_io_error(bio);
11541158
break;
@@ -1190,7 +1194,8 @@ static void process_bio_read_only(struct thin_c *tc, struct bio *bio)
11901194
break;
11911195

11921196
default:
1193-
DMERR("dm_thin_find_block() failed, error = %d", r);
1197+
DMERR_LIMIT("%s: dm_thin_find_block() failed: error = %d",
1198+
__func__, r);
11941199
bio_io_error(bio);
11951200
break;
11961201
}

0 commit comments

Comments
 (0)