aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2010-05-03 09:10:47 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2010-05-17 19:22:46 -0400
commit7237bc430f49de1145d761c4b39f2ebae58842d5 (patch)
tree281dd6163cf75db400f2eb076fcbafaee5d0f193
parent0ced55a3bed25b0e30dcb3c7dce9634ce3c60cf2 (diff)
drbd: Sending of delay_probes
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r--drivers/block/drbd/drbd_int.h1
-rw-r--r--drivers/block/drbd/drbd_main.c33
2 files changed, 34 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index fd7615f1e526..3e4d8b574fef 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -1046,6 +1046,7 @@ struct drbd_conf {
1046 struct list_head delay_probes; /* protected by peer_seq_lock */ 1046 struct list_head delay_probes; /* protected by peer_seq_lock */
1047 int data_delay; /* Delay of packets on the data-sock behind meta-sock */ 1047 int data_delay; /* Delay of packets on the data-sock behind meta-sock */
1048 atomic_t delay_seq; /* To generate sequence numbers of delay probes */ 1048 atomic_t delay_seq; /* To generate sequence numbers of delay probes */
1049 struct timeval dps_time; /* delay-probes-start-time */
1049}; 1050};
1050 1051
1051static inline struct drbd_conf *minor_to_mdev(unsigned int minor) 1052static inline struct drbd_conf *minor_to_mdev(unsigned int minor)
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 3d5fe307a19d..710bfebb7b63 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2188,6 +2188,39 @@ int drbd_send_ov_request(struct drbd_conf *mdev, sector_t sector, int size)
2188 return ok; 2188 return ok;
2189} 2189}
2190 2190
2191static int drbd_send_delay_probe(struct drbd_conf *mdev, struct drbd_socket *ds)
2192{
2193 struct p_delay_probe dp;
2194 int offset, ok = 0;
2195 struct timeval now;
2196
2197 mutex_lock(&ds->mutex);
2198 if (likely(ds->socket)) {
2199 do_gettimeofday(&now);
2200 offset = now.tv_usec - mdev->dps_time.tv_usec +
2201 (now.tv_sec - mdev->dps_time.tv_sec) * 1000000;
2202 dp.seq_num = cpu_to_be32(atomic_read(&mdev->delay_seq));
2203 dp.offset = cpu_to_be32(offset);
2204
2205 ok = _drbd_send_cmd(mdev, ds->socket, P_DELAY_PROBE,
2206 (struct p_header *)&dp, sizeof(dp), 0);
2207 }
2208 mutex_unlock(&ds->mutex);
2209
2210 return ok;
2211}
2212
2213static int drbd_send_dalay_probes(struct drbd_conf *mdev)
2214{
2215 int ok;
2216 atomic_inc(&mdev->delay_seq);
2217 do_gettimeofday(&mdev->dps_time);
2218 ok = drbd_send_delay_probe(mdev, &mdev->meta);
2219 ok = ok && drbd_send_delay_probe(mdev, &mdev->data);
2220
2221 return ok;
2222}
2223
2191/* called on sndtimeo 2224/* called on sndtimeo
2192 * returns FALSE if we should retry, 2225 * returns FALSE if we should retry,
2193 * TRUE if we think connection is dead 2226 * TRUE if we think connection is dead