5 #include <linux/random.h>
6 #include <linux/slab.h>
7 #include <linux/types.h>
27 if (m->
m_info[i].state > 0)
36 for (i = 0; n > 0; i++, n--)
37 while (m->
m_info[i].state <= 0)
67 m->
m_root = ceph_decode_32(p);
78 n = ceph_decode_32(p);
79 for (i = 0; i <
n; i++) {
86 u32 num_export_targets;
87 void *pexport_targets =
NULL;
91 global_id = ceph_decode_64(p);
92 infoversion = ceph_decode_8(p);
94 namelen = ceph_decode_32(p);
98 4*
sizeof(
u32) +
sizeof(
u64) +
101 mds = ceph_decode_32(p);
102 inc = ceph_decode_32(p);
103 state = ceph_decode_32(p);
104 state_seq = ceph_decode_64(p);
105 ceph_decode_copy(p, &addr,
sizeof(addr));
106 ceph_decode_addr(&addr);
107 ceph_decode_copy(p, &laggy_since,
sizeof(laggy_since));
111 if (infoversion >= 2) {
113 pexport_targets = *
p;
114 *p += num_export_targets *
sizeof(
u32);
116 num_export_targets = 0;
119 dout(
"mdsmap_decode %d/%d %lld mds%d.%d %s %s\n",
120 i+1, n, global_id, mds, inc,
123 if (mds >= 0 && mds < m->m_max_mds && state > 0) {
128 (laggy_since.
tv_sec != 0 ||
130 m->
m_info[mds].num_export_targets = num_export_targets;
131 if (num_export_targets) {
132 m->
m_info[mds].export_targets =
133 kcalloc(num_export_targets,
sizeof(
u32),
135 for (j = 0; j < num_export_targets; j++)
136 m->
m_info[mds].export_targets[j] =
137 ceph_decode_32(&pexport_targets);
151 for (i = 0; i <
n; i++)
156 dout(
"mdsmap_decode success epoch %u\n", m->
m_epoch);
162 pr_err(
"corrupt mdsmap\n");
165 start, end - start,
true);