staticint __mdsmap_get_random_mds(struct ceph_mdsmap *m, bool ignore_laggy)
{ int n = 0; int i, j;
/* count */ for (i = 0; i < m->possible_max_rank; i++) if (CEPH_MDS_IS_READY(i, ignore_laggy))
n++; if (n == 0) return -1;
/* pick */
n = get_random_u32_below(n); for (j = 0, i = 0; i < m->possible_max_rank; i++) { if (CEPH_MDS_IS_READY(i, ignore_laggy))
j++; if (j > n) break;
}
return i;
}
/* * choose a random mds that is "up" (i.e. has a state > 0), or -1.
*/ int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m)
{ int mds;
/* * Decode an MDS map * * Ignore any fields we don't care about (there are quite a few of * them).
*/ struct ceph_mdsmap *ceph_mdsmap_decode(struct ceph_mds_client *mdsc, void **p, void *end, bool msgr2)
{ struct ceph_client *cl = mdsc->fsc->client; struct ceph_mdsmap *m; constvoid *start = *p; int i, j, n; int err;
u8 mdsmap_v;
u16 mdsmap_ev;
u32 target;
m = kzalloc(sizeof(*m), GFP_NOFS); if (!m) return ERR_PTR(-ENOMEM);
/* * pick out the active nodes as the m_num_active_mds, the * m_num_active_mds maybe larger than m_max_mds when decreasing * the max_mds in cluster side, in other case it should less * than or equal to m_max_mds.
*/
m->m_num_active_mds = n = ceph_decode_32(p);
/* * the possible max rank, it maybe larger than the m_num_active_mds, * for example if the mds_max == 2 in the cluster, when the MDS(0) * was laggy and being replaced by a new MDS, we will temporarily * receive a new mds map with n_num_mds == 1 and the active MDS(1), * and the mds rank >= m_num_active_mds.
*/
m->possible_max_rank = max(m->m_num_active_mds, m->m_max_mds);
m->m_info = kcalloc(m->possible_max_rank, sizeof(*m->m_info), GFP_NOFS); if (!m->m_info) goto nomem;
/* pick out active nodes from mds_info (state > 0) */ for (i = 0; i < n; i++) {
u64 global_id;
u32 namelen;
s32 mds, inc, state;
u8 info_v; void *info_end = NULL; struct ceph_entity_addr addr;
u32 num_export_targets; void *pexport_targets = NULL; struct ceph_timespec laggy_since; struct ceph_mds_info *info; bool laggy;
void ceph_mdsmap_destroy(struct ceph_mdsmap *m)
{ int i;
if (m->m_info) { for (i = 0; i < m->possible_max_rank; i++)
kfree(m->m_info[i].export_targets);
kfree(m->m_info);
}
kfree(m->m_data_pg_pools);
kfree(m);
}
bool ceph_mdsmap_is_cluster_available(struct ceph_mdsmap *m)
{ int i, nr_active = 0; if (!m->m_enabled) returnfalse; if (m->m_damaged) returnfalse; if (m->m_num_laggy == m->m_num_active_mds) returnfalse; for (i = 0; i < m->possible_max_rank; i++) { if (m->m_info[i].state == CEPH_MDS_STATE_ACTIVE)
nr_active++;
} return nr_active > 0;
}
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.