aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ceph/mon_client.h
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2016-01-19 10:19:06 -0500
committerIlya Dryomov <idryomov@gmail.com>2016-03-25 13:51:38 -0400
commit82dcabad750a36a2b749889bc89c5a3188775b2e (patch)
tree26fcfa10f290b53b34ab5c3019338ca2da3a9569 /include/linux/ceph/mon_client.h
parent0f9af169a1db62c33d87e4cfda46493907bd5537 (diff)
libceph: revamp subs code, switch to SUBSCRIBE2 protocol
It is currently hard-coded in the mon_client that mdsmap and monmap subs are continuous, while osdmap sub is always "onetime". To better handle full clusters/pools in the osd_client, we need to be able to issue continuous osdmap subs. Revamp subs code to allow us to specify for each sub whether it should be continuous or not. Although not strictly required for the above, switch to SUBSCRIBE2 protocol while at it, eliminating the ambiguity between a request for "every map since X" and a request for "just the latest" when we don't have a map yet (i.e. have epoch 0). SUBSCRIBE2 feature bit is now required - it's been supported since pre-argonaut (2010). Move "got mdsmap" call to the end of ceph_mdsc_handle_map() - calling in before we validate the epoch and successfully install the new map can mess up mon_client sub state. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'include/linux/ceph/mon_client.h')
-rw-r--r--include/linux/ceph/mon_client.h28
1 files changed, 20 insertions, 8 deletions
diff --git a/include/linux/ceph/mon_client.h b/include/linux/ceph/mon_client.h
index 81810dc21f06..8b2d2f0b659e 100644
--- a/include/linux/ceph/mon_client.h
+++ b/include/linux/ceph/mon_client.h
@@ -68,7 +68,8 @@ struct ceph_mon_client {
68 68
69 bool hunting; 69 bool hunting;
70 int cur_mon; /* last monitor i contacted */ 70 int cur_mon; /* last monitor i contacted */
71 unsigned long sub_sent, sub_renew_after; 71 unsigned long sub_renew_after;
72 unsigned long sub_renew_sent;
72 struct ceph_connection con; 73 struct ceph_connection con;
73 74
74 /* pending generic requests */ 75 /* pending generic requests */
@@ -76,10 +77,12 @@ struct ceph_mon_client {
76 int num_generic_requests; 77 int num_generic_requests;
77 u64 last_tid; 78 u64 last_tid;
78 79
79 /* mds/osd map */ 80 /* subs, indexed with CEPH_SUB_* */
80 int want_mdsmap; 81 struct {
81 int want_next_osdmap; /* 1 = want, 2 = want+asked */ 82 struct ceph_mon_subscribe_item item;
82 u32 have_osdmap, have_mdsmap; 83 bool want;
84 u32 have; /* epoch */
85 } subs[3];
83 86
84#ifdef CONFIG_DEBUG_FS 87#ifdef CONFIG_DEBUG_FS
85 struct dentry *debugfs_file; 88 struct dentry *debugfs_file;
@@ -93,14 +96,23 @@ extern int ceph_monmap_contains(struct ceph_monmap *m,
93extern int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl); 96extern int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl);
94extern void ceph_monc_stop(struct ceph_mon_client *monc); 97extern void ceph_monc_stop(struct ceph_mon_client *monc);
95 98
99enum {
100 CEPH_SUB_MDSMAP = 0,
101 CEPH_SUB_MONMAP,
102 CEPH_SUB_OSDMAP,
103};
104
105extern const char *ceph_sub_str[];
106
96/* 107/*
97 * The model here is to indicate that we need a new map of at least 108 * The model here is to indicate that we need a new map of at least
98 * epoch @want, and also call in when we receive a map. We will 109 * epoch @epoch, and also call in when we receive a map. We will
99 * periodically rerequest the map from the monitor cluster until we 110 * periodically rerequest the map from the monitor cluster until we
100 * get what we want. 111 * get what we want.
101 */ 112 */
102extern int ceph_monc_got_mdsmap(struct ceph_mon_client *monc, u32 have); 113bool ceph_monc_want_map(struct ceph_mon_client *monc, int sub, u32 epoch,
103extern int ceph_monc_got_osdmap(struct ceph_mon_client *monc, u32 have); 114 bool continuous);
115void ceph_monc_got_map(struct ceph_mon_client *monc, int sub, u32 epoch);
104 116
105extern void ceph_monc_request_next_osdmap(struct ceph_mon_client *monc); 117extern void ceph_monc_request_next_osdmap(struct ceph_mon_client *monc);
106extern int ceph_monc_wait_osdmap(struct ceph_mon_client *monc, u32 epoch, 118extern int ceph_monc_wait_osdmap(struct ceph_mon_client *monc, u32 epoch,