aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_receiver.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_receiver.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_receiver.c')
-rw-r--r--drivers/block/drbd/drbd_receiver.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 34bea972f734..5f80b22e711d 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -1640,6 +1640,8 @@ static int receive_RSDataReply(struct drbd_conf *mdev, struct p_header *h)
1640 drbd_send_ack_dp(mdev, P_NEG_ACK, p); 1640 drbd_send_ack_dp(mdev, P_NEG_ACK, p);
1641 } 1641 }
1642 1642
1643 atomic_add(data_size >> 9, &mdev->rs_sect_in);
1644
1643 return ok; 1645 return ok;
1644} 1646}
1645 1647
@@ -2810,6 +2812,8 @@ static int receive_SyncParam(struct drbd_conf *mdev, struct p_header *h)
2810 struct crypto_hash *verify_tfm = NULL; 2812 struct crypto_hash *verify_tfm = NULL;
2811 struct crypto_hash *csums_tfm = NULL; 2813 struct crypto_hash *csums_tfm = NULL;
2812 const int apv = mdev->agreed_pro_version; 2814 const int apv = mdev->agreed_pro_version;
2815 int *rs_plan_s = NULL;
2816 int fifo_size = 0;
2813 2817
2814 exp_max_sz = apv <= 87 ? sizeof(struct p_rs_param) 2818 exp_max_sz = apv <= 87 ? sizeof(struct p_rs_param)
2815 : apv == 88 ? sizeof(struct p_rs_param) 2819 : apv == 88 ? sizeof(struct p_rs_param)
@@ -2904,6 +2908,15 @@ static int receive_SyncParam(struct drbd_conf *mdev, struct p_header *h)
2904 mdev->sync_conf.c_delay_target = be32_to_cpu(p->c_delay_target); 2908 mdev->sync_conf.c_delay_target = be32_to_cpu(p->c_delay_target);
2905 mdev->sync_conf.c_fill_target = be32_to_cpu(p->c_fill_target); 2909 mdev->sync_conf.c_fill_target = be32_to_cpu(p->c_fill_target);
2906 mdev->sync_conf.c_max_rate = be32_to_cpu(p->c_max_rate); 2910 mdev->sync_conf.c_max_rate = be32_to_cpu(p->c_max_rate);
2911
2912 fifo_size = (mdev->sync_conf.c_plan_ahead * 10 * SLEEP_TIME) / HZ;
2913 if (fifo_size != mdev->rs_plan_s.size && fifo_size > 0) {
2914 rs_plan_s = kzalloc(sizeof(int) * fifo_size, GFP_KERNEL);
2915 if (!rs_plan_s) {
2916 dev_err(DEV, "kmalloc of fifo_buffer failed");
2917 goto disconnect;
2918 }
2919 }
2907 } 2920 }
2908 2921
2909 spin_lock(&mdev->peer_seq_lock); 2922 spin_lock(&mdev->peer_seq_lock);
@@ -2922,6 +2935,12 @@ static int receive_SyncParam(struct drbd_conf *mdev, struct p_header *h)
2922 mdev->csums_tfm = csums_tfm; 2935 mdev->csums_tfm = csums_tfm;
2923 dev_info(DEV, "using csums-alg: \"%s\"\n", p->csums_alg); 2936 dev_info(DEV, "using csums-alg: \"%s\"\n", p->csums_alg);
2924 } 2937 }
2938 if (fifo_size != mdev->rs_plan_s.size) {
2939 kfree(mdev->rs_plan_s.values);
2940 mdev->rs_plan_s.values = rs_plan_s;
2941 mdev->rs_plan_s.size = fifo_size;
2942 mdev->rs_planed = 0;
2943 }
2925 spin_unlock(&mdev->peer_seq_lock); 2944 spin_unlock(&mdev->peer_seq_lock);
2926 } 2945 }
2927 2946
@@ -4202,6 +4221,7 @@ static int got_IsInSync(struct drbd_conf *mdev, struct p_header *h)
4202 /* rs_same_csums is supposed to count in units of BM_BLOCK_SIZE */ 4221 /* rs_same_csums is supposed to count in units of BM_BLOCK_SIZE */
4203 mdev->rs_same_csum += (blksize >> BM_BLOCK_SHIFT); 4222 mdev->rs_same_csum += (blksize >> BM_BLOCK_SHIFT);
4204 dec_rs_pending(mdev); 4223 dec_rs_pending(mdev);
4224 atomic_add(blksize >> 9, &mdev->rs_sect_in);
4205 4225
4206 return TRUE; 4226 return TRUE;
4207} 4227}