Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mdsmap.h
Go to the documentation of this file.
1 #ifndef _FS_CEPH_MDSMAP_H
2 #define _FS_CEPH_MDSMAP_H
3 
4 #include <linux/bug.h>
5 #include <linux/ceph/types.h>
6 
7 /*
8  * mds map - describe servers in the mds cluster.
9  *
10  * we limit fields to those the client actually xcares about
11  */
12 struct ceph_mds_info {
17  bool laggy;
19 };
20 
21 struct ceph_mdsmap {
24  u32 m_session_timeout; /* seconds */
25  u32 m_session_autoclose; /* seconds */
27  u32 m_max_mds; /* size of m_addr, m_state arrays */
29 
30  /* which object pools file data can be stored in */
34 };
35 
36 static inline struct ceph_entity_addr *
37 ceph_mdsmap_get_addr(struct ceph_mdsmap *m, int w)
38 {
39  if (w >= m->m_max_mds)
40  return NULL;
41  return &m->m_info[w].addr;
42 }
43 
44 static inline int ceph_mdsmap_get_state(struct ceph_mdsmap *m, int w)
45 {
46  BUG_ON(w < 0);
47  if (w >= m->m_max_mds)
48  return CEPH_MDS_STATE_DNE;
49  return m->m_info[w].state;
50 }
51 
52 static inline bool ceph_mdsmap_is_laggy(struct ceph_mdsmap *m, int w)
53 {
54  if (w >= 0 && w < m->m_max_mds)
55  return m->m_info[w].laggy;
56  return false;
57 }
58 
59 extern int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m);
60 extern struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end);
61 extern void ceph_mdsmap_destroy(struct ceph_mdsmap *m);
62 
63 #endif