Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _FS_CEPH_MDSMAP_H
0003 #define _FS_CEPH_MDSMAP_H
0004 
0005 #include <linux/bug.h>
0006 #include <linux/ceph/types.h>
0007 
0008 /*
0009  * mds map - describe servers in the mds cluster.
0010  *
0011  * we limit fields to those the client actually xcares about
0012  */
0013 struct ceph_mds_info {
0014     u64 global_id;
0015     struct ceph_entity_addr addr;
0016     s32 state;
0017     int num_export_targets;
0018     bool laggy;
0019     u32 *export_targets;
0020 };
0021 
0022 struct ceph_mdsmap {
0023     u32 m_epoch, m_client_epoch, m_last_failure;
0024     u32 m_root;
0025     u32 m_session_timeout;          /* seconds */
0026     u32 m_session_autoclose;        /* seconds */
0027     u64 m_max_file_size;
0028     u64 m_max_xattr_size;       /* maximum size for xattrs blob */
0029     u32 m_max_mds;          /* expected up:active mds number */
0030     u32 m_num_active_mds;       /* actual up:active mds number */
0031     u32 possible_max_rank;      /* possible max rank index */
0032     struct ceph_mds_info *m_info;
0033 
0034     /* which object pools file data can be stored in */
0035     int m_num_data_pg_pools;
0036     u64 *m_data_pg_pools;
0037     u64 m_cas_pg_pool;
0038 
0039     bool m_enabled;
0040     bool m_damaged;
0041     int m_num_laggy;
0042 };
0043 
0044 static inline struct ceph_entity_addr *
0045 ceph_mdsmap_get_addr(struct ceph_mdsmap *m, int w)
0046 {
0047     if (w >= m->possible_max_rank)
0048         return NULL;
0049     return &m->m_info[w].addr;
0050 }
0051 
0052 static inline int ceph_mdsmap_get_state(struct ceph_mdsmap *m, int w)
0053 {
0054     BUG_ON(w < 0);
0055     if (w >= m->possible_max_rank)
0056         return CEPH_MDS_STATE_DNE;
0057     return m->m_info[w].state;
0058 }
0059 
0060 static inline bool ceph_mdsmap_is_laggy(struct ceph_mdsmap *m, int w)
0061 {
0062     if (w >= 0 && w < m->possible_max_rank)
0063         return m->m_info[w].laggy;
0064     return false;
0065 }
0066 
0067 extern int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m);
0068 struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2);
0069 extern void ceph_mdsmap_destroy(struct ceph_mdsmap *m);
0070 extern bool ceph_mdsmap_is_cluster_available(struct ceph_mdsmap *m);
0071 
0072 #endif