diff options
Diffstat (limited to 'include/linux/ceph')
| -rw-r--r-- | include/linux/ceph/osd_client.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index e791b8e46353..f88eacb111d4 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h | |||
| @@ -32,6 +32,7 @@ struct ceph_osd { | |||
| 32 | struct rb_node o_node; | 32 | struct rb_node o_node; |
| 33 | struct ceph_connection o_con; | 33 | struct ceph_connection o_con; |
| 34 | struct list_head o_requests; | 34 | struct list_head o_requests; |
| 35 | struct list_head o_linger_requests; | ||
| 35 | struct list_head o_osd_lru; | 36 | struct list_head o_osd_lru; |
| 36 | struct ceph_authorizer *o_authorizer; | 37 | struct ceph_authorizer *o_authorizer; |
| 37 | void *o_authorizer_buf, *o_authorizer_reply_buf; | 38 | void *o_authorizer_buf, *o_authorizer_reply_buf; |
| @@ -47,6 +48,8 @@ struct ceph_osd_request { | |||
| 47 | struct rb_node r_node; | 48 | struct rb_node r_node; |
| 48 | struct list_head r_req_lru_item; | 49 | struct list_head r_req_lru_item; |
| 49 | struct list_head r_osd_item; | 50 | struct list_head r_osd_item; |
| 51 | struct list_head r_linger_item; | ||
| 52 | struct list_head r_linger_osd; | ||
| 50 | struct ceph_osd *r_osd; | 53 | struct ceph_osd *r_osd; |
| 51 | struct ceph_pg r_pgid; | 54 | struct ceph_pg r_pgid; |
| 52 | int r_pg_osds[CEPH_PG_MAX_SIZE]; | 55 | int r_pg_osds[CEPH_PG_MAX_SIZE]; |
| @@ -59,6 +62,7 @@ struct ceph_osd_request { | |||
| 59 | int r_flags; /* any additional flags for the osd */ | 62 | int r_flags; /* any additional flags for the osd */ |
| 60 | u32 r_sent; /* >0 if r_request is sending/sent */ | 63 | u32 r_sent; /* >0 if r_request is sending/sent */ |
| 61 | int r_got_reply; | 64 | int r_got_reply; |
| 65 | int r_linger; | ||
| 62 | 66 | ||
| 63 | struct ceph_osd_client *r_osdc; | 67 | struct ceph_osd_client *r_osdc; |
| 64 | struct kref r_kref; | 68 | struct kref r_kref; |
| @@ -89,6 +93,26 @@ struct ceph_osd_request { | |||
| 89 | struct ceph_pagelist *r_trail; /* trailing part of the data */ | 93 | struct ceph_pagelist *r_trail; /* trailing part of the data */ |
| 90 | }; | 94 | }; |
| 91 | 95 | ||
| 96 | struct ceph_osd_event { | ||
| 97 | u64 cookie; | ||
| 98 | int one_shot; | ||
| 99 | struct ceph_osd_client *osdc; | ||
| 100 | void (*cb)(u64, u64, u8, void *); | ||
| 101 | void *data; | ||
| 102 | struct rb_node node; | ||
| 103 | struct list_head osd_node; | ||
| 104 | struct kref kref; | ||
| 105 | struct completion completion; | ||
| 106 | }; | ||
| 107 | |||
| 108 | struct ceph_osd_event_work { | ||
| 109 | struct work_struct work; | ||
| 110 | struct ceph_osd_event *event; | ||
| 111 | u64 ver; | ||
| 112 | u64 notify_id; | ||
| 113 | u8 opcode; | ||
| 114 | }; | ||
| 115 | |||
| 92 | struct ceph_osd_client { | 116 | struct ceph_osd_client { |
| 93 | struct ceph_client *client; | 117 | struct ceph_client *client; |
| 94 | 118 | ||
| @@ -106,6 +130,7 @@ struct ceph_osd_client { | |||
| 106 | struct list_head req_lru; /* in-flight lru */ | 130 | struct list_head req_lru; /* in-flight lru */ |
| 107 | struct list_head req_unsent; /* unsent/need-resend queue */ | 131 | struct list_head req_unsent; /* unsent/need-resend queue */ |
| 108 | struct list_head req_notarget; /* map to no osd */ | 132 | struct list_head req_notarget; /* map to no osd */ |
| 133 | struct list_head req_linger; /* lingering requests */ | ||
| 109 | int num_requests; | 134 | int num_requests; |
| 110 | struct delayed_work timeout_work; | 135 | struct delayed_work timeout_work; |
| 111 | struct delayed_work osds_timeout_work; | 136 | struct delayed_work osds_timeout_work; |
| @@ -117,6 +142,12 @@ struct ceph_osd_client { | |||
| 117 | 142 | ||
| 118 | struct ceph_msgpool msgpool_op; | 143 | struct ceph_msgpool msgpool_op; |
| 119 | struct ceph_msgpool msgpool_op_reply; | 144 | struct ceph_msgpool msgpool_op_reply; |
| 145 | |||
| 146 | spinlock_t event_lock; | ||
| 147 | struct rb_root event_tree; | ||
| 148 | u64 event_count; | ||
| 149 | |||
| 150 | struct workqueue_struct *notify_wq; | ||
| 120 | }; | 151 | }; |
| 121 | 152 | ||
| 122 | struct ceph_osd_req_op { | 153 | struct ceph_osd_req_op { |
| @@ -151,6 +182,13 @@ struct ceph_osd_req_op { | |||
| 151 | struct { | 182 | struct { |
| 152 | u64 snapid; | 183 | u64 snapid; |
| 153 | } snap; | 184 | } snap; |
| 185 | struct { | ||
| 186 | u64 cookie; | ||
| 187 | u64 ver; | ||
| 188 | __u8 flag; | ||
| 189 | u32 prot_ver; | ||
| 190 | u32 timeout; | ||
| 191 | } watch; | ||
| 154 | }; | 192 | }; |
| 155 | u32 payload_len; | 193 | u32 payload_len; |
| 156 | }; | 194 | }; |
| @@ -199,6 +237,11 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *, | |||
| 199 | bool use_mempool, int num_reply, | 237 | bool use_mempool, int num_reply, |
| 200 | int page_align); | 238 | int page_align); |
| 201 | 239 | ||
| 240 | extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc, | ||
| 241 | struct ceph_osd_request *req); | ||
| 242 | extern void ceph_osdc_unregister_linger_request(struct ceph_osd_client *osdc, | ||
| 243 | struct ceph_osd_request *req); | ||
| 244 | |||
| 202 | static inline void ceph_osdc_get_request(struct ceph_osd_request *req) | 245 | static inline void ceph_osdc_get_request(struct ceph_osd_request *req) |
| 203 | { | 246 | { |
| 204 | kref_get(&req->r_kref); | 247 | kref_get(&req->r_kref); |
| @@ -234,5 +277,14 @@ extern int ceph_osdc_writepages(struct ceph_osd_client *osdc, | |||
| 234 | struct page **pages, int nr_pages, | 277 | struct page **pages, int nr_pages, |
| 235 | int flags, int do_sync, bool nofail); | 278 | int flags, int do_sync, bool nofail); |
| 236 | 279 | ||
| 280 | /* watch/notify events */ | ||
| 281 | extern int ceph_osdc_create_event(struct ceph_osd_client *osdc, | ||
| 282 | void (*event_cb)(u64, u64, u8, void *), | ||
| 283 | int one_shot, void *data, | ||
| 284 | struct ceph_osd_event **pevent); | ||
| 285 | extern void ceph_osdc_cancel_event(struct ceph_osd_event *event); | ||
| 286 | extern int ceph_osdc_wait_event(struct ceph_osd_event *event, | ||
| 287 | unsigned long timeout); | ||
| 288 | extern void ceph_osdc_put_event(struct ceph_osd_event *event); | ||
| 237 | #endif | 289 | #endif |
| 238 | 290 | ||
