aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/mdsmap.h
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-10-06 14:31:09 -0400
committerSage Weil <sage@newdream.net>2009-10-06 14:31:09 -0400
commit2f2dc053404febedc9c273452d9d518fb31fde72 (patch)
tree286ff35153d0b52349e035a69f3f795fdcb0afb6 /fs/ceph/mdsmap.h
parent1d3576fd10f0d7a104204267b81cf84a07028dad (diff)
ceph: MDS client
The MDS (metadata server) client is responsible for submitting requests to the MDS cluster and parsing the response. We decide which MDS to submit each request to based on cached information about the current partition of the directory hierarchy across the cluster. A stateful session is opened with each MDS before we submit requests to it, and a mutex is used to control the ordering of messages within each session. An MDS request may generate two responses. The first indicates the operation was a success and returns any result. A second reply is sent when the operation commits to disk. Note that locking on the MDS ensures that the results of updates are visible only to the updating client before the operation commits. Requests are linked to the containing directory so that an fsync will wait for them to commit. If an MDS fails and/or recovers, we resubmit requests as needed. We also reconnect existing capabilities to a recovering MDS to reestablish that shared session state. Old dentry leases are invalidated. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/mdsmap.h')
-rw-r--r--fs/ceph/mdsmap.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/fs/ceph/mdsmap.h b/fs/ceph/mdsmap.h
new file mode 100644
index 000000000000..d317308648fb
--- /dev/null
+++ b/fs/ceph/mdsmap.h
@@ -0,0 +1,53 @@
1#ifndef _FS_CEPH_MDSMAP_H
2#define _FS_CEPH_MDSMAP_H
3
4#include "types.h"
5
6/*
7 * mds map - describe servers in the mds cluster.
8 *
9 * we limit fields to those the client actually xcares about
10 */
11struct ceph_mds_info {
12 struct ceph_entity_addr addr;
13 s32 state;
14 int num_export_targets;
15 u32 *export_targets;
16};
17
18struct ceph_mdsmap {
19 u32 m_epoch, m_client_epoch, m_last_failure;
20 u32 m_root;
21 u32 m_session_timeout; /* seconds */
22 u32 m_session_autoclose; /* seconds */
23 u64 m_max_file_size;
24 u32 m_max_mds; /* size of m_addr, m_state arrays */
25 struct ceph_mds_info *m_info;
26
27 /* which object pools file data can be stored in */
28 int m_num_data_pg_pools;
29 u32 *m_data_pg_pools;
30 u32 m_cas_pg_pool;
31};
32
33static inline struct ceph_entity_addr *
34ceph_mdsmap_get_addr(struct ceph_mdsmap *m, int w)
35{
36 if (w >= m->m_max_mds)
37 return NULL;
38 return &m->m_info[w].addr;
39}
40
41static inline int ceph_mdsmap_get_state(struct ceph_mdsmap *m, int w)
42{
43 BUG_ON(w < 0);
44 if (w >= m->m_max_mds)
45 return CEPH_MDS_STATE_DNE;
46 return m->m_info[w].state;
47}
48
49extern int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m);
50extern struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end);
51extern void ceph_mdsmap_destroy(struct ceph_mdsmap *m);
52
53#endif