aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ceph
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2016-04-28 10:07:27 -0400
committerIlya Dryomov <idryomov@gmail.com>2016-05-25 19:15:29 -0400
commitd0b19705e99939f5ae5aa9b57bfe41dd4777d951 (patch)
tree22c6202c5fc1bf28ac95fdf2157329aa171270e5 /include/linux/ceph
parentb07d3c4bd7270c74e2b6803af8ac8a00cb3e5ed2 (diff)
libceph: async MON client generic requests
For map check, we are going to need to send CEPH_MSG_MON_GET_VERSION messages asynchronously and get a callback on completion. Refactor MON client to allow firing off generic requests asynchronously and add an async variant of ceph_monc_get_version(). ceph_monc_do_statfs() is switched over and remains sync. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'include/linux/ceph')
-rw-r--r--include/linux/ceph/mon_client.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/include/linux/ceph/mon_client.h b/include/linux/ceph/mon_client.h
index c14e9d861cda..19800d9b45f3 100644
--- a/include/linux/ceph/mon_client.h
+++ b/include/linux/ceph/mon_client.h
@@ -39,20 +39,31 @@ struct ceph_mon_request {
39 ceph_monc_request_func_t do_request; 39 ceph_monc_request_func_t do_request;
40}; 40};
41 41
42typedef void (*ceph_monc_callback_t)(struct ceph_mon_generic_request *);
43
42/* 44/*
43 * ceph_mon_generic_request is being used for the statfs and 45 * ceph_mon_generic_request is being used for the statfs and
44 * mon_get_version requests which are being done a bit differently 46 * mon_get_version requests which are being done a bit differently
45 * because we need to get data back to the caller 47 * because we need to get data back to the caller
46 */ 48 */
47struct ceph_mon_generic_request { 49struct ceph_mon_generic_request {
50 struct ceph_mon_client *monc;
48 struct kref kref; 51 struct kref kref;
49 u64 tid; 52 u64 tid;
50 struct rb_node node; 53 struct rb_node node;
51 int result; 54 int result;
52 void *buf; 55
53 struct completion completion; 56 struct completion completion;
57 ceph_monc_callback_t complete_cb;
58 u64 private_data; /* r_tid/linger_id */
59
54 struct ceph_msg *request; /* original request */ 60 struct ceph_msg *request; /* original request */
55 struct ceph_msg *reply; /* and reply */ 61 struct ceph_msg *reply; /* and reply */
62
63 union {
64 struct ceph_statfs *st;
65 u64 newest;
66 } u;
56}; 67};
57 68
58struct ceph_mon_client { 69struct ceph_mon_client {
@@ -124,8 +135,10 @@ extern int ceph_monc_wait_osdmap(struct ceph_mon_client *monc, u32 epoch,
124extern int ceph_monc_do_statfs(struct ceph_mon_client *monc, 135extern int ceph_monc_do_statfs(struct ceph_mon_client *monc,
125 struct ceph_statfs *buf); 136 struct ceph_statfs *buf);
126 137
127extern int ceph_monc_do_get_version(struct ceph_mon_client *monc, 138int ceph_monc_get_version(struct ceph_mon_client *monc, const char *what,
128 const char *what, u64 *newest); 139 u64 *newest);
140int ceph_monc_get_version_async(struct ceph_mon_client *monc, const char *what,
141 ceph_monc_callback_t cb, u64 private_data);
129 142
130extern int ceph_monc_open_session(struct ceph_mon_client *monc); 143extern int ceph_monc_open_session(struct ceph_mon_client *monc);
131 144