blob: d317308648fb6dcc0d1360c5453b38911f00ebde [file] [log] [blame]
Sage Weil2f2dc052009-10-06 11:31:09 -07001#ifndef _FS_CEPH_MDSMAP_H
2#define _FS_CEPH_MDSMAP_H
3
4#include "types.h"
5
6/*
7 * mds map - describe servers in the mds cluster.
8 *
9 * we limit fields to those the client actually xcares about
10 */
11struct ceph_mds_info {
12 struct ceph_entity_addr addr;
13 s32 state;
14 int num_export_targets;
15 u32 *export_targets;
16};
17
18struct ceph_mdsmap {
19 u32 m_epoch, m_client_epoch, m_last_failure;
20 u32 m_root;
21 u32 m_session_timeout; /* seconds */
22 u32 m_session_autoclose; /* seconds */
23 u64 m_max_file_size;
24 u32 m_max_mds; /* size of m_addr, m_state arrays */
25 struct ceph_mds_info *m_info;
26
27 /* which object pools file data can be stored in */
28 int m_num_data_pg_pools;
29 u32 *m_data_pg_pools;
30 u32 m_cas_pg_pool;
31};
32
33static inline struct ceph_entity_addr *
34ceph_mdsmap_get_addr(struct ceph_mdsmap *m, int w)
35{
36 if (w >= m->m_max_mds)
37 return NULL;
38 return &m->m_info[w].addr;
39}
40
41static inline int ceph_mdsmap_get_state(struct ceph_mdsmap *m, int w)
42{
43 BUG_ON(w < 0);
44 if (w >= m->m_max_mds)
45 return CEPH_MDS_STATE_DNE;
46 return m->m_info[w].state;
47}
48
49extern int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m);
50extern struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end);
51extern void ceph_mdsmap_destroy(struct ceph_mdsmap *m);
52
53#endif