diff options
author | Sunil Mushran <sunil.mushran@oracle.com> | 2010-12-22 15:39:39 -0500 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-12-22 21:37:57 -0500 |
commit | ff1becbf85bf4d4d4652915b7ab27db949585f6b (patch) | |
tree | a037c063caa2ea0dda28d2967bffd399dfdc7cc6 /fs/ocfs2/cluster | |
parent | 3f9c14fab0a2e90af9995f261a123f59e0b41141 (diff) |
ocfs2/cluster: Use ktime instead of timeval in struct o2net_sock_container
Replace time trackers in struct o2net_sock_container from struct timeval to
union ktime.
Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/cluster')
-rw-r--r-- | fs/ocfs2/cluster/netdebug.c | 28 | ||||
-rw-r--r-- | fs/ocfs2/cluster/tcp.c | 91 | ||||
-rw-r--r-- | fs/ocfs2/cluster/tcp_internal.h | 19 |
3 files changed, 76 insertions, 62 deletions
diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c index 2b986aa82299..536a93d13a06 100644 --- a/fs/ocfs2/cluster/netdebug.c +++ b/fs/ocfs2/cluster/netdebug.c | |||
@@ -280,8 +280,6 @@ static void *sc_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
280 | return sc; /* unused, just needs to be null when done */ | 280 | return sc; /* unused, just needs to be null when done */ |
281 | } | 281 | } |
282 | 282 | ||
283 | #define TV_SEC_USEC(TV) TV.tv_sec, (long)TV.tv_usec | ||
284 | |||
285 | static int sc_seq_show(struct seq_file *seq, void *v) | 283 | static int sc_seq_show(struct seq_file *seq, void *v) |
286 | { | 284 | { |
287 | struct o2net_sock_container *sc, *dummy_sc = seq->private; | 285 | struct o2net_sock_container *sc, *dummy_sc = seq->private; |
@@ -313,13 +311,13 @@ static int sc_seq_show(struct seq_file *seq, void *v) | |||
313 | " remote node: %s\n" | 311 | " remote node: %s\n" |
314 | " page off: %zu\n" | 312 | " page off: %zu\n" |
315 | " handshake ok: %u\n" | 313 | " handshake ok: %u\n" |
316 | " timer: %lu.%ld\n" | 314 | " timer: %lld usecs\n" |
317 | " data ready: %lu.%ld\n" | 315 | " data ready: %lld usecs\n" |
318 | " advance start: %lu.%ld\n" | 316 | " advance start: %lld usecs\n" |
319 | " advance stop: %lu.%ld\n" | 317 | " advance stop: %lld usecs\n" |
320 | " func start: %lu.%ld\n" | 318 | " func start: %lld usecs\n" |
321 | " func stop: %lu.%ld\n" | 319 | " func stop: %lld usecs\n" |
322 | " func key: %u\n" | 320 | " func key: 0x%08x\n" |
323 | " func type: %u\n", | 321 | " func type: %u\n", |
324 | sc, | 322 | sc, |
325 | atomic_read(&sc->sc_kref.refcount), | 323 | atomic_read(&sc->sc_kref.refcount), |
@@ -328,12 +326,12 @@ static int sc_seq_show(struct seq_file *seq, void *v) | |||
328 | sc->sc_node->nd_name, | 326 | sc->sc_node->nd_name, |
329 | sc->sc_page_off, | 327 | sc->sc_page_off, |
330 | sc->sc_handshake_ok, | 328 | sc->sc_handshake_ok, |
331 | TV_SEC_USEC(sc->sc_tv_timer), | 329 | (long long)ktime_to_us(sc->sc_tv_timer), |
332 | TV_SEC_USEC(sc->sc_tv_data_ready), | 330 | (long long)ktime_to_us(sc->sc_tv_data_ready), |
333 | TV_SEC_USEC(sc->sc_tv_advance_start), | 331 | (long long)ktime_to_us(sc->sc_tv_advance_start), |
334 | TV_SEC_USEC(sc->sc_tv_advance_stop), | 332 | (long long)ktime_to_us(sc->sc_tv_advance_stop), |
335 | TV_SEC_USEC(sc->sc_tv_func_start), | 333 | (long long)ktime_to_us(sc->sc_tv_func_start), |
336 | TV_SEC_USEC(sc->sc_tv_func_stop), | 334 | (long long)ktime_to_us(sc->sc_tv_func_stop), |
337 | sc->sc_msg_key, | 335 | sc->sc_msg_key, |
338 | sc->sc_msg_type); | 336 | sc->sc_msg_type); |
339 | } | 337 | } |
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 49c1a95e352e..efd848334052 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -153,61 +153,75 @@ static void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype, | |||
153 | nst->st_node = node; | 153 | nst->st_node = node; |
154 | } | 154 | } |
155 | 155 | ||
156 | static void o2net_set_nst_sock_time(struct o2net_send_tracking *nst) | 156 | static inline void o2net_set_nst_sock_time(struct o2net_send_tracking *nst) |
157 | { | 157 | { |
158 | nst->st_sock_time = ktime_get(); | 158 | nst->st_sock_time = ktime_get(); |
159 | } | 159 | } |
160 | 160 | ||
161 | static void o2net_set_nst_send_time(struct o2net_send_tracking *nst) | 161 | static inline void o2net_set_nst_send_time(struct o2net_send_tracking *nst) |
162 | { | 162 | { |
163 | nst->st_send_time = ktime_get(); | 163 | nst->st_send_time = ktime_get(); |
164 | } | 164 | } |
165 | 165 | ||
166 | static void o2net_set_nst_status_time(struct o2net_send_tracking *nst) | 166 | static inline void o2net_set_nst_status_time(struct o2net_send_tracking *nst) |
167 | { | 167 | { |
168 | nst->st_status_time = ktime_get(); | 168 | nst->st_status_time = ktime_get(); |
169 | } | 169 | } |
170 | 170 | ||
171 | static void o2net_set_nst_sock_container(struct o2net_send_tracking *nst, | 171 | static inline void o2net_set_nst_sock_container(struct o2net_send_tracking *nst, |
172 | struct o2net_sock_container *sc) | 172 | struct o2net_sock_container *sc) |
173 | { | 173 | { |
174 | nst->st_sc = sc; | 174 | nst->st_sc = sc; |
175 | } | 175 | } |
176 | 176 | ||
177 | static void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, u32 msg_id) | 177 | static inline void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, |
178 | u32 msg_id) | ||
178 | { | 179 | { |
179 | nst->st_id = msg_id; | 180 | nst->st_id = msg_id; |
180 | } | 181 | } |
181 | 182 | ||
182 | #else /* CONFIG_DEBUG_FS */ | 183 | static inline void o2net_set_sock_timer(struct o2net_sock_container *sc) |
183 | |||
184 | static inline void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype, | ||
185 | u32 msgkey, struct task_struct *task, u8 node) | ||
186 | { | 184 | { |
185 | sc->sc_tv_timer = ktime_get(); | ||
187 | } | 186 | } |
188 | 187 | ||
189 | static inline void o2net_set_nst_sock_time(struct o2net_send_tracking *nst) | 188 | static inline void o2net_set_data_ready_time(struct o2net_sock_container *sc) |
190 | { | 189 | { |
190 | sc->sc_tv_data_ready = ktime_get(); | ||
191 | } | 191 | } |
192 | 192 | ||
193 | static inline void o2net_set_nst_send_time(struct o2net_send_tracking *nst) | 193 | static inline void o2net_set_advance_start_time(struct o2net_sock_container *sc) |
194 | { | 194 | { |
195 | sc->sc_tv_advance_start = ktime_get(); | ||
195 | } | 196 | } |
196 | 197 | ||
197 | static inline void o2net_set_nst_status_time(struct o2net_send_tracking *nst) | 198 | static inline void o2net_set_advance_stop_time(struct o2net_sock_container *sc) |
198 | { | 199 | { |
200 | sc->sc_tv_advance_stop = ktime_get(); | ||
199 | } | 201 | } |
200 | 202 | ||
201 | static inline void o2net_set_nst_sock_container(struct o2net_send_tracking *nst, | 203 | static inline void o2net_set_func_start_time(struct o2net_sock_container *sc) |
202 | struct o2net_sock_container *sc) | ||
203 | { | 204 | { |
205 | sc->sc_tv_func_start = ktime_get(); | ||
204 | } | 206 | } |
205 | 207 | ||
206 | static inline void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, | 208 | static inline void o2net_set_func_stop_time(struct o2net_sock_container *sc) |
207 | u32 msg_id) | ||
208 | { | 209 | { |
210 | sc->sc_tv_func_stop = ktime_get(); | ||
209 | } | 211 | } |
210 | 212 | #else /* CONFIG_DEBUG_FS */ | |
213 | # define o2net_init_nst(a, b, c, d, e) | ||
214 | # define o2net_set_nst_sock_time(a) | ||
215 | # define o2net_set_nst_send_time(a) | ||
216 | # define o2net_set_nst_status_time(a) | ||
217 | # define o2net_set_nst_sock_container(a, b) | ||
218 | # define o2net_set_nst_msg_id(a, b) | ||
219 | # define o2net_set_sock_timer(a) | ||
220 | # define o2net_set_data_ready_time(a) | ||
221 | # define o2net_set_advance_start_time(a) | ||
222 | # define o2net_set_advance_stop_time(a) | ||
223 | # define o2net_set_func_start_time(a) | ||
224 | # define o2net_set_func_stop_time(a) | ||
211 | #endif /* CONFIG_DEBUG_FS */ | 225 | #endif /* CONFIG_DEBUG_FS */ |
212 | 226 | ||
213 | static inline int o2net_reconnect_delay(void) | 227 | static inline int o2net_reconnect_delay(void) |
@@ -555,7 +569,7 @@ static void o2net_data_ready(struct sock *sk, int bytes) | |||
555 | if (sk->sk_user_data) { | 569 | if (sk->sk_user_data) { |
556 | struct o2net_sock_container *sc = sk->sk_user_data; | 570 | struct o2net_sock_container *sc = sk->sk_user_data; |
557 | sclog(sc, "data_ready hit\n"); | 571 | sclog(sc, "data_ready hit\n"); |
558 | do_gettimeofday(&sc->sc_tv_data_ready); | 572 | o2net_set_data_ready_time(sc); |
559 | o2net_sc_queue_work(sc, &sc->sc_rx_work); | 573 | o2net_sc_queue_work(sc, &sc->sc_rx_work); |
560 | ready = sc->sc_data_ready; | 574 | ready = sc->sc_data_ready; |
561 | } else { | 575 | } else { |
@@ -1192,13 +1206,13 @@ static int o2net_process_message(struct o2net_sock_container *sc, | |||
1192 | if (syserr != O2NET_ERR_NONE) | 1206 | if (syserr != O2NET_ERR_NONE) |
1193 | goto out_respond; | 1207 | goto out_respond; |
1194 | 1208 | ||
1195 | do_gettimeofday(&sc->sc_tv_func_start); | 1209 | o2net_set_func_start_time(sc); |
1196 | sc->sc_msg_key = be32_to_cpu(hdr->key); | 1210 | sc->sc_msg_key = be32_to_cpu(hdr->key); |
1197 | sc->sc_msg_type = be16_to_cpu(hdr->msg_type); | 1211 | sc->sc_msg_type = be16_to_cpu(hdr->msg_type); |
1198 | handler_status = (nmh->nh_func)(hdr, sizeof(struct o2net_msg) + | 1212 | handler_status = (nmh->nh_func)(hdr, sizeof(struct o2net_msg) + |
1199 | be16_to_cpu(hdr->data_len), | 1213 | be16_to_cpu(hdr->data_len), |
1200 | nmh->nh_func_data, &ret_data); | 1214 | nmh->nh_func_data, &ret_data); |
1201 | do_gettimeofday(&sc->sc_tv_func_stop); | 1215 | o2net_set_func_stop_time(sc); |
1202 | 1216 | ||
1203 | out_respond: | 1217 | out_respond: |
1204 | /* this destroys the hdr, so don't use it after this */ | 1218 | /* this destroys the hdr, so don't use it after this */ |
@@ -1309,7 +1323,7 @@ static int o2net_advance_rx(struct o2net_sock_container *sc) | |||
1309 | size_t datalen; | 1323 | size_t datalen; |
1310 | 1324 | ||
1311 | sclog(sc, "receiving\n"); | 1325 | sclog(sc, "receiving\n"); |
1312 | do_gettimeofday(&sc->sc_tv_advance_start); | 1326 | o2net_set_advance_start_time(sc); |
1313 | 1327 | ||
1314 | if (unlikely(sc->sc_handshake_ok == 0)) { | 1328 | if (unlikely(sc->sc_handshake_ok == 0)) { |
1315 | if(sc->sc_page_off < sizeof(struct o2net_handshake)) { | 1329 | if(sc->sc_page_off < sizeof(struct o2net_handshake)) { |
@@ -1384,7 +1398,7 @@ static int o2net_advance_rx(struct o2net_sock_container *sc) | |||
1384 | 1398 | ||
1385 | out: | 1399 | out: |
1386 | sclog(sc, "ret = %d\n", ret); | 1400 | sclog(sc, "ret = %d\n", ret); |
1387 | do_gettimeofday(&sc->sc_tv_advance_stop); | 1401 | o2net_set_advance_stop_time(sc); |
1388 | return ret; | 1402 | return ret; |
1389 | } | 1403 | } |
1390 | 1404 | ||
@@ -1484,27 +1498,28 @@ static void o2net_idle_timer(unsigned long data) | |||
1484 | { | 1498 | { |
1485 | struct o2net_sock_container *sc = (struct o2net_sock_container *)data; | 1499 | struct o2net_sock_container *sc = (struct o2net_sock_container *)data; |
1486 | struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); | 1500 | struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); |
1487 | struct timeval now; | ||
1488 | 1501 | ||
1489 | do_gettimeofday(&now); | 1502 | #ifdef CONFIG_DEBUG_FS |
1503 | ktime_t now = ktime_get(); | ||
1504 | #endif | ||
1490 | 1505 | ||
1491 | printk(KERN_NOTICE "o2net: connection to " SC_NODEF_FMT " has been idle for %u.%u " | 1506 | printk(KERN_NOTICE "o2net: connection to " SC_NODEF_FMT " has been idle for %u.%u " |
1492 | "seconds, shutting it down.\n", SC_NODEF_ARGS(sc), | 1507 | "seconds, shutting it down.\n", SC_NODEF_ARGS(sc), |
1493 | o2net_idle_timeout() / 1000, | 1508 | o2net_idle_timeout() / 1000, |
1494 | o2net_idle_timeout() % 1000); | 1509 | o2net_idle_timeout() % 1000); |
1495 | mlog(ML_NOTICE, "here are some times that might help debug the " | 1510 | |
1496 | "situation: (tmr %ld.%ld now %ld.%ld dr %ld.%ld adv " | 1511 | #ifdef CONFIG_DEBUG_FS |
1497 | "%ld.%ld:%ld.%ld func (%08x:%u) %ld.%ld:%ld.%ld)\n", | 1512 | mlog(ML_NOTICE, "Here are some times that might help debug the " |
1498 | sc->sc_tv_timer.tv_sec, (long) sc->sc_tv_timer.tv_usec, | 1513 | "situation: (Timer: %lld, Now %lld, DataReady %lld, Advance %lld-%lld, " |
1499 | now.tv_sec, (long) now.tv_usec, | 1514 | "Key 0x%08x, Func %u, FuncTime %lld-%lld)\n", |
1500 | sc->sc_tv_data_ready.tv_sec, (long) sc->sc_tv_data_ready.tv_usec, | 1515 | (long long)ktime_to_us(sc->sc_tv_timer), (long long)ktime_to_us(now), |
1501 | sc->sc_tv_advance_start.tv_sec, | 1516 | (long long)ktime_to_us(sc->sc_tv_data_ready), |
1502 | (long) sc->sc_tv_advance_start.tv_usec, | 1517 | (long long)ktime_to_us(sc->sc_tv_advance_start), |
1503 | sc->sc_tv_advance_stop.tv_sec, | 1518 | (long long)ktime_to_us(sc->sc_tv_advance_stop), |
1504 | (long) sc->sc_tv_advance_stop.tv_usec, | ||
1505 | sc->sc_msg_key, sc->sc_msg_type, | 1519 | sc->sc_msg_key, sc->sc_msg_type, |
1506 | sc->sc_tv_func_start.tv_sec, (long) sc->sc_tv_func_start.tv_usec, | 1520 | (long long)ktime_to_us(sc->sc_tv_func_start), |
1507 | sc->sc_tv_func_stop.tv_sec, (long) sc->sc_tv_func_stop.tv_usec); | 1521 | (long long)ktime_to_us(sc->sc_tv_func_stop)); |
1522 | #endif | ||
1508 | 1523 | ||
1509 | /* | 1524 | /* |
1510 | * Initialize the nn_timeout so that the next connection attempt | 1525 | * Initialize the nn_timeout so that the next connection attempt |
@@ -1520,7 +1535,7 @@ static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc) | |||
1520 | o2net_sc_cancel_delayed_work(sc, &sc->sc_keepalive_work); | 1535 | o2net_sc_cancel_delayed_work(sc, &sc->sc_keepalive_work); |
1521 | o2net_sc_queue_delayed_work(sc, &sc->sc_keepalive_work, | 1536 | o2net_sc_queue_delayed_work(sc, &sc->sc_keepalive_work, |
1522 | msecs_to_jiffies(o2net_keepalive_delay())); | 1537 | msecs_to_jiffies(o2net_keepalive_delay())); |
1523 | do_gettimeofday(&sc->sc_tv_timer); | 1538 | o2net_set_sock_timer(sc); |
1524 | mod_timer(&sc->sc_idle_timeout, | 1539 | mod_timer(&sc->sc_idle_timeout, |
1525 | jiffies + msecs_to_jiffies(o2net_idle_timeout())); | 1540 | jiffies + msecs_to_jiffies(o2net_idle_timeout())); |
1526 | } | 1541 | } |
diff --git a/fs/ocfs2/cluster/tcp_internal.h b/fs/ocfs2/cluster/tcp_internal.h index b613aaaf3e5c..f81576333911 100644 --- a/fs/ocfs2/cluster/tcp_internal.h +++ b/fs/ocfs2/cluster/tcp_internal.h | |||
@@ -166,18 +166,19 @@ struct o2net_sock_container { | |||
166 | /* original handlers for the sockets */ | 166 | /* original handlers for the sockets */ |
167 | void (*sc_state_change)(struct sock *sk); | 167 | void (*sc_state_change)(struct sock *sk); |
168 | void (*sc_data_ready)(struct sock *sk, int bytes); | 168 | void (*sc_data_ready)(struct sock *sk, int bytes); |
169 | #ifdef CONFIG_DEBUG_FS | 169 | |
170 | struct list_head sc_net_debug_item; | ||
171 | #endif | ||
172 | struct timeval sc_tv_timer; | ||
173 | struct timeval sc_tv_data_ready; | ||
174 | struct timeval sc_tv_advance_start; | ||
175 | struct timeval sc_tv_advance_stop; | ||
176 | struct timeval sc_tv_func_start; | ||
177 | struct timeval sc_tv_func_stop; | ||
178 | u32 sc_msg_key; | 170 | u32 sc_msg_key; |
179 | u16 sc_msg_type; | 171 | u16 sc_msg_type; |
180 | 172 | ||
173 | #ifdef CONFIG_DEBUG_FS | ||
174 | struct list_head sc_net_debug_item; | ||
175 | ktime_t sc_tv_timer; | ||
176 | ktime_t sc_tv_data_ready; | ||
177 | ktime_t sc_tv_advance_start; | ||
178 | ktime_t sc_tv_advance_stop; | ||
179 | ktime_t sc_tv_func_start; | ||
180 | ktime_t sc_tv_func_stop; | ||
181 | #endif | ||
181 | struct mutex sc_send_lock; | 182 | struct mutex sc_send_lock; |
182 | }; | 183 | }; |
183 | 184 | ||