diff options
Diffstat (limited to 'include/linux/ceph/osd_client.h')
| -rw-r--r-- | include/linux/ceph/osd_client.h | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index a1af29648fb5..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; |
| @@ -74,7 +78,6 @@ struct ceph_osd_request { | |||
| 74 | char r_oid[40]; /* object name */ | 78 | char r_oid[40]; /* object name */ |
| 75 | int r_oid_len; | 79 | int r_oid_len; |
| 76 | unsigned long r_stamp; /* send OR check time */ | 80 | unsigned long r_stamp; /* send OR check time */ |
| 77 | bool r_resend; /* msg send failed, needs retry */ | ||
| 78 | 81 | ||
| 79 | struct ceph_file_layout r_file_layout; | 82 | struct ceph_file_layout r_file_layout; |
| 80 | struct ceph_snap_context *r_snapc; /* snap context for writes */ | 83 | struct ceph_snap_context *r_snapc; /* snap context for writes */ |
| @@ -90,6 +93,26 @@ struct ceph_osd_request { | |||
| 90 | struct ceph_pagelist *r_trail; /* trailing part of the data */ | 93 | struct ceph_pagelist *r_trail; /* trailing part of the data */ |
| 91 | }; | 94 | }; |
| 92 | 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 | |||
| 93 | struct ceph_osd_client { | 116 | struct ceph_osd_client { |
| 94 | struct ceph_client *client; | 117 | struct ceph_client *client; |
| 95 | 118 | ||
| @@ -104,7 +127,10 @@ struct ceph_osd_client { | |||
| 104 | u64 timeout_tid; /* tid of timeout triggering rq */ | 127 | u64 timeout_tid; /* tid of timeout triggering rq */ |
| 105 | u64 last_tid; /* tid of last request */ | 128 | u64 last_tid; /* tid of last request */ |
| 106 | struct rb_root requests; /* pending requests */ | 129 | struct rb_root requests; /* pending requests */ |
| 107 | struct list_head req_lru; /* pending requests lru */ | 130 | struct list_head req_lru; /* in-flight lru */ |
| 131 | struct list_head req_unsent; /* unsent/need-resend queue */ | ||
| 132 | struct list_head req_notarget; /* map to no osd */ | ||
| 133 | struct list_head req_linger; /* lingering requests */ | ||
| 108 | int num_requests; | 134 | int num_requests; |
| 109 | struct delayed_work timeout_work; | 135 | struct delayed_work timeout_work; |
| 110 | struct delayed_work osds_timeout_work; | 136 | struct delayed_work osds_timeout_work; |
| @@ -116,6 +142,12 @@ struct ceph_osd_client { | |||
| 116 | 142 | ||
| 117 | struct ceph_msgpool msgpool_op; | 143 | struct ceph_msgpool msgpool_op; |
| 118 | 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; | ||
| 119 | }; | 151 | }; |
| 120 | 152 | ||
| 121 | struct ceph_osd_req_op { | 153 | struct ceph_osd_req_op { |
| @@ -150,6 +182,13 @@ struct ceph_osd_req_op { | |||
| 150 | struct { | 182 | struct { |
| 151 | u64 snapid; | 183 | u64 snapid; |
| 152 | } snap; | 184 | } snap; |
| 185 | struct { | ||
| 186 | u64 cookie; | ||
| 187 | u64 ver; | ||
| 188 | __u8 flag; | ||
| 189 | u32 prot_ver; | ||
| 190 | u32 timeout; | ||
| 191 | } watch; | ||
| 153 | }; | 192 | }; |
| 154 | u32 payload_len; | 193 | u32 payload_len; |
| 155 | }; | 194 | }; |
| @@ -198,6 +237,11 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *, | |||
| 198 | bool use_mempool, int num_reply, | 237 | bool use_mempool, int num_reply, |
| 199 | int page_align); | 238 | int page_align); |
| 200 | 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 | |||
| 201 | 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) |
| 202 | { | 246 | { |
| 203 | kref_get(&req->r_kref); | 247 | kref_get(&req->r_kref); |
| @@ -233,5 +277,14 @@ extern int ceph_osdc_writepages(struct ceph_osd_client *osdc, | |||
| 233 | struct page **pages, int nr_pages, | 277 | struct page **pages, int nr_pages, |
| 234 | int flags, int do_sync, bool nofail); | 278 | int flags, int do_sync, bool nofail); |
| 235 | 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); | ||
| 236 | #endif | 289 | #endif |
| 237 | 290 | ||
