diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2013-03-01 17:45:49 -0500 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2013-03-01 17:45:49 -0500 |
commit | df5d2e9089c7d5b8c46f767e4278610ea3e815b9 (patch) | |
tree | 5285aa8b0c794da419133a209437b32a11aa8a8d /drivers/md/dm-raid1.c | |
parent | a26062416ef8add48f16fbadded2b5f6fb84d024 (diff) |
dm kcopyd: introduce configurable throttling
This patch allows the administrator to reduce the rate at which kcopyd
issues I/O.
Each module that uses kcopyd acquires a throttle parameter that can be
set in /sys/module/*/parameters.
We maintain a history of kcopyd usage by each module in the variables
io_period and total_period in struct dm_kcopyd_throttle. The actual
kcopyd activity is calculated as a percentage of time equal to
"(100 * io_period / total_period)". This is compared with the user-defined
throttle percentage threshold and if it is exceeded, we sleep.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-raid1.c')
-rw-r--r-- | drivers/md/dm-raid1.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index e2ea97723e10..d053098c6a91 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -82,6 +82,9 @@ struct mirror_set { | |||
82 | struct mirror mirror[0]; | 82 | struct mirror mirror[0]; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(raid1_resync_throttle, | ||
86 | "A percentage of time allocated for raid resynchronization"); | ||
87 | |||
85 | static void wakeup_mirrord(void *context) | 88 | static void wakeup_mirrord(void *context) |
86 | { | 89 | { |
87 | struct mirror_set *ms = context; | 90 | struct mirror_set *ms = context; |
@@ -1111,7 +1114,7 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
1111 | goto err_destroy_wq; | 1114 | goto err_destroy_wq; |
1112 | } | 1115 | } |
1113 | 1116 | ||
1114 | ms->kcopyd_client = dm_kcopyd_client_create(); | 1117 | ms->kcopyd_client = dm_kcopyd_client_create(&dm_kcopyd_throttle); |
1115 | if (IS_ERR(ms->kcopyd_client)) { | 1118 | if (IS_ERR(ms->kcopyd_client)) { |
1116 | r = PTR_ERR(ms->kcopyd_client); | 1119 | r = PTR_ERR(ms->kcopyd_client); |
1117 | goto err_destroy_wq; | 1120 | goto err_destroy_wq; |