aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-11-19 18:31:50 -0500
committerSage Weil <sage@newdream.net>2009-11-20 17:24:33 -0500
commit94045e115ee72aee3b17295791da07078f2f778c (patch)
treebc38f3425b15995709ee4f698246b2febffff515
parent0743304d871559cb4c7c066357de2caa60e94c2f (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>
-rw-r--r--fs/ceph/ceph_fs.h2
-rw-r--r--fs/ceph/mdsmap.c15
-rw-r--r--fs/ceph/mdsmap.h1
3 files changed, 11 insertions, 7 deletions
diff --git a/fs/ceph/ceph_fs.h b/fs/ceph/ceph_fs.h
index 1e96a9a87d8..4e5f49c738d 100644
--- a/fs/ceph/ceph_fs.h
+++ b/fs/ceph/ceph_fs.h
@@ -39,7 +39,7 @@
39#define CEPH_MDS_PROTOCOL 9 /* cluster internal */ 39#define CEPH_MDS_PROTOCOL 9 /* cluster internal */
40#define CEPH_MON_PROTOCOL 5 /* cluster internal */ 40#define CEPH_MON_PROTOCOL 5 /* cluster internal */
41#define CEPH_OSDC_PROTOCOL 22 /* server/client */ 41#define CEPH_OSDC_PROTOCOL 22 /* server/client */
42#define CEPH_MDSC_PROTOCOL 29 /* server/client */ 42#define CEPH_MDSC_PROTOCOL 30 /* server/client */
43#define CEPH_MONC_PROTOCOL 15 /* server/client */ 43#define CEPH_MONC_PROTOCOL 15 /* server/client */
44 44
45 45
diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c
index 4226c810ce2..cad8d25861e 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;
diff --git a/fs/ceph/mdsmap.h b/fs/ceph/mdsmap.h
index d317308648f..eacc131aa5c 100644
--- a/fs/ceph/mdsmap.h
+++ b/fs/ceph/mdsmap.h
@@ -9,6 +9,7 @@
9 * we limit fields to those the client actually xcares about 9 * we limit fields to those the client actually xcares about
10 */ 10 */
11struct ceph_mds_info { 11struct ceph_mds_info {
12 u64 global_id;
12 struct ceph_entity_addr addr; 13 struct ceph_entity_addr addr;
13 s32 state; 14 s32 state;
14 int num_export_targets; 15 int num_export_targets;