aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-thin.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2013-03-01 17:45:49 -0500
committerAlasdair G Kergon <agk@redhat.com>2013-03-01 17:45:49 -0500
commitdf5d2e9089c7d5b8c46f767e4278610ea3e815b9 (patch)
tree5285aa8b0c794da419133a209437b32a11aa8a8d /drivers/md/dm-thin.c
parenta26062416ef8add48f16fbadded2b5f6fb84d024 (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-thin.c')
-rw-r--r--drivers/md/dm-thin.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 303e11da7c2a..35d9d0396cc2 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -26,6 +26,9 @@
26#define PRISON_CELLS 1024 26#define PRISON_CELLS 1024
27#define COMMIT_PERIOD HZ 27#define COMMIT_PERIOD HZ
28 28
29DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(snapshot_copy_throttle,
30 "A percentage of time allocated for copy on write");
31
29/* 32/*
30 * The block size of the device holding pool data must be 33 * The block size of the device holding pool data must be
31 * between 64KB and 1GB. 34 * between 64KB and 1GB.
@@ -1642,7 +1645,7 @@ static struct pool *pool_create(struct mapped_device *pool_md,
1642 goto bad_prison; 1645 goto bad_prison;
1643 } 1646 }
1644 1647
1645 pool->copier = dm_kcopyd_client_create(); 1648 pool->copier = dm_kcopyd_client_create(&dm_kcopyd_throttle);
1646 if (IS_ERR(pool->copier)) { 1649 if (IS_ERR(pool->copier)) {
1647 r = PTR_ERR(pool->copier); 1650 r = PTR_ERR(pool->copier);
1648 *error = "Error creating pool's kcopyd client"; 1651 *error = "Error creating pool's kcopyd client";