diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2010-05-06 09:19:30 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2010-05-17 19:28:08 -0400 |
commit | 162f3ec7f026784ff2e216f19147d67e2f8ccd56 (patch) | |
tree | ef211a8348dc4862da7ce21c315aed2e37e8de7b /drivers/block/drbd | |
parent | a8cdfd8d3bf0b6d2bbe792f5e74f54ccc6bc1d4f (diff) |
drbd: Fixes to the new delay_probes code
* Only send delay_probes with protocol 93 or newer
* drbd_send_delay_probes() is called only from worker context,
no atomic_t needed for delay_seq
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd')
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 6 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 8 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_proc.c | 3 |
3 files changed, 8 insertions, 9 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 37380d2c869d..45d9a4534c40 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -552,7 +552,7 @@ struct p_delay_probe { | |||
552 | 552 | ||
553 | struct delay_probe { | 553 | struct delay_probe { |
554 | struct list_head list; | 554 | struct list_head list; |
555 | int seq_num; | 555 | unsigned int seq_num; |
556 | struct timeval time; | 556 | struct timeval time; |
557 | }; | 557 | }; |
558 | 558 | ||
@@ -1048,9 +1048,9 @@ struct drbd_conf { | |||
1048 | char congestion_reason; /* Why we where congested... */ | 1048 | char congestion_reason; /* Why we where congested... */ |
1049 | struct list_head delay_probes; /* protected by peer_seq_lock */ | 1049 | struct list_head delay_probes; /* protected by peer_seq_lock */ |
1050 | int data_delay; /* Delay of packets on the data-sock behind meta-sock */ | 1050 | int data_delay; /* Delay of packets on the data-sock behind meta-sock */ |
1051 | atomic_t delay_seq; /* To generate sequence numbers of delay probes */ | 1051 | unsigned int delay_seq; /* To generate sequence numbers of delay probes */ |
1052 | struct timeval dps_time; /* delay-probes-start-time */ | 1052 | struct timeval dps_time; /* delay-probes-start-time */ |
1053 | int dp_volume_last; /* send_cnt of last delay probe */ | 1053 | unsigned int dp_volume_last; /* send_cnt of last delay probe */ |
1054 | int c_sync_rate; /* current resync rate after delay_probe magic */ | 1054 | int c_sync_rate; /* current resync rate after delay_probe magic */ |
1055 | }; | 1055 | }; |
1056 | 1056 | ||
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 44cc7b415ed4..3aa0add1c230 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -2199,7 +2199,7 @@ static int drbd_send_delay_probe(struct drbd_conf *mdev, struct drbd_socket *ds) | |||
2199 | do_gettimeofday(&now); | 2199 | do_gettimeofday(&now); |
2200 | offset = now.tv_usec - mdev->dps_time.tv_usec + | 2200 | offset = now.tv_usec - mdev->dps_time.tv_usec + |
2201 | (now.tv_sec - mdev->dps_time.tv_sec) * 1000000; | 2201 | (now.tv_sec - mdev->dps_time.tv_sec) * 1000000; |
2202 | dp.seq_num = cpu_to_be32(atomic_read(&mdev->delay_seq)); | 2202 | dp.seq_num = cpu_to_be32(mdev->delay_seq); |
2203 | dp.offset = cpu_to_be32(offset); | 2203 | dp.offset = cpu_to_be32(offset); |
2204 | 2204 | ||
2205 | ok = _drbd_send_cmd(mdev, ds->socket, P_DELAY_PROBE, | 2205 | ok = _drbd_send_cmd(mdev, ds->socket, P_DELAY_PROBE, |
@@ -2213,7 +2213,8 @@ static int drbd_send_delay_probe(struct drbd_conf *mdev, struct drbd_socket *ds) | |||
2213 | static int drbd_send_delay_probes(struct drbd_conf *mdev) | 2213 | static int drbd_send_delay_probes(struct drbd_conf *mdev) |
2214 | { | 2214 | { |
2215 | int ok; | 2215 | int ok; |
2216 | atomic_inc(&mdev->delay_seq); | 2216 | |
2217 | mdev->delay_seq++; | ||
2217 | do_gettimeofday(&mdev->dps_time); | 2218 | do_gettimeofday(&mdev->dps_time); |
2218 | ok = drbd_send_delay_probe(mdev, &mdev->meta); | 2219 | ok = drbd_send_delay_probe(mdev, &mdev->meta); |
2219 | ok = ok && drbd_send_delay_probe(mdev, &mdev->data); | 2220 | ok = ok && drbd_send_delay_probe(mdev, &mdev->data); |
@@ -2355,7 +2356,7 @@ static int _drbd_send_zc_bio(struct drbd_conf *mdev, struct bio *bio) | |||
2355 | 2356 | ||
2356 | static void consider_delay_probes(struct drbd_conf *mdev) | 2357 | static void consider_delay_probes(struct drbd_conf *mdev) |
2357 | { | 2358 | { |
2358 | if (mdev->state.conn != C_SYNC_SOURCE) | 2359 | if (mdev->state.conn != C_SYNC_SOURCE || mdev->agreed_pro_version < 93) |
2359 | return; | 2360 | return; |
2360 | 2361 | ||
2361 | if (mdev->dp_volume_last + mdev->sync_conf.dp_volume * 2 < mdev->send_cnt) | 2362 | if (mdev->dp_volume_last + mdev->sync_conf.dp_volume * 2 < mdev->send_cnt) |
@@ -2677,7 +2678,6 @@ void drbd_init_set_defaults(struct drbd_conf *mdev) | |||
2677 | atomic_set(&mdev->net_cnt, 0); | 2678 | atomic_set(&mdev->net_cnt, 0); |
2678 | atomic_set(&mdev->packet_seq, 0); | 2679 | atomic_set(&mdev->packet_seq, 0); |
2679 | atomic_set(&mdev->pp_in_use, 0); | 2680 | atomic_set(&mdev->pp_in_use, 0); |
2680 | atomic_set(&mdev->delay_seq, 0); | ||
2681 | 2681 | ||
2682 | mutex_init(&mdev->md_io_mutex); | 2682 | mutex_init(&mdev->md_io_mutex); |
2683 | mutex_init(&mdev->data.mutex); | 2683 | mutex_init(&mdev->data.mutex); |
diff --git a/drivers/block/drbd/drbd_proc.c b/drivers/block/drbd/drbd_proc.c index 81dea0a85933..d0f1767ea4c3 100644 --- a/drivers/block/drbd/drbd_proc.c +++ b/drivers/block/drbd/drbd_proc.c | |||
@@ -86,8 +86,7 @@ static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq) | |||
86 | mdev->data_delay / 1000, | 86 | mdev->data_delay / 1000, |
87 | (mdev->data_delay % 1000) / 100); | 87 | (mdev->data_delay % 1000) / 100); |
88 | else if (mdev->state.conn == C_SYNC_SOURCE) | 88 | else if (mdev->state.conn == C_SYNC_SOURCE) |
89 | seq_printf(seq, " delay_probe: %d\n\t", | 89 | seq_printf(seq, " delay_probe: %u\n\t", mdev->delay_seq); |
90 | atomic_read(&mdev->delay_seq)); | ||
91 | 90 | ||
92 | /* see drivers/md/md.c | 91 | /* see drivers/md/md.c |
93 | * We do not want to overflow, so the order of operands and | 92 | * We do not want to overflow, so the order of operands and |