]> Git Repo - linux.git/blame - fs/ceph/mdsmap.h
Merge tag 'pwm/for-6.7-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / fs / ceph / mdsmap.h
CommitLineData
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 7
197b7d79
XL
8struct ceph_mds_client;
9
2f2dc053
SW
10/*
11 * mds map - describe servers in the mds cluster.
12 *
13 * we limit fields to those the client actually xcares about
14 */
15struct ceph_mds_info {
94045e11 16 u64 global_id;
2f2dc053
SW
17 struct ceph_entity_addr addr;
18 s32 state;
19 int num_export_targets;
0deb01c9 20 bool laggy;
2f2dc053
SW
21 u32 *export_targets;
22};
23
24struct ceph_mdsmap {
25 u32 m_epoch, m_client_epoch, m_last_failure;
26 u32 m_root;
27 u32 m_session_timeout; /* seconds */
28 u32 m_session_autoclose; /* seconds */
29 u64 m_max_file_size;
d93231a6 30 u64 m_max_xattr_size; /* maximum size for xattrs blob */
4d7ace02 31 u32 m_max_mds; /* expected up:active mds number */
b38c9eb4
XL
32 u32 m_num_active_mds; /* actual up:active mds number */
33 u32 possible_max_rank; /* possible max rank index */
2f2dc053
SW
34 struct ceph_mds_info *m_info;
35
36 /* which object pools file data can be stored in */
37 int m_num_data_pg_pools;
4f6a7e5e
SW
38 u64 *m_data_pg_pools;
39 u64 m_cas_pg_pool;
e9e427f0
YZ
40
41 bool m_enabled;
42 bool m_damaged;
43 int m_num_laggy;
2f2dc053
SW
44};
45
46static inline struct ceph_entity_addr *
47ceph_mdsmap_get_addr(struct ceph_mdsmap *m, int w)
48{
b38c9eb4 49 if (w >= m->possible_max_rank)
2f2dc053
SW
50 return NULL;
51 return &m->m_info[w].addr;
52}
53
54static inline int ceph_mdsmap_get_state(struct ceph_mdsmap *m, int w)
55{
56 BUG_ON(w < 0);
b38c9eb4 57 if (w >= m->possible_max_rank)
2f2dc053
SW
58 return CEPH_MDS_STATE_DNE;
59 return m->m_info[w].state;
60}
61
0deb01c9
SW
62static inline bool ceph_mdsmap_is_laggy(struct ceph_mdsmap *m, int w)
63{
b38c9eb4 64 if (w >= 0 && w < m->possible_max_rank)
0deb01c9
SW
65 return m->m_info[w].laggy;
66 return false;
67}
68
2f2dc053 69extern int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m);
197b7d79
XL
70struct ceph_mdsmap *ceph_mdsmap_decode(struct ceph_mds_client *mdsc, void **p,
71 void *end, bool msgr2);
2f2dc053 72extern void ceph_mdsmap_destroy(struct ceph_mdsmap *m);
e9e427f0 73extern bool ceph_mdsmap_is_cluster_available(struct ceph_mdsmap *m);
2f2dc053
SW
74
75#endif
This page took 1.371201 seconds and 4 git commands to generate.