mdsmap.h 1.2 KB

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