diff options
author | Sage Weil <sage@newdream.net> | 2009-11-19 18:31:50 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-11-20 17:24:33 -0500 |
commit | 94045e115ee72aee3b17295791da07078f2f778c (patch) | |
tree | bc38f3425b15995709ee4f698246b2febffff515 /fs/ceph/mdsmap.c | |
parent | 0743304d871559cb4c7c066357de2caa60e94c2f (diff) |
ceph: decode updated mdsmap format
The mds map now uses the global_id as the 'key' (instead of the addr,
which was a poor choice).
This is protocol change.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/mdsmap.c')
-rw-r--r-- | fs/ceph/mdsmap.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c index 4226c810ce22..cad8d25861e5 100644 --- a/fs/ceph/mdsmap.c +++ b/fs/ceph/mdsmap.c | |||
@@ -76,6 +76,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) | |||
76 | /* pick out active nodes from mds_info (state > 0) */ | 76 | /* pick out active nodes from mds_info (state > 0) */ |
77 | n = ceph_decode_32(p); | 77 | n = ceph_decode_32(p); |
78 | for (i = 0; i < n; i++) { | 78 | for (i = 0; i < n; i++) { |
79 | u64 global_id; | ||
79 | u32 namelen; | 80 | u32 namelen; |
80 | s32 mds, inc, state; | 81 | s32 mds, inc, state; |
81 | u64 state_seq; | 82 | u64 state_seq; |
@@ -84,10 +85,10 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) | |||
84 | u32 num_export_targets; | 85 | u32 num_export_targets; |
85 | void *pexport_targets = NULL; | 86 | void *pexport_targets = NULL; |
86 | 87 | ||
87 | ceph_decode_need(p, end, sizeof(addr) + 1 + sizeof(u32), bad); | 88 | ceph_decode_need(p, end, sizeof(u64)*2 + 1 + sizeof(u32), bad); |
88 | ceph_decode_copy(p, &addr, sizeof(addr)); | 89 | global_id = ceph_decode_64(p); |
89 | ceph_decode_addr(&addr); | ||
90 | infoversion = ceph_decode_8(p); | 90 | infoversion = ceph_decode_8(p); |
91 | *p += sizeof(u64); | ||
91 | namelen = ceph_decode_32(p); /* skip mds name */ | 92 | namelen = ceph_decode_32(p); /* skip mds name */ |
92 | *p += namelen; | 93 | *p += namelen; |
93 | 94 | ||
@@ -99,7 +100,8 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) | |||
99 | inc = ceph_decode_32(p); | 100 | inc = ceph_decode_32(p); |
100 | state = ceph_decode_32(p); | 101 | state = ceph_decode_32(p); |
101 | state_seq = ceph_decode_64(p); | 102 | state_seq = ceph_decode_64(p); |
102 | *p += sizeof(addr); | 103 | ceph_decode_copy(p, &addr, sizeof(addr)); |
104 | ceph_decode_addr(&addr); | ||
103 | *p += sizeof(struct ceph_timespec); | 105 | *p += sizeof(struct ceph_timespec); |
104 | *p += sizeof(u32); | 106 | *p += sizeof(u32); |
105 | ceph_decode_32_safe(p, end, namelen, bad); | 107 | ceph_decode_32_safe(p, end, namelen, bad); |
@@ -112,10 +114,11 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) | |||
112 | num_export_targets = 0; | 114 | num_export_targets = 0; |
113 | } | 115 | } |
114 | 116 | ||
115 | dout("mdsmap_decode %d/%d mds%d.%d %s %s\n", | 117 | dout("mdsmap_decode %d/%d %lld mds%d.%d %s %s\n", |
116 | i+1, n, mds, inc, pr_addr(&addr.in_addr), | 118 | i+1, n, global_id, mds, inc, pr_addr(&addr.in_addr), |
117 | ceph_mds_state_name(state)); | 119 | ceph_mds_state_name(state)); |
118 | if (mds >= 0 && mds < m->m_max_mds && state > 0) { | 120 | if (mds >= 0 && mds < m->m_max_mds && state > 0) { |
121 | m->m_info[mds].global_id = global_id; | ||
119 | m->m_info[mds].state = state; | 122 | m->m_info[mds].state = state; |
120 | m->m_info[mds].addr = addr; | 123 | m->m_info[mds].addr = addr; |
121 | m->m_info[mds].num_export_targets = num_export_targets; | 124 | m->m_info[mds].num_export_targets = num_export_targets; |