aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_nl.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2010-07-06 05:14:00 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2010-10-14 12:38:14 -0400
commit778f271dfe7a7173c0bae2d6cde8d9bd1533e668 (patch)
tree1c057622152bd652102749b488653bff8be24c2a /drivers/block/drbd/drbd_nl.c
parent8e26f9ccb9be00fdb33551a34c8f6029e89ab79f (diff)
drbd: The new, smarter resync speed controller
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_nl.c')
-rw-r--r--drivers/block/drbd/drbd_nl.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 7d384fd39c16..295b8d593708 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1587,6 +1587,8 @@ static int drbd_nl_syncer_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *n
1587 struct crypto_hash *csums_tfm = NULL; 1587 struct crypto_hash *csums_tfm = NULL;
1588 struct syncer_conf sc; 1588 struct syncer_conf sc;
1589 cpumask_var_t new_cpu_mask; 1589 cpumask_var_t new_cpu_mask;
1590 int *rs_plan_s = NULL;
1591 int fifo_size;
1590 1592
1591 if (!zalloc_cpumask_var(&new_cpu_mask, GFP_KERNEL)) { 1593 if (!zalloc_cpumask_var(&new_cpu_mask, GFP_KERNEL)) {
1592 retcode = ERR_NOMEM; 1594 retcode = ERR_NOMEM;
@@ -1687,6 +1689,16 @@ static int drbd_nl_syncer_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *n
1687 if (retcode != NO_ERROR) 1689 if (retcode != NO_ERROR)
1688 goto fail; 1690 goto fail;
1689 1691
1692 fifo_size = (sc.c_plan_ahead * 10 * SLEEP_TIME) / HZ;
1693 if (fifo_size != mdev->rs_plan_s.size && fifo_size > 0) {
1694 rs_plan_s = kzalloc(sizeof(int) * fifo_size, GFP_KERNEL);
1695 if (!rs_plan_s) {
1696 dev_err(DEV, "kmalloc of fifo_buffer failed");
1697 retcode = ERR_NOMEM;
1698 goto fail;
1699 }
1700 }
1701
1690 /* ok, assign the rest of it as well. 1702 /* ok, assign the rest of it as well.
1691 * lock against receive_SyncParam() */ 1703 * lock against receive_SyncParam() */
1692 spin_lock(&mdev->peer_seq_lock); 1704 spin_lock(&mdev->peer_seq_lock);
@@ -1703,6 +1715,15 @@ static int drbd_nl_syncer_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *n
1703 mdev->verify_tfm = verify_tfm; 1715 mdev->verify_tfm = verify_tfm;
1704 verify_tfm = NULL; 1716 verify_tfm = NULL;
1705 } 1717 }
1718
1719 if (fifo_size != mdev->rs_plan_s.size) {
1720 kfree(mdev->rs_plan_s.values);
1721 mdev->rs_plan_s.values = rs_plan_s;
1722 mdev->rs_plan_s.size = fifo_size;
1723 mdev->rs_planed = 0;
1724 rs_plan_s = NULL;
1725 }
1726
1706 spin_unlock(&mdev->peer_seq_lock); 1727 spin_unlock(&mdev->peer_seq_lock);
1707 1728
1708 if (get_ldev(mdev)) { 1729 if (get_ldev(mdev)) {
@@ -1734,6 +1755,7 @@ static int drbd_nl_syncer_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *n
1734 1755
1735 kobject_uevent(&disk_to_dev(mdev->vdisk)->kobj, KOBJ_CHANGE); 1756 kobject_uevent(&disk_to_dev(mdev->vdisk)->kobj, KOBJ_CHANGE);
1736fail: 1757fail:
1758 kfree(rs_plan_s);
1737 free_cpumask_var(new_cpu_mask); 1759 free_cpumask_var(new_cpu_mask);
1738 crypto_free_hash(csums_tfm); 1760 crypto_free_hash(csums_tfm);
1739 crypto_free_hash(verify_tfm); 1761 crypto_free_hash(verify_tfm);