]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2f2dc053 SW |
2 | #ifndef _FS_CEPH_MDSMAP_H |
3 | #define _FS_CEPH_MDSMAP_H | |
4 | ||
187f1882 | 5 | #include <linux/bug.h> |
a1ce3928 | 6 | #include <linux/ceph/types.h> |
2f2dc053 SW |
7 | |
8 | /* | |
9 | * mds map - describe servers in the mds cluster. | |
10 | * | |
11 | * we limit fields to those the client actually xcares about | |
12 | */ | |
13 | struct ceph_mds_info { | |
94045e11 | 14 | u64 global_id; |
2f2dc053 SW |
15 | struct ceph_entity_addr addr; |
16 | s32 state; | |
17 | int num_export_targets; | |
0deb01c9 | 18 | bool laggy; |
2f2dc053 SW |
19 | u32 *export_targets; |
20 | }; | |
21 | ||
22 | struct ceph_mdsmap { | |
23 | u32 m_epoch, m_client_epoch, m_last_failure; | |
24 | u32 m_root; | |
25 | u32 m_session_timeout; /* seconds */ | |
26 | u32 m_session_autoclose; /* seconds */ | |
27 | u64 m_max_file_size; | |
28 | u32 m_max_mds; /* size of m_addr, m_state arrays */ | |
76201b63 | 29 | int m_num_mds; |
2f2dc053 SW |
30 | struct ceph_mds_info *m_info; |
31 | ||
32 | /* which object pools file data can be stored in */ | |
33 | int m_num_data_pg_pools; | |
4f6a7e5e SW |
34 | u64 *m_data_pg_pools; |
35 | u64 m_cas_pg_pool; | |
e9e427f0 YZ |
36 | |
37 | bool m_enabled; | |
38 | bool m_damaged; | |
39 | int m_num_laggy; | |
2f2dc053 SW |
40 | }; |
41 | ||
42 | static inline struct ceph_entity_addr * | |
43 | ceph_mdsmap_get_addr(struct ceph_mdsmap *m, int w) | |
44 | { | |
76201b63 | 45 | if (w >= m->m_num_mds) |
2f2dc053 SW |
46 | return NULL; |
47 | return &m->m_info[w].addr; | |
48 | } | |
49 | ||
50 | static inline int ceph_mdsmap_get_state(struct ceph_mdsmap *m, int w) | |
51 | { | |
52 | BUG_ON(w < 0); | |
76201b63 | 53 | if (w >= m->m_num_mds) |
2f2dc053 SW |
54 | return CEPH_MDS_STATE_DNE; |
55 | return m->m_info[w].state; | |
56 | } | |
57 | ||
0deb01c9 SW |
58 | static inline bool ceph_mdsmap_is_laggy(struct ceph_mdsmap *m, int w) |
59 | { | |
76201b63 | 60 | if (w >= 0 && w < m->m_num_mds) |
0deb01c9 SW |
61 | return m->m_info[w].laggy; |
62 | return false; | |
63 | } | |
64 | ||
2f2dc053 SW |
65 | extern int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m); |
66 | extern struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end); | |
67 | extern void ceph_mdsmap_destroy(struct ceph_mdsmap *m); | |
e9e427f0 | 68 | extern bool ceph_mdsmap_is_cluster_available(struct ceph_mdsmap *m); |
2f2dc053 SW |
69 | |
70 | #endif |