diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-01-15 12:46:14 -0500 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-01-15 12:46:14 -0500 |
| commit | 0c49cd295d42d0032af11d55e2140dbec11dc8d0 (patch) | |
| tree | 1e7d0e50b6b6d6e4de1fb6bb0b6d856c3932da58 /include/linux/ceph | |
| parent | 0c3e99437a66e4c869c60c2398449e6d98f3a988 (diff) | |
| parent | eaa27f34e91a14cdceed26ed6c6793ec1d186115 (diff) | |
Merge tag 'v3.19-rc4' into next
Merge with mainline to bring in the latest thermal and other changes.
Diffstat (limited to 'include/linux/ceph')
| -rw-r--r-- | include/linux/ceph/auth.h | 26 | ||||
| -rw-r--r-- | include/linux/ceph/buffer.h | 3 | ||||
| -rw-r--r-- | include/linux/ceph/ceph_features.h | 1 | ||||
| -rw-r--r-- | include/linux/ceph/ceph_fs.h | 10 | ||||
| -rw-r--r-- | include/linux/ceph/libceph.h | 3 | ||||
| -rw-r--r-- | include/linux/ceph/messenger.h | 9 | ||||
| -rw-r--r-- | include/linux/ceph/msgr.h | 11 | ||||
| -rw-r--r-- | include/linux/ceph/osd_client.h | 13 | ||||
| -rw-r--r-- | include/linux/ceph/pagelist.h | 7 | ||||
| -rw-r--r-- | include/linux/ceph/rados.h | 225 |
10 files changed, 202 insertions, 106 deletions
diff --git a/include/linux/ceph/auth.h b/include/linux/ceph/auth.h index 5f3386844134..260d78b587c4 100644 --- a/include/linux/ceph/auth.h +++ b/include/linux/ceph/auth.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | struct ceph_auth_client; | 14 | struct ceph_auth_client; |
| 15 | struct ceph_authorizer; | 15 | struct ceph_authorizer; |
| 16 | struct ceph_msg; | ||
| 16 | 17 | ||
| 17 | struct ceph_auth_handshake { | 18 | struct ceph_auth_handshake { |
| 18 | struct ceph_authorizer *authorizer; | 19 | struct ceph_authorizer *authorizer; |
| @@ -20,6 +21,10 @@ struct ceph_auth_handshake { | |||
| 20 | size_t authorizer_buf_len; | 21 | size_t authorizer_buf_len; |
| 21 | void *authorizer_reply_buf; | 22 | void *authorizer_reply_buf; |
| 22 | size_t authorizer_reply_buf_len; | 23 | size_t authorizer_reply_buf_len; |
| 24 | int (*sign_message)(struct ceph_auth_handshake *auth, | ||
| 25 | struct ceph_msg *msg); | ||
| 26 | int (*check_message_signature)(struct ceph_auth_handshake *auth, | ||
| 27 | struct ceph_msg *msg); | ||
| 23 | }; | 28 | }; |
| 24 | 29 | ||
| 25 | struct ceph_auth_client_ops { | 30 | struct ceph_auth_client_ops { |
| @@ -66,6 +71,11 @@ struct ceph_auth_client_ops { | |||
| 66 | void (*reset)(struct ceph_auth_client *ac); | 71 | void (*reset)(struct ceph_auth_client *ac); |
| 67 | 72 | ||
| 68 | void (*destroy)(struct ceph_auth_client *ac); | 73 | void (*destroy)(struct ceph_auth_client *ac); |
| 74 | |||
| 75 | int (*sign_message)(struct ceph_auth_handshake *auth, | ||
| 76 | struct ceph_msg *msg); | ||
| 77 | int (*check_message_signature)(struct ceph_auth_handshake *auth, | ||
| 78 | struct ceph_msg *msg); | ||
| 69 | }; | 79 | }; |
| 70 | 80 | ||
| 71 | struct ceph_auth_client { | 81 | struct ceph_auth_client { |
| @@ -113,4 +123,20 @@ extern int ceph_auth_verify_authorizer_reply(struct ceph_auth_client *ac, | |||
| 113 | extern void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac, | 123 | extern void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac, |
| 114 | int peer_type); | 124 | int peer_type); |
| 115 | 125 | ||
| 126 | static inline int ceph_auth_sign_message(struct ceph_auth_handshake *auth, | ||
| 127 | struct ceph_msg *msg) | ||
| 128 | { | ||
| 129 | if (auth->sign_message) | ||
| 130 | return auth->sign_message(auth, msg); | ||
| 131 | return 0; | ||
| 132 | } | ||
| 133 | |||
| 134 | static inline | ||
| 135 | int ceph_auth_check_message_signature(struct ceph_auth_handshake *auth, | ||
| 136 | struct ceph_msg *msg) | ||
| 137 | { | ||
| 138 | if (auth->check_message_signature) | ||
| 139 | return auth->check_message_signature(auth, msg); | ||
| 140 | return 0; | ||
| 141 | } | ||
| 116 | #endif | 142 | #endif |
diff --git a/include/linux/ceph/buffer.h b/include/linux/ceph/buffer.h index 07ad423cc37f..07ca15e76100 100644 --- a/include/linux/ceph/buffer.h +++ b/include/linux/ceph/buffer.h | |||
| @@ -10,8 +10,7 @@ | |||
| 10 | /* | 10 | /* |
| 11 | * a simple reference counted buffer. | 11 | * a simple reference counted buffer. |
| 12 | * | 12 | * |
| 13 | * use kmalloc for small sizes (<= one page), vmalloc for larger | 13 | * use kmalloc for smaller sizes, vmalloc for larger sizes. |
| 14 | * sizes. | ||
| 15 | */ | 14 | */ |
| 16 | struct ceph_buffer { | 15 | struct ceph_buffer { |
| 17 | struct kref kref; | 16 | struct kref kref; |
diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h index d12659ce550d..71e05bbf8ceb 100644 --- a/include/linux/ceph/ceph_features.h +++ b/include/linux/ceph/ceph_features.h | |||
| @@ -84,6 +84,7 @@ static inline u64 ceph_sanitize_features(u64 features) | |||
| 84 | CEPH_FEATURE_PGPOOL3 | \ | 84 | CEPH_FEATURE_PGPOOL3 | \ |
| 85 | CEPH_FEATURE_OSDENC | \ | 85 | CEPH_FEATURE_OSDENC | \ |
| 86 | CEPH_FEATURE_CRUSH_TUNABLES | \ | 86 | CEPH_FEATURE_CRUSH_TUNABLES | \ |
| 87 | CEPH_FEATURE_MSG_AUTH | \ | ||
| 87 | CEPH_FEATURE_CRUSH_TUNABLES2 | \ | 88 | CEPH_FEATURE_CRUSH_TUNABLES2 | \ |
| 88 | CEPH_FEATURE_REPLY_CREATE_INODE | \ | 89 | CEPH_FEATURE_REPLY_CREATE_INODE | \ |
| 89 | CEPH_FEATURE_OSDHASHPSPOOL | \ | 90 | CEPH_FEATURE_OSDHASHPSPOOL | \ |
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h index 3c97d5e9b951..c0dadaac26e3 100644 --- a/include/linux/ceph/ceph_fs.h +++ b/include/linux/ceph/ceph_fs.h | |||
| @@ -522,8 +522,11 @@ struct ceph_mds_reply_dirfrag { | |||
| 522 | __le32 dist[]; | 522 | __le32 dist[]; |
| 523 | } __attribute__ ((packed)); | 523 | } __attribute__ ((packed)); |
| 524 | 524 | ||
| 525 | #define CEPH_LOCK_FCNTL 1 | 525 | #define CEPH_LOCK_FCNTL 1 |
| 526 | #define CEPH_LOCK_FLOCK 2 | 526 | #define CEPH_LOCK_FLOCK 2 |
| 527 | #define CEPH_LOCK_FCNTL_INTR 3 | ||
| 528 | #define CEPH_LOCK_FLOCK_INTR 4 | ||
| 529 | |||
| 527 | 530 | ||
| 528 | #define CEPH_LOCK_SHARED 1 | 531 | #define CEPH_LOCK_SHARED 1 |
| 529 | #define CEPH_LOCK_EXCL 2 | 532 | #define CEPH_LOCK_EXCL 2 |
| @@ -549,6 +552,7 @@ struct ceph_filelock { | |||
| 549 | 552 | ||
| 550 | int ceph_flags_to_mode(int flags); | 553 | int ceph_flags_to_mode(int flags); |
| 551 | 554 | ||
| 555 | #define CEPH_INLINE_NONE ((__u64)-1) | ||
| 552 | 556 | ||
| 553 | /* capability bits */ | 557 | /* capability bits */ |
| 554 | #define CEPH_CAP_PIN 1 /* no specific capabilities beyond the pin */ | 558 | #define CEPH_CAP_PIN 1 /* no specific capabilities beyond the pin */ |
| @@ -613,6 +617,8 @@ int ceph_flags_to_mode(int flags); | |||
| 613 | CEPH_CAP_LINK_SHARED | \ | 617 | CEPH_CAP_LINK_SHARED | \ |
| 614 | CEPH_CAP_FILE_SHARED | \ | 618 | CEPH_CAP_FILE_SHARED | \ |
| 615 | CEPH_CAP_XATTR_SHARED) | 619 | CEPH_CAP_XATTR_SHARED) |
| 620 | #define CEPH_STAT_CAP_INLINE_DATA (CEPH_CAP_FILE_SHARED | \ | ||
| 621 | CEPH_CAP_FILE_RD) | ||
| 616 | 622 | ||
| 617 | #define CEPH_CAP_ANY_SHARED (CEPH_CAP_AUTH_SHARED | \ | 623 | #define CEPH_CAP_ANY_SHARED (CEPH_CAP_AUTH_SHARED | \ |
| 618 | CEPH_CAP_LINK_SHARED | \ | 624 | CEPH_CAP_LINK_SHARED | \ |
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h index 279b0afac1c1..8b11a79ca1cb 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #define CEPH_OPT_NOSHARE (1<<1) /* don't share client with other sbs */ | 29 | #define CEPH_OPT_NOSHARE (1<<1) /* don't share client with other sbs */ |
| 30 | #define CEPH_OPT_MYIP (1<<2) /* specified my ip */ | 30 | #define CEPH_OPT_MYIP (1<<2) /* specified my ip */ |
| 31 | #define CEPH_OPT_NOCRC (1<<3) /* no data crc on writes */ | 31 | #define CEPH_OPT_NOCRC (1<<3) /* no data crc on writes */ |
| 32 | #define CEPH_OPT_NOMSGAUTH (1<<4) /* not require cephx message signature */ | ||
| 32 | 33 | ||
| 33 | #define CEPH_OPT_DEFAULT (0) | 34 | #define CEPH_OPT_DEFAULT (0) |
| 34 | 35 | ||
| @@ -184,7 +185,6 @@ extern bool libceph_compatible(void *data); | |||
| 184 | extern const char *ceph_msg_type_name(int type); | 185 | extern const char *ceph_msg_type_name(int type); |
| 185 | extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid); | 186 | extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid); |
| 186 | extern void *ceph_kvmalloc(size_t size, gfp_t flags); | 187 | extern void *ceph_kvmalloc(size_t size, gfp_t flags); |
| 187 | extern void ceph_kvfree(const void *ptr); | ||
| 188 | 188 | ||
| 189 | extern struct ceph_options *ceph_parse_options(char *options, | 189 | extern struct ceph_options *ceph_parse_options(char *options, |
| 190 | const char *dev_name, const char *dev_name_end, | 190 | const char *dev_name, const char *dev_name_end, |
| @@ -211,7 +211,6 @@ extern struct page **ceph_get_direct_page_vector(const void __user *data, | |||
| 211 | bool write_page); | 211 | bool write_page); |
| 212 | extern void ceph_put_page_vector(struct page **pages, int num_pages, | 212 | extern void ceph_put_page_vector(struct page **pages, int num_pages, |
| 213 | bool dirty); | 213 | bool dirty); |
| 214 | extern void ceph_release_page_vector(struct page **pages, int num_pages); | ||
| 215 | extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags); | 214 | extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags); |
| 216 | extern int ceph_copy_user_to_page_vector(struct page **pages, | 215 | extern int ceph_copy_user_to_page_vector(struct page **pages, |
| 217 | const void __user *data, | 216 | const void __user *data, |
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index 40ae58e3e9db..d9d396c16503 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h | |||
| @@ -42,6 +42,10 @@ struct ceph_connection_operations { | |||
| 42 | struct ceph_msg * (*alloc_msg) (struct ceph_connection *con, | 42 | struct ceph_msg * (*alloc_msg) (struct ceph_connection *con, |
| 43 | struct ceph_msg_header *hdr, | 43 | struct ceph_msg_header *hdr, |
| 44 | int *skip); | 44 | int *skip); |
| 45 | int (*sign_message) (struct ceph_connection *con, struct ceph_msg *msg); | ||
| 46 | |||
| 47 | int (*check_message_signature) (struct ceph_connection *con, | ||
| 48 | struct ceph_msg *msg); | ||
| 45 | }; | 49 | }; |
| 46 | 50 | ||
| 47 | /* use format string %s%d */ | 51 | /* use format string %s%d */ |
| @@ -142,7 +146,10 @@ struct ceph_msg_data_cursor { | |||
| 142 | */ | 146 | */ |
| 143 | struct ceph_msg { | 147 | struct ceph_msg { |
| 144 | struct ceph_msg_header hdr; /* header */ | 148 | struct ceph_msg_header hdr; /* header */ |
| 145 | struct ceph_msg_footer footer; /* footer */ | 149 | union { |
| 150 | struct ceph_msg_footer footer; /* footer */ | ||
| 151 | struct ceph_msg_footer_old old_footer; /* old format footer */ | ||
| 152 | }; | ||
| 146 | struct kvec front; /* unaligned blobs of message */ | 153 | struct kvec front; /* unaligned blobs of message */ |
| 147 | struct ceph_buffer *middle; | 154 | struct ceph_buffer *middle; |
| 148 | 155 | ||
diff --git a/include/linux/ceph/msgr.h b/include/linux/ceph/msgr.h index 3d94a73b5f30..1c1887206ffa 100644 --- a/include/linux/ceph/msgr.h +++ b/include/linux/ceph/msgr.h | |||
| @@ -152,7 +152,8 @@ struct ceph_msg_header { | |||
| 152 | receiver: mask against ~PAGE_MASK */ | 152 | receiver: mask against ~PAGE_MASK */ |
| 153 | 153 | ||
| 154 | struct ceph_entity_name src; | 154 | struct ceph_entity_name src; |
| 155 | __le32 reserved; | 155 | __le16 compat_version; |
| 156 | __le16 reserved; | ||
| 156 | __le32 crc; /* header crc32c */ | 157 | __le32 crc; /* header crc32c */ |
| 157 | } __attribute__ ((packed)); | 158 | } __attribute__ ((packed)); |
| 158 | 159 | ||
| @@ -164,13 +165,21 @@ struct ceph_msg_header { | |||
| 164 | /* | 165 | /* |
| 165 | * follows data payload | 166 | * follows data payload |
| 166 | */ | 167 | */ |
| 168 | struct ceph_msg_footer_old { | ||
| 169 | __le32 front_crc, middle_crc, data_crc; | ||
| 170 | __u8 flags; | ||
| 171 | } __attribute__ ((packed)); | ||
| 172 | |||
| 167 | struct ceph_msg_footer { | 173 | struct ceph_msg_footer { |
| 168 | __le32 front_crc, middle_crc, data_crc; | 174 | __le32 front_crc, middle_crc, data_crc; |
| 175 | // sig holds the 64 bits of the digital signature for the message PLR | ||
| 176 | __le64 sig; | ||
| 169 | __u8 flags; | 177 | __u8 flags; |
| 170 | } __attribute__ ((packed)); | 178 | } __attribute__ ((packed)); |
| 171 | 179 | ||
| 172 | #define CEPH_MSG_FOOTER_COMPLETE (1<<0) /* msg wasn't aborted */ | 180 | #define CEPH_MSG_FOOTER_COMPLETE (1<<0) /* msg wasn't aborted */ |
| 173 | #define CEPH_MSG_FOOTER_NOCRC (1<<1) /* no data crc */ | 181 | #define CEPH_MSG_FOOTER_NOCRC (1<<1) /* no data crc */ |
| 182 | #define CEPH_MSG_FOOTER_SIGNED (1<<2) /* msg was signed */ | ||
| 174 | 183 | ||
| 175 | 184 | ||
| 176 | #endif | 185 | #endif |
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index 03aeb27fcc69..61b19c46bdb3 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h | |||
| @@ -87,6 +87,13 @@ struct ceph_osd_req_op { | |||
| 87 | struct ceph_osd_data osd_data; | 87 | struct ceph_osd_data osd_data; |
| 88 | } extent; | 88 | } extent; |
| 89 | struct { | 89 | struct { |
| 90 | u32 name_len; | ||
| 91 | u32 value_len; | ||
| 92 | __u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */ | ||
| 93 | __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */ | ||
| 94 | struct ceph_osd_data osd_data; | ||
| 95 | } xattr; | ||
| 96 | struct { | ||
| 90 | const char *class_name; | 97 | const char *class_name; |
| 91 | const char *method_name; | 98 | const char *method_name; |
| 92 | struct ceph_osd_data request_info; | 99 | struct ceph_osd_data request_info; |
| @@ -295,6 +302,9 @@ extern void osd_req_op_cls_response_data_pages(struct ceph_osd_request *, | |||
| 295 | extern void osd_req_op_cls_init(struct ceph_osd_request *osd_req, | 302 | extern void osd_req_op_cls_init(struct ceph_osd_request *osd_req, |
| 296 | unsigned int which, u16 opcode, | 303 | unsigned int which, u16 opcode, |
| 297 | const char *class, const char *method); | 304 | const char *class, const char *method); |
| 305 | extern int osd_req_op_xattr_init(struct ceph_osd_request *osd_req, unsigned int which, | ||
| 306 | u16 opcode, const char *name, const void *value, | ||
| 307 | size_t size, u8 cmp_op, u8 cmp_mode); | ||
| 298 | extern void osd_req_op_watch_init(struct ceph_osd_request *osd_req, | 308 | extern void osd_req_op_watch_init(struct ceph_osd_request *osd_req, |
| 299 | unsigned int which, u16 opcode, | 309 | unsigned int which, u16 opcode, |
| 300 | u64 cookie, u64 version, int flag); | 310 | u64 cookie, u64 version, int flag); |
| @@ -318,7 +328,8 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *, | |||
| 318 | struct ceph_file_layout *layout, | 328 | struct ceph_file_layout *layout, |
| 319 | struct ceph_vino vino, | 329 | struct ceph_vino vino, |
| 320 | u64 offset, u64 *len, | 330 | u64 offset, u64 *len, |
| 321 | int num_ops, int opcode, int flags, | 331 | unsigned int which, int num_ops, |
| 332 | int opcode, int flags, | ||
| 322 | struct ceph_snap_context *snapc, | 333 | struct ceph_snap_context *snapc, |
| 323 | u32 truncate_seq, u64 truncate_size, | 334 | u32 truncate_seq, u64 truncate_size, |
| 324 | bool use_mempool); | 335 | bool use_mempool); |
diff --git a/include/linux/ceph/pagelist.h b/include/linux/ceph/pagelist.h index 9660d6b0a35d..13d71fe18b0c 100644 --- a/include/linux/ceph/pagelist.h +++ b/include/linux/ceph/pagelist.h | |||
| @@ -1,7 +1,10 @@ | |||
| 1 | #ifndef __FS_CEPH_PAGELIST_H | 1 | #ifndef __FS_CEPH_PAGELIST_H |
| 2 | #define __FS_CEPH_PAGELIST_H | 2 | #define __FS_CEPH_PAGELIST_H |
| 3 | 3 | ||
| 4 | #include <asm/byteorder.h> | ||
| 5 | #include <linux/atomic.h> | ||
| 4 | #include <linux/list.h> | 6 | #include <linux/list.h> |
| 7 | #include <linux/types.h> | ||
| 5 | 8 | ||
| 6 | struct ceph_pagelist { | 9 | struct ceph_pagelist { |
| 7 | struct list_head head; | 10 | struct list_head head; |
| @@ -10,6 +13,7 @@ struct ceph_pagelist { | |||
| 10 | size_t room; | 13 | size_t room; |
| 11 | struct list_head free_list; | 14 | struct list_head free_list; |
| 12 | size_t num_pages_free; | 15 | size_t num_pages_free; |
| 16 | atomic_t refcnt; | ||
| 13 | }; | 17 | }; |
| 14 | 18 | ||
| 15 | struct ceph_pagelist_cursor { | 19 | struct ceph_pagelist_cursor { |
| @@ -26,9 +30,10 @@ static inline void ceph_pagelist_init(struct ceph_pagelist *pl) | |||
| 26 | pl->room = 0; | 30 | pl->room = 0; |
| 27 | INIT_LIST_HEAD(&pl->free_list); | 31 | INIT_LIST_HEAD(&pl->free_list); |
| 28 | pl->num_pages_free = 0; | 32 | pl->num_pages_free = 0; |
| 33 | atomic_set(&pl->refcnt, 1); | ||
| 29 | } | 34 | } |
| 30 | 35 | ||
| 31 | extern int ceph_pagelist_release(struct ceph_pagelist *pl); | 36 | extern void ceph_pagelist_release(struct ceph_pagelist *pl); |
| 32 | 37 | ||
| 33 | extern int ceph_pagelist_append(struct ceph_pagelist *pl, const void *d, size_t l); | 38 | extern int ceph_pagelist_append(struct ceph_pagelist *pl, const void *d, size_t l); |
| 34 | 39 | ||
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h index f20e0d8a2155..2f822dca1046 100644 --- a/include/linux/ceph/rados.h +++ b/include/linux/ceph/rados.h | |||
| @@ -172,6 +172,7 @@ extern const char *ceph_osd_state_name(int s); | |||
| 172 | #define CEPH_OSD_OP_MODE_WR 0x2000 | 172 | #define CEPH_OSD_OP_MODE_WR 0x2000 |
| 173 | #define CEPH_OSD_OP_MODE_RMW 0x3000 | 173 | #define CEPH_OSD_OP_MODE_RMW 0x3000 |
| 174 | #define CEPH_OSD_OP_MODE_SUB 0x4000 | 174 | #define CEPH_OSD_OP_MODE_SUB 0x4000 |
| 175 | #define CEPH_OSD_OP_MODE_CACHE 0x8000 | ||
| 175 | 176 | ||
| 176 | #define CEPH_OSD_OP_TYPE 0x0f00 | 177 | #define CEPH_OSD_OP_TYPE 0x0f00 |
| 177 | #define CEPH_OSD_OP_TYPE_LOCK 0x0100 | 178 | #define CEPH_OSD_OP_TYPE_LOCK 0x0100 |
| @@ -181,103 +182,135 @@ extern const char *ceph_osd_state_name(int s); | |||
| 181 | #define CEPH_OSD_OP_TYPE_PG 0x0500 | 182 | #define CEPH_OSD_OP_TYPE_PG 0x0500 |
| 182 | #define CEPH_OSD_OP_TYPE_MULTI 0x0600 /* multiobject */ | 183 | #define CEPH_OSD_OP_TYPE_MULTI 0x0600 /* multiobject */ |
| 183 | 184 | ||
| 185 | #define __CEPH_OSD_OP1(mode, nr) \ | ||
| 186 | (CEPH_OSD_OP_MODE_##mode | (nr)) | ||
| 187 | |||
| 188 | #define __CEPH_OSD_OP(mode, type, nr) \ | ||
| 189 | (CEPH_OSD_OP_MODE_##mode | CEPH_OSD_OP_TYPE_##type | (nr)) | ||
| 190 | |||
| 191 | #define __CEPH_FORALL_OSD_OPS(f) \ | ||
| 192 | /** data **/ \ | ||
| 193 | /* read */ \ | ||
| 194 | f(READ, __CEPH_OSD_OP(RD, DATA, 1), "read") \ | ||
| 195 | f(STAT, __CEPH_OSD_OP(RD, DATA, 2), "stat") \ | ||
| 196 | f(MAPEXT, __CEPH_OSD_OP(RD, DATA, 3), "mapext") \ | ||
| 197 | \ | ||
| 198 | /* fancy read */ \ | ||
| 199 | f(MASKTRUNC, __CEPH_OSD_OP(RD, DATA, 4), "masktrunc") \ | ||
| 200 | f(SPARSE_READ, __CEPH_OSD_OP(RD, DATA, 5), "sparse-read") \ | ||
| 201 | \ | ||
| 202 | f(NOTIFY, __CEPH_OSD_OP(RD, DATA, 6), "notify") \ | ||
| 203 | f(NOTIFY_ACK, __CEPH_OSD_OP(RD, DATA, 7), "notify-ack") \ | ||
| 204 | \ | ||
| 205 | /* versioning */ \ | ||
| 206 | f(ASSERT_VER, __CEPH_OSD_OP(RD, DATA, 8), "assert-version") \ | ||
| 207 | \ | ||
| 208 | f(LIST_WATCHERS, __CEPH_OSD_OP(RD, DATA, 9), "list-watchers") \ | ||
| 209 | \ | ||
| 210 | f(LIST_SNAPS, __CEPH_OSD_OP(RD, DATA, 10), "list-snaps") \ | ||
| 211 | \ | ||
| 212 | /* sync */ \ | ||
| 213 | f(SYNC_READ, __CEPH_OSD_OP(RD, DATA, 11), "sync_read") \ | ||
| 214 | \ | ||
| 215 | /* write */ \ | ||
| 216 | f(WRITE, __CEPH_OSD_OP(WR, DATA, 1), "write") \ | ||
| 217 | f(WRITEFULL, __CEPH_OSD_OP(WR, DATA, 2), "writefull") \ | ||
| 218 | f(TRUNCATE, __CEPH_OSD_OP(WR, DATA, 3), "truncate") \ | ||
| 219 | f(ZERO, __CEPH_OSD_OP(WR, DATA, 4), "zero") \ | ||
| 220 | f(DELETE, __CEPH_OSD_OP(WR, DATA, 5), "delete") \ | ||
| 221 | \ | ||
| 222 | /* fancy write */ \ | ||
| 223 | f(APPEND, __CEPH_OSD_OP(WR, DATA, 6), "append") \ | ||
| 224 | f(STARTSYNC, __CEPH_OSD_OP(WR, DATA, 7), "startsync") \ | ||
| 225 | f(SETTRUNC, __CEPH_OSD_OP(WR, DATA, 8), "settrunc") \ | ||
| 226 | f(TRIMTRUNC, __CEPH_OSD_OP(WR, DATA, 9), "trimtrunc") \ | ||
| 227 | \ | ||
| 228 | f(TMAPUP, __CEPH_OSD_OP(RMW, DATA, 10), "tmapup") \ | ||
| 229 | f(TMAPPUT, __CEPH_OSD_OP(WR, DATA, 11), "tmapput") \ | ||
| 230 | f(TMAPGET, __CEPH_OSD_OP(RD, DATA, 12), "tmapget") \ | ||
| 231 | \ | ||
| 232 | f(CREATE, __CEPH_OSD_OP(WR, DATA, 13), "create") \ | ||
| 233 | f(ROLLBACK, __CEPH_OSD_OP(WR, DATA, 14), "rollback") \ | ||
| 234 | \ | ||
| 235 | f(WATCH, __CEPH_OSD_OP(WR, DATA, 15), "watch") \ | ||
| 236 | \ | ||
| 237 | /* omap */ \ | ||
| 238 | f(OMAPGETKEYS, __CEPH_OSD_OP(RD, DATA, 17), "omap-get-keys") \ | ||
| 239 | f(OMAPGETVALS, __CEPH_OSD_OP(RD, DATA, 18), "omap-get-vals") \ | ||
| 240 | f(OMAPGETHEADER, __CEPH_OSD_OP(RD, DATA, 19), "omap-get-header") \ | ||
| 241 | f(OMAPGETVALSBYKEYS, __CEPH_OSD_OP(RD, DATA, 20), "omap-get-vals-by-keys") \ | ||
| 242 | f(OMAPSETVALS, __CEPH_OSD_OP(WR, DATA, 21), "omap-set-vals") \ | ||
| 243 | f(OMAPSETHEADER, __CEPH_OSD_OP(WR, DATA, 22), "omap-set-header") \ | ||
| 244 | f(OMAPCLEAR, __CEPH_OSD_OP(WR, DATA, 23), "omap-clear") \ | ||
| 245 | f(OMAPRMKEYS, __CEPH_OSD_OP(WR, DATA, 24), "omap-rm-keys") \ | ||
| 246 | f(OMAP_CMP, __CEPH_OSD_OP(RD, DATA, 25), "omap-cmp") \ | ||
| 247 | \ | ||
| 248 | /* tiering */ \ | ||
| 249 | f(COPY_FROM, __CEPH_OSD_OP(WR, DATA, 26), "copy-from") \ | ||
| 250 | f(COPY_GET_CLASSIC, __CEPH_OSD_OP(RD, DATA, 27), "copy-get-classic") \ | ||
| 251 | f(UNDIRTY, __CEPH_OSD_OP(WR, DATA, 28), "undirty") \ | ||
| 252 | f(ISDIRTY, __CEPH_OSD_OP(RD, DATA, 29), "isdirty") \ | ||
| 253 | f(COPY_GET, __CEPH_OSD_OP(RD, DATA, 30), "copy-get") \ | ||
| 254 | f(CACHE_FLUSH, __CEPH_OSD_OP(CACHE, DATA, 31), "cache-flush") \ | ||
| 255 | f(CACHE_EVICT, __CEPH_OSD_OP(CACHE, DATA, 32), "cache-evict") \ | ||
| 256 | f(CACHE_TRY_FLUSH, __CEPH_OSD_OP(CACHE, DATA, 33), "cache-try-flush") \ | ||
| 257 | \ | ||
| 258 | /* convert tmap to omap */ \ | ||
| 259 | f(TMAP2OMAP, __CEPH_OSD_OP(RMW, DATA, 34), "tmap2omap") \ | ||
| 260 | \ | ||
| 261 | /* hints */ \ | ||
| 262 | f(SETALLOCHINT, __CEPH_OSD_OP(WR, DATA, 35), "set-alloc-hint") \ | ||
| 263 | \ | ||
| 264 | /** multi **/ \ | ||
| 265 | f(CLONERANGE, __CEPH_OSD_OP(WR, MULTI, 1), "clonerange") \ | ||
| 266 | f(ASSERT_SRC_VERSION, __CEPH_OSD_OP(RD, MULTI, 2), "assert-src-version") \ | ||
| 267 | f(SRC_CMPXATTR, __CEPH_OSD_OP(RD, MULTI, 3), "src-cmpxattr") \ | ||
| 268 | \ | ||
| 269 | /** attrs **/ \ | ||
| 270 | /* read */ \ | ||
| 271 | f(GETXATTR, __CEPH_OSD_OP(RD, ATTR, 1), "getxattr") \ | ||
| 272 | f(GETXATTRS, __CEPH_OSD_OP(RD, ATTR, 2), "getxattrs") \ | ||
| 273 | f(CMPXATTR, __CEPH_OSD_OP(RD, ATTR, 3), "cmpxattr") \ | ||
| 274 | \ | ||
| 275 | /* write */ \ | ||
| 276 | f(SETXATTR, __CEPH_OSD_OP(WR, ATTR, 1), "setxattr") \ | ||
| 277 | f(SETXATTRS, __CEPH_OSD_OP(WR, ATTR, 2), "setxattrs") \ | ||
| 278 | f(RESETXATTRS, __CEPH_OSD_OP(WR, ATTR, 3), "resetxattrs") \ | ||
| 279 | f(RMXATTR, __CEPH_OSD_OP(WR, ATTR, 4), "rmxattr") \ | ||
| 280 | \ | ||
| 281 | /** subop **/ \ | ||
| 282 | f(PULL, __CEPH_OSD_OP1(SUB, 1), "pull") \ | ||
| 283 | f(PUSH, __CEPH_OSD_OP1(SUB, 2), "push") \ | ||
| 284 | f(BALANCEREADS, __CEPH_OSD_OP1(SUB, 3), "balance-reads") \ | ||
| 285 | f(UNBALANCEREADS, __CEPH_OSD_OP1(SUB, 4), "unbalance-reads") \ | ||
| 286 | f(SCRUB, __CEPH_OSD_OP1(SUB, 5), "scrub") \ | ||
| 287 | f(SCRUB_RESERVE, __CEPH_OSD_OP1(SUB, 6), "scrub-reserve") \ | ||
| 288 | f(SCRUB_UNRESERVE, __CEPH_OSD_OP1(SUB, 7), "scrub-unreserve") \ | ||
| 289 | f(SCRUB_STOP, __CEPH_OSD_OP1(SUB, 8), "scrub-stop") \ | ||
| 290 | f(SCRUB_MAP, __CEPH_OSD_OP1(SUB, 9), "scrub-map") \ | ||
| 291 | \ | ||
| 292 | /** lock **/ \ | ||
| 293 | f(WRLOCK, __CEPH_OSD_OP(WR, LOCK, 1), "wrlock") \ | ||
| 294 | f(WRUNLOCK, __CEPH_OSD_OP(WR, LOCK, 2), "wrunlock") \ | ||
| 295 | f(RDLOCK, __CEPH_OSD_OP(WR, LOCK, 3), "rdlock") \ | ||
| 296 | f(RDUNLOCK, __CEPH_OSD_OP(WR, LOCK, 4), "rdunlock") \ | ||
| 297 | f(UPLOCK, __CEPH_OSD_OP(WR, LOCK, 5), "uplock") \ | ||
| 298 | f(DNLOCK, __CEPH_OSD_OP(WR, LOCK, 6), "dnlock") \ | ||
| 299 | \ | ||
| 300 | /** exec **/ \ | ||
| 301 | /* note: the RD bit here is wrong; see special-case below in helper */ \ | ||
| 302 | f(CALL, __CEPH_OSD_OP(RD, EXEC, 1), "call") \ | ||
| 303 | \ | ||
| 304 | /** pg **/ \ | ||
| 305 | f(PGLS, __CEPH_OSD_OP(RD, PG, 1), "pgls") \ | ||
| 306 | f(PGLS_FILTER, __CEPH_OSD_OP(RD, PG, 2), "pgls-filter") \ | ||
| 307 | f(PG_HITSET_LS, __CEPH_OSD_OP(RD, PG, 3), "pg-hitset-ls") \ | ||
| 308 | f(PG_HITSET_GET, __CEPH_OSD_OP(RD, PG, 4), "pg-hitset-get") | ||
| 309 | |||
| 184 | enum { | 310 | enum { |
| 185 | /** data **/ | 311 | #define GENERATE_ENUM_ENTRY(op, opcode, str) CEPH_OSD_OP_##op = (opcode), |
| 186 | /* read */ | 312 | __CEPH_FORALL_OSD_OPS(GENERATE_ENUM_ENTRY) |
| 187 | CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1, | 313 | #undef GENERATE_ENUM_ENTRY |
| 188 | CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2, | ||
| 189 | CEPH_OSD_OP_MAPEXT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 3, | ||
| 190 | |||
| 191 | /* fancy read */ | ||
| 192 | CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4, | ||
| 193 | CEPH_OSD_OP_SPARSE_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 5, | ||
| 194 | |||
| 195 | CEPH_OSD_OP_NOTIFY = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 6, | ||
| 196 | CEPH_OSD_OP_NOTIFY_ACK = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 7, | ||
| 197 | |||
| 198 | /* versioning */ | ||
| 199 | CEPH_OSD_OP_ASSERT_VER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 8, | ||
| 200 | |||
| 201 | /* write */ | ||
| 202 | CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1, | ||
| 203 | CEPH_OSD_OP_WRITEFULL = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 2, | ||
| 204 | CEPH_OSD_OP_TRUNCATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 3, | ||
| 205 | CEPH_OSD_OP_ZERO = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 4, | ||
| 206 | CEPH_OSD_OP_DELETE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 5, | ||
| 207 | |||
| 208 | /* fancy write */ | ||
| 209 | CEPH_OSD_OP_APPEND = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 6, | ||
| 210 | CEPH_OSD_OP_STARTSYNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 7, | ||
| 211 | CEPH_OSD_OP_SETTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 8, | ||
| 212 | CEPH_OSD_OP_TRIMTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 9, | ||
| 213 | |||
| 214 | CEPH_OSD_OP_TMAPUP = CEPH_OSD_OP_MODE_RMW | CEPH_OSD_OP_TYPE_DATA | 10, | ||
| 215 | CEPH_OSD_OP_TMAPPUT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 11, | ||
| 216 | CEPH_OSD_OP_TMAPGET = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 12, | ||
| 217 | |||
| 218 | CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13, | ||
| 219 | CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14, | ||
| 220 | |||
| 221 | CEPH_OSD_OP_WATCH = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 15, | ||
| 222 | |||
| 223 | /* omap */ | ||
| 224 | CEPH_OSD_OP_OMAPGETKEYS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 17, | ||
| 225 | CEPH_OSD_OP_OMAPGETVALS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 18, | ||
| 226 | CEPH_OSD_OP_OMAPGETHEADER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 19, | ||
| 227 | CEPH_OSD_OP_OMAPGETVALSBYKEYS = | ||
| 228 | CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 20, | ||
| 229 | CEPH_OSD_OP_OMAPSETVALS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 21, | ||
| 230 | CEPH_OSD_OP_OMAPSETHEADER = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 22, | ||
| 231 | CEPH_OSD_OP_OMAPCLEAR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 23, | ||
| 232 | CEPH_OSD_OP_OMAPRMKEYS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 24, | ||
| 233 | CEPH_OSD_OP_OMAP_CMP = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 25, | ||
| 234 | |||
| 235 | /* hints */ | ||
| 236 | CEPH_OSD_OP_SETALLOCHINT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 35, | ||
| 237 | |||
| 238 | /** multi **/ | ||
| 239 | CEPH_OSD_OP_CLONERANGE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_MULTI | 1, | ||
| 240 | CEPH_OSD_OP_ASSERT_SRC_VERSION = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 2, | ||
| 241 | CEPH_OSD_OP_SRC_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 3, | ||
| 242 | |||
| 243 | /** attrs **/ | ||
| 244 | /* read */ | ||
| 245 | CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1, | ||
| 246 | CEPH_OSD_OP_GETXATTRS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 2, | ||
| 247 | CEPH_OSD_OP_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 3, | ||
| 248 | |||
| 249 | /* write */ | ||
| 250 | CEPH_OSD_OP_SETXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 1, | ||
| 251 | CEPH_OSD_OP_SETXATTRS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 2, | ||
| 252 | CEPH_OSD_OP_RESETXATTRS = CEPH_OSD_OP_MODE_WR|CEPH_OSD_OP_TYPE_ATTR | 3, | ||
| 253 | CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4, | ||
| 254 | |||
| 255 | /** subop **/ | ||
| 256 | CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1, | ||
| 257 | CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2, | ||
| 258 | CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3, | ||
| 259 | CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4, | ||
| 260 | CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5, | ||
| 261 | CEPH_OSD_OP_SCRUB_RESERVE = CEPH_OSD_OP_MODE_SUB | 6, | ||
| 262 | CEPH_OSD_OP_SCRUB_UNRESERVE = CEPH_OSD_OP_MODE_SUB | 7, | ||
| 263 | CEPH_OSD_OP_SCRUB_STOP = CEPH_OSD_OP_MODE_SUB | 8, | ||
| 264 | CEPH_OSD_OP_SCRUB_MAP = CEPH_OSD_OP_MODE_SUB | 9, | ||
| 265 | |||
| 266 | /** lock **/ | ||
| 267 | CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1, | ||
| 268 | CEPH_OSD_OP_WRUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 2, | ||
| 269 | CEPH_OSD_OP_RDLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 3, | ||
| 270 | CEPH_OSD_OP_RDUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 4, | ||
| 271 | CEPH_OSD_OP_UPLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 5, | ||
| 272 | CEPH_OSD_OP_DNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 6, | ||
| 273 | |||
| 274 | /** exec **/ | ||
| 275 | /* note: the RD bit here is wrong; see special-case below in helper */ | ||
| 276 | CEPH_OSD_OP_CALL = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_EXEC | 1, | ||
| 277 | |||
| 278 | /** pg **/ | ||
| 279 | CEPH_OSD_OP_PGLS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 1, | ||
| 280 | CEPH_OSD_OP_PGLS_FILTER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 2, | ||
| 281 | }; | 314 | }; |
| 282 | 315 | ||
| 283 | static inline int ceph_osd_op_type_lock(int op) | 316 | static inline int ceph_osd_op_type_lock(int op) |
