1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _FS_CEPH_MDSMAP_H
3 #define _FS_CEPH_MDSMAP_H
6 #include <linux/ceph/types.h>
8 struct ceph_mds_client;
11 * mds map - describe servers in the mds cluster.
13 * we limit fields to those the client actually xcares about
15 struct ceph_mds_info {
17 struct ceph_entity_addr addr;
19 int num_export_targets;
25 u32 m_epoch, m_client_epoch, m_last_failure;
27 u32 m_session_timeout; /* seconds */
28 u32 m_session_autoclose; /* seconds */
30 u64 m_max_xattr_size; /* maximum size for xattrs blob */
31 u32 m_max_mds; /* expected up:active mds number */
32 u32 m_num_active_mds; /* actual up:active mds number */
33 u32 possible_max_rank; /* possible max rank index */
34 struct ceph_mds_info *m_info;
36 /* which object pools file data can be stored in */
37 int m_num_data_pg_pools;
46 static inline struct ceph_entity_addr *
47 ceph_mdsmap_get_addr(struct ceph_mdsmap *m, int w)
49 if (w >= m->possible_max_rank)
51 return &m->m_info[w].addr;
54 static inline int ceph_mdsmap_get_state(struct ceph_mdsmap *m, int w)
57 if (w >= m->possible_max_rank)
58 return CEPH_MDS_STATE_DNE;
59 return m->m_info[w].state;
62 static inline bool ceph_mdsmap_is_laggy(struct ceph_mdsmap *m, int w)
64 if (w >= 0 && w < m->possible_max_rank)
65 return m->m_info[w].laggy;
69 extern int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m);
70 struct ceph_mdsmap *ceph_mdsmap_decode(struct ceph_mds_client *mdsc, void **p,
71 void *end, bool msgr2);
72 extern void ceph_mdsmap_destroy(struct ceph_mdsmap *m);
73 extern bool ceph_mdsmap_is_cluster_available(struct ceph_mdsmap *m);