diff options
author | Sage Weil <sage@newdream.net> | 2010-06-17 17:19:01 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-08-01 23:11:40 -0400 |
commit | 0deb01c9998f8112c5e478e3fe3a930131abbc0a (patch) | |
tree | 1b98a08ce630949268c4f26d5f232d07acb5c7ba /fs/ceph | |
parent | cd84db6e4051a9fb7941d49d31a0193a3371fd61 (diff) |
ceph: track laggy state of mds from mdsmap
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/mds_client.c | 4 | ||||
-rw-r--r-- | fs/ceph/mdsmap.c | 6 | ||||
-rw-r--r-- | fs/ceph/mdsmap.h | 8 |
3 files changed, 16 insertions, 2 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 774407f96ff1..6e40db2a0014 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -2377,9 +2377,11 @@ static void check_new_map(struct ceph_mds_client *mdsc, | |||
2377 | oldstate = ceph_mdsmap_get_state(oldmap, i); | 2377 | oldstate = ceph_mdsmap_get_state(oldmap, i); |
2378 | newstate = ceph_mdsmap_get_state(newmap, i); | 2378 | newstate = ceph_mdsmap_get_state(newmap, i); |
2379 | 2379 | ||
2380 | dout("check_new_map mds%d state %s -> %s (session %s)\n", | 2380 | dout("check_new_map mds%d state %s%s -> %s%s (session %s)\n", |
2381 | i, ceph_mds_state_name(oldstate), | 2381 | i, ceph_mds_state_name(oldstate), |
2382 | ceph_mdsmap_is_laggy(oldmap, i) ? " (laggy)" : "", | ||
2382 | ceph_mds_state_name(newstate), | 2383 | ceph_mds_state_name(newstate), |
2384 | ceph_mdsmap_is_laggy(newmap, i) ? " (laggy)" : "", | ||
2383 | session_state_name(s->s_state)); | 2385 | session_state_name(s->s_state)); |
2384 | 2386 | ||
2385 | if (memcmp(ceph_mdsmap_get_addr(oldmap, i), | 2387 | if (memcmp(ceph_mdsmap_get_addr(oldmap, i), |
diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c index c4c498e6dfef..040be6d1150b 100644 --- a/fs/ceph/mdsmap.c +++ b/fs/ceph/mdsmap.c | |||
@@ -85,6 +85,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) | |||
85 | struct ceph_entity_addr addr; | 85 | struct ceph_entity_addr addr; |
86 | u32 num_export_targets; | 86 | u32 num_export_targets; |
87 | void *pexport_targets = NULL; | 87 | void *pexport_targets = NULL; |
88 | struct ceph_timespec laggy_since; | ||
88 | 89 | ||
89 | ceph_decode_need(p, end, sizeof(u64)*2 + 1 + sizeof(u32), bad); | 90 | ceph_decode_need(p, end, sizeof(u64)*2 + 1 + sizeof(u32), bad); |
90 | global_id = ceph_decode_64(p); | 91 | global_id = ceph_decode_64(p); |
@@ -103,7 +104,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) | |||
103 | state_seq = ceph_decode_64(p); | 104 | state_seq = ceph_decode_64(p); |
104 | ceph_decode_copy(p, &addr, sizeof(addr)); | 105 | ceph_decode_copy(p, &addr, sizeof(addr)); |
105 | ceph_decode_addr(&addr); | 106 | ceph_decode_addr(&addr); |
106 | *p += sizeof(struct ceph_timespec); | 107 | ceph_decode_copy(p, &laggy_since, sizeof(laggy_since)); |
107 | *p += sizeof(u32); | 108 | *p += sizeof(u32); |
108 | ceph_decode_32_safe(p, end, namelen, bad); | 109 | ceph_decode_32_safe(p, end, namelen, bad); |
109 | *p += namelen; | 110 | *p += namelen; |
@@ -122,6 +123,9 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) | |||
122 | m->m_info[mds].global_id = global_id; | 123 | m->m_info[mds].global_id = global_id; |
123 | m->m_info[mds].state = state; | 124 | m->m_info[mds].state = state; |
124 | m->m_info[mds].addr = addr; | 125 | m->m_info[mds].addr = addr; |
126 | m->m_info[mds].laggy = | ||
127 | (laggy_since.tv_sec != 0 || | ||
128 | laggy_since.tv_nsec != 0); | ||
125 | m->m_info[mds].num_export_targets = num_export_targets; | 129 | m->m_info[mds].num_export_targets = num_export_targets; |
126 | if (num_export_targets) { | 130 | if (num_export_targets) { |
127 | m->m_info[mds].export_targets = | 131 | m->m_info[mds].export_targets = |
diff --git a/fs/ceph/mdsmap.h b/fs/ceph/mdsmap.h index eacc131aa5cb..4c5cb0880bba 100644 --- a/fs/ceph/mdsmap.h +++ b/fs/ceph/mdsmap.h | |||
@@ -13,6 +13,7 @@ struct ceph_mds_info { | |||
13 | struct ceph_entity_addr addr; | 13 | struct ceph_entity_addr addr; |
14 | s32 state; | 14 | s32 state; |
15 | int num_export_targets; | 15 | int num_export_targets; |
16 | bool laggy; | ||
16 | u32 *export_targets; | 17 | u32 *export_targets; |
17 | }; | 18 | }; |
18 | 19 | ||
@@ -47,6 +48,13 @@ static inline int ceph_mdsmap_get_state(struct ceph_mdsmap *m, int w) | |||
47 | return m->m_info[w].state; | 48 | return m->m_info[w].state; |
48 | } | 49 | } |
49 | 50 | ||
51 | static inline bool ceph_mdsmap_is_laggy(struct ceph_mdsmap *m, int w) | ||
52 | { | ||
53 | if (w >= 0 && w < m->m_max_mds) | ||
54 | return m->m_info[w].laggy; | ||
55 | return false; | ||
56 | } | ||
57 | |||
50 | extern int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m); | 58 | extern int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m); |
51 | extern struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end); | 59 | extern struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end); |
52 | extern void ceph_mdsmap_destroy(struct ceph_mdsmap *m); | 60 | extern void ceph_mdsmap_destroy(struct ceph_mdsmap *m); |