diff options
Diffstat (limited to 'include/linux/ceph')
| -rw-r--r-- | include/linux/ceph/auth.h | 4 | ||||
| -rw-r--r-- | include/linux/ceph/ceph_fs.h | 19 | ||||
| -rw-r--r-- | include/linux/ceph/libceph.h | 3 | ||||
| -rw-r--r-- | include/linux/ceph/osd_client.h | 57 | ||||
| -rw-r--r-- | include/linux/ceph/rados.h | 39 |
5 files changed, 103 insertions, 19 deletions
diff --git a/include/linux/ceph/auth.h b/include/linux/ceph/auth.h index 7fff521d7eb5..aa13392a7efb 100644 --- a/include/linux/ceph/auth.h +++ b/include/linux/ceph/auth.h | |||
| @@ -67,12 +67,12 @@ struct ceph_auth_client { | |||
| 67 | bool negotiating; /* true if negotiating protocol */ | 67 | bool negotiating; /* true if negotiating protocol */ |
| 68 | const char *name; /* entity name */ | 68 | const char *name; /* entity name */ |
| 69 | u64 global_id; /* our unique id in system */ | 69 | u64 global_id; /* our unique id in system */ |
| 70 | const char *secret; /* our secret key */ | 70 | const struct ceph_crypto_key *key; /* our secret key */ |
| 71 | unsigned want_keys; /* which services we want */ | 71 | unsigned want_keys; /* which services we want */ |
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| 74 | extern struct ceph_auth_client *ceph_auth_init(const char *name, | 74 | extern struct ceph_auth_client *ceph_auth_init(const char *name, |
| 75 | const char *secret); | 75 | const struct ceph_crypto_key *key); |
| 76 | extern void ceph_auth_destroy(struct ceph_auth_client *ac); | 76 | extern void ceph_auth_destroy(struct ceph_auth_client *ac); |
| 77 | 77 | ||
| 78 | extern void ceph_auth_reset(struct ceph_auth_client *ac); | 78 | extern void ceph_auth_reset(struct ceph_auth_client *ac); |
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h index 09dcc0c2ffd5..b8e995fbd867 100644 --- a/include/linux/ceph/ceph_fs.h +++ b/include/linux/ceph/ceph_fs.h | |||
| @@ -136,9 +136,18 @@ struct ceph_dir_layout { | |||
| 136 | 136 | ||
| 137 | 137 | ||
| 138 | /* osd */ | 138 | /* osd */ |
| 139 | #define CEPH_MSG_OSD_MAP 41 | 139 | #define CEPH_MSG_OSD_MAP 41 |
| 140 | #define CEPH_MSG_OSD_OP 42 | 140 | #define CEPH_MSG_OSD_OP 42 |
| 141 | #define CEPH_MSG_OSD_OPREPLY 43 | 141 | #define CEPH_MSG_OSD_OPREPLY 43 |
| 142 | #define CEPH_MSG_WATCH_NOTIFY 44 | ||
| 143 | |||
| 144 | |||
| 145 | /* watch-notify operations */ | ||
| 146 | enum { | ||
| 147 | WATCH_NOTIFY = 1, /* notifying watcher */ | ||
| 148 | WATCH_NOTIFY_COMPLETE = 2, /* notifier notified when done */ | ||
| 149 | }; | ||
| 150 | |||
| 142 | 151 | ||
| 143 | /* pool operations */ | 152 | /* pool operations */ |
| 144 | enum { | 153 | enum { |
| @@ -213,8 +222,10 @@ struct ceph_client_mount { | |||
| 213 | struct ceph_mon_request_header monhdr; | 222 | struct ceph_mon_request_header monhdr; |
| 214 | } __attribute__ ((packed)); | 223 | } __attribute__ ((packed)); |
| 215 | 224 | ||
| 225 | #define CEPH_SUBSCRIBE_ONETIME 1 /* i want only 1 update after have */ | ||
| 226 | |||
| 216 | struct ceph_mon_subscribe_item { | 227 | struct ceph_mon_subscribe_item { |
| 217 | __le64 have_version; __le64 have; | 228 | __le64 have_version; __le64 have; |
| 218 | __u8 onetime; | 229 | __u8 onetime; |
| 219 | } __attribute__ ((packed)); | 230 | } __attribute__ ((packed)); |
| 220 | 231 | ||
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h index 72c72bfccb88..6365f041745b 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h | |||
| @@ -61,7 +61,7 @@ struct ceph_options { | |||
| 61 | pointer type of args */ | 61 | pointer type of args */ |
| 62 | int num_mon; | 62 | int num_mon; |
| 63 | char *name; | 63 | char *name; |
| 64 | char *secret; | 64 | struct ceph_crypto_key *key; |
| 65 | }; | 65 | }; |
| 66 | 66 | ||
| 67 | /* | 67 | /* |
| @@ -71,7 +71,6 @@ struct ceph_options { | |||
| 71 | #define CEPH_OSD_TIMEOUT_DEFAULT 60 /* seconds */ | 71 | #define CEPH_OSD_TIMEOUT_DEFAULT 60 /* seconds */ |
| 72 | #define CEPH_OSD_KEEPALIVE_DEFAULT 5 | 72 | #define CEPH_OSD_KEEPALIVE_DEFAULT 5 |
| 73 | #define CEPH_OSD_IDLE_TTL_DEFAULT 60 | 73 | #define CEPH_OSD_IDLE_TTL_DEFAULT 60 |
| 74 | #define CEPH_MOUNT_RSIZE_DEFAULT (512*1024) /* readahead */ | ||
| 75 | 74 | ||
| 76 | #define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) | 75 | #define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) |
| 77 | #define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) | 76 | #define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) |
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 | ||
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h index 6d5247f2e81b..0a99099801a4 100644 --- a/include/linux/ceph/rados.h +++ b/include/linux/ceph/rados.h | |||
| @@ -12,9 +12,9 @@ | |||
| 12 | * osdmap encoding versions | 12 | * osdmap encoding versions |
| 13 | */ | 13 | */ |
| 14 | #define CEPH_OSDMAP_INC_VERSION 5 | 14 | #define CEPH_OSDMAP_INC_VERSION 5 |
| 15 | #define CEPH_OSDMAP_INC_VERSION_EXT 5 | 15 | #define CEPH_OSDMAP_INC_VERSION_EXT 6 |
| 16 | #define CEPH_OSDMAP_VERSION 5 | 16 | #define CEPH_OSDMAP_VERSION 5 |
| 17 | #define CEPH_OSDMAP_VERSION_EXT 5 | 17 | #define CEPH_OSDMAP_VERSION_EXT 6 |
| 18 | 18 | ||
| 19 | /* | 19 | /* |
| 20 | * fs id | 20 | * fs id |
| @@ -181,9 +181,17 @@ enum { | |||
| 181 | /* read */ | 181 | /* read */ |
| 182 | CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1, | 182 | CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1, |
| 183 | CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2, | 183 | CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2, |
| 184 | CEPH_OSD_OP_MAPEXT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 3, | ||
| 184 | 185 | ||
| 185 | /* fancy read */ | 186 | /* fancy read */ |
| 186 | CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4, | 187 | CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4, |
| 188 | CEPH_OSD_OP_SPARSE_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 5, | ||
| 189 | |||
| 190 | CEPH_OSD_OP_NOTIFY = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 6, | ||
| 191 | CEPH_OSD_OP_NOTIFY_ACK = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 7, | ||
| 192 | |||
| 193 | /* versioning */ | ||
| 194 | CEPH_OSD_OP_ASSERT_VER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 8, | ||
| 187 | 195 | ||
| 188 | /* write */ | 196 | /* write */ |
| 189 | CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1, | 197 | CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1, |
| @@ -205,6 +213,8 @@ enum { | |||
| 205 | CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13, | 213 | CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13, |
| 206 | CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14, | 214 | CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14, |
| 207 | 215 | ||
| 216 | CEPH_OSD_OP_WATCH = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 15, | ||
| 217 | |||
| 208 | /** attrs **/ | 218 | /** attrs **/ |
| 209 | /* read */ | 219 | /* read */ |
| 210 | CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1, | 220 | CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1, |
| @@ -218,11 +228,14 @@ enum { | |||
| 218 | CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4, | 228 | CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4, |
| 219 | 229 | ||
| 220 | /** subop **/ | 230 | /** subop **/ |
| 221 | CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1, | 231 | CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1, |
| 222 | CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2, | 232 | CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2, |
| 223 | CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3, | 233 | CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3, |
| 224 | CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4, | 234 | CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4, |
| 225 | CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5, | 235 | CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5, |
| 236 | CEPH_OSD_OP_SCRUB_RESERVE = CEPH_OSD_OP_MODE_SUB | 6, | ||
| 237 | CEPH_OSD_OP_SCRUB_UNRESERVE = CEPH_OSD_OP_MODE_SUB | 7, | ||
| 238 | CEPH_OSD_OP_SCRUB_STOP = CEPH_OSD_OP_MODE_SUB | 8, | ||
| 226 | 239 | ||
| 227 | /** lock **/ | 240 | /** lock **/ |
| 228 | CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1, | 241 | CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1, |
| @@ -328,6 +341,8 @@ enum { | |||
| 328 | CEPH_OSD_CMPXATTR_MODE_U64 = 2 | 341 | CEPH_OSD_CMPXATTR_MODE_U64 = 2 |
| 329 | }; | 342 | }; |
| 330 | 343 | ||
| 344 | #define RADOS_NOTIFY_VER 1 | ||
| 345 | |||
| 331 | /* | 346 | /* |
| 332 | * an individual object operation. each may be accompanied by some data | 347 | * an individual object operation. each may be accompanied by some data |
| 333 | * payload | 348 | * payload |
| @@ -359,7 +374,12 @@ struct ceph_osd_op { | |||
| 359 | struct { | 374 | struct { |
| 360 | __le64 snapid; | 375 | __le64 snapid; |
| 361 | } __attribute__ ((packed)) snap; | 376 | } __attribute__ ((packed)) snap; |
| 362 | }; | 377 | struct { |
| 378 | __le64 cookie; | ||
| 379 | __le64 ver; | ||
| 380 | __u8 flag; /* 0 = unwatch, 1 = watch */ | ||
| 381 | } __attribute__ ((packed)) watch; | ||
| 382 | }; | ||
| 363 | __le32 payload_len; | 383 | __le32 payload_len; |
| 364 | } __attribute__ ((packed)); | 384 | } __attribute__ ((packed)); |
| 365 | 385 | ||
| @@ -402,4 +422,5 @@ struct ceph_osd_reply_head { | |||
| 402 | } __attribute__ ((packed)); | 422 | } __attribute__ ((packed)); |
| 403 | 423 | ||
| 404 | 424 | ||
| 425 | |||
| 405 | #endif | 426 | #endif |
