aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ceph
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/linux/ceph
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'include/linux/ceph')
-rw-r--r--include/linux/ceph/auth.h12
-rw-r--r--include/linux/ceph/ceph_features.h27
-rw-r--r--include/linux/ceph/ceph_fs.h22
-rw-r--r--include/linux/ceph/debugfs.h4
-rw-r--r--include/linux/ceph/decode.h63
-rw-r--r--include/linux/ceph/libceph.h33
-rw-r--r--include/linux/ceph/mdsmap.h3
-rw-r--r--include/linux/ceph/messenger.h91
-rw-r--r--include/linux/ceph/mon_client.h5
-rw-r--r--include/linux/ceph/msgpool.h5
-rw-r--r--include/linux/ceph/osd_client.h21
-rw-r--r--include/linux/ceph/osdmap.h13
-rw-r--r--include/linux/ceph/rados.h4
-rw-r--r--include/linux/ceph/types.h6
14 files changed, 128 insertions, 181 deletions
diff --git a/include/linux/ceph/auth.h b/include/linux/ceph/auth.h
index d4080f309b5..aa13392a7ef 100644
--- a/include/linux/ceph/auth.h
+++ b/include/linux/ceph/auth.h
@@ -14,14 +14,6 @@
14struct ceph_auth_client; 14struct ceph_auth_client;
15struct ceph_authorizer; 15struct ceph_authorizer;
16 16
17struct ceph_auth_handshake {
18 struct ceph_authorizer *authorizer;
19 void *authorizer_buf;
20 size_t authorizer_buf_len;
21 void *authorizer_reply_buf;
22 size_t authorizer_reply_buf_len;
23};
24
25struct ceph_auth_client_ops { 17struct ceph_auth_client_ops {
26 const char *name; 18 const char *name;
27 19
@@ -51,7 +43,9 @@ struct ceph_auth_client_ops {
51 * the response to authenticate the service. 43 * the response to authenticate the service.
52 */ 44 */
53 int (*create_authorizer)(struct ceph_auth_client *ac, int peer_type, 45 int (*create_authorizer)(struct ceph_auth_client *ac, int peer_type,
54 struct ceph_auth_handshake *auth); 46 struct ceph_authorizer **a,
47 void **buf, size_t *len,
48 void **reply_buf, size_t *reply_len);
55 int (*verify_authorizer_reply)(struct ceph_auth_client *ac, 49 int (*verify_authorizer_reply)(struct ceph_auth_client *ac,
56 struct ceph_authorizer *a, size_t len); 50 struct ceph_authorizer *a, size_t len);
57 void (*destroy_authorizer)(struct ceph_auth_client *ac, 51 void (*destroy_authorizer)(struct ceph_auth_client *ac,
diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h
deleted file mode 100644
index dad579b0c0e..00000000000
--- a/include/linux/ceph/ceph_features.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifndef __CEPH_FEATURES
2#define __CEPH_FEATURES
3
4/*
5 * feature bits
6 */
7#define CEPH_FEATURE_UID (1<<0)
8#define CEPH_FEATURE_NOSRCADDR (1<<1)
9#define CEPH_FEATURE_MONCLOCKCHECK (1<<2)
10#define CEPH_FEATURE_FLOCK (1<<3)
11#define CEPH_FEATURE_SUBSCRIBE2 (1<<4)
12#define CEPH_FEATURE_MONNAMES (1<<5)
13#define CEPH_FEATURE_RECONNECT_SEQ (1<<6)
14#define CEPH_FEATURE_DIRLAYOUTHASH (1<<7)
15/* bits 8-17 defined by user-space; not supported yet here */
16#define CEPH_FEATURE_CRUSH_TUNABLES (1<<18)
17
18/*
19 * Features supported.
20 */
21#define CEPH_FEATURES_SUPPORTED_DEFAULT \
22 (CEPH_FEATURE_NOSRCADDR | \
23 CEPH_FEATURE_CRUSH_TUNABLES)
24
25#define CEPH_FEATURES_REQUIRED_DEFAULT \
26 (CEPH_FEATURE_NOSRCADDR)
27#endif
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index cf6f4d998a7..b8c60694b2b 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -12,8 +12,8 @@
12#ifndef CEPH_FS_H 12#ifndef CEPH_FS_H
13#define CEPH_FS_H 13#define CEPH_FS_H
14 14
15#include <linux/ceph/msgr.h> 15#include "msgr.h"
16#include <linux/ceph/rados.h> 16#include "rados.h"
17 17
18/* 18/*
19 * subprotocol versions. when specific messages types or high-level 19 * subprotocol versions. when specific messages types or high-level
@@ -35,6 +35,20 @@
35/* arbitrary limit on max # of monitors (cluster of 3 is typical) */ 35/* arbitrary limit on max # of monitors (cluster of 3 is typical) */
36#define CEPH_MAX_MON 31 36#define CEPH_MAX_MON 31
37 37
38
39/*
40 * feature bits
41 */
42#define CEPH_FEATURE_UID (1<<0)
43#define CEPH_FEATURE_NOSRCADDR (1<<1)
44#define CEPH_FEATURE_MONCLOCKCHECK (1<<2)
45#define CEPH_FEATURE_FLOCK (1<<3)
46#define CEPH_FEATURE_SUBSCRIBE2 (1<<4)
47#define CEPH_FEATURE_MONNAMES (1<<5)
48#define CEPH_FEATURE_RECONNECT_SEQ (1<<6)
49#define CEPH_FEATURE_DIRLAYOUTHASH (1<<7)
50
51
38/* 52/*
39 * ceph_file_layout - describe data layout for a file/inode 53 * ceph_file_layout - describe data layout for a file/inode
40 */ 54 */
@@ -51,7 +65,7 @@ struct ceph_file_layout {
51 __le32 fl_object_stripe_unit; /* UNUSED. for per-object parity, if any */ 65 __le32 fl_object_stripe_unit; /* UNUSED. for per-object parity, if any */
52 66
53 /* object -> pg layout */ 67 /* object -> pg layout */
54 __le32 fl_unused; /* unused; used to be preferred primary (-1) */ 68 __le32 fl_pg_preferred; /* preferred primary for pg (-1 for none) */
55 __le32 fl_pg_pool; /* namespace, crush ruleset, rep level */ 69 __le32 fl_pg_pool; /* namespace, crush ruleset, rep level */
56} __attribute__ ((packed)); 70} __attribute__ ((packed));
57 71
@@ -370,7 +384,7 @@ union ceph_mds_request_args {
370 __le32 stripe_count; /* ... */ 384 __le32 stripe_count; /* ... */
371 __le32 object_size; 385 __le32 object_size;
372 __le32 file_replication; 386 __le32 file_replication;
373 __le32 unused; /* used to be preferred osd */ 387 __le32 preferred;
374 } __attribute__ ((packed)) open; 388 } __attribute__ ((packed)) open;
375 struct { 389 struct {
376 __le32 flags; 390 __le32 flags;
diff --git a/include/linux/ceph/debugfs.h b/include/linux/ceph/debugfs.h
index 1df086d7882..2a79702e092 100644
--- a/include/linux/ceph/debugfs.h
+++ b/include/linux/ceph/debugfs.h
@@ -1,8 +1,8 @@
1#ifndef _FS_CEPH_DEBUGFS_H 1#ifndef _FS_CEPH_DEBUGFS_H
2#define _FS_CEPH_DEBUGFS_H 2#define _FS_CEPH_DEBUGFS_H
3 3
4#include <linux/ceph/ceph_debug.h> 4#include "ceph_debug.h"
5#include <linux/ceph/types.h> 5#include "types.h"
6 6
7#define CEPH_DEFINE_SHOW_FUNC(name) \ 7#define CEPH_DEFINE_SHOW_FUNC(name) \
8static int name##_open(struct inode *inode, struct file *file) \ 8static int name##_open(struct inode *inode, struct file *file) \
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index 63d092822ba..c5b6939fb32 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -1,12 +1,10 @@
1#ifndef __CEPH_DECODE_H 1#ifndef __CEPH_DECODE_H
2#define __CEPH_DECODE_H 2#define __CEPH_DECODE_H
3 3
4#include <linux/err.h>
5#include <linux/bug.h>
6#include <linux/time.h>
7#include <asm/unaligned.h> 4#include <asm/unaligned.h>
5#include <linux/time.h>
8 6
9#include <linux/ceph/types.h> 7#include "types.h"
10 8
11/* 9/*
12 * in all cases, 10 * in all cases,
@@ -47,14 +45,9 @@ static inline void ceph_decode_copy(void **p, void *pv, size_t n)
47/* 45/*
48 * bounds check input. 46 * bounds check input.
49 */ 47 */
50static inline int ceph_has_room(void **p, void *end, size_t n)
51{
52 return end >= *p && n <= end - *p;
53}
54
55#define ceph_decode_need(p, end, n, bad) \ 48#define ceph_decode_need(p, end, n, bad) \
56 do { \ 49 do { \
57 if (!likely(ceph_has_room(p, end, n))) \ 50 if (unlikely(*(p) + (n) > (end))) \
58 goto bad; \ 51 goto bad; \
59 } while (0) 52 } while (0)
60 53
@@ -86,52 +79,6 @@ static inline int ceph_has_room(void **p, void *end, size_t n)
86 } while (0) 79 } while (0)
87 80
88/* 81/*
89 * Allocate a buffer big enough to hold the wire-encoded string, and
90 * decode the string into it. The resulting string will always be
91 * terminated with '\0'. If successful, *p will be advanced
92 * past the decoded data. Also, if lenp is not a null pointer, the
93 * length (not including the terminating '\0') will be recorded in
94 * *lenp. Note that a zero-length string is a valid return value.
95 *
96 * Returns a pointer to the newly-allocated string buffer, or a
97 * pointer-coded errno if an error occurs. Neither *p nor *lenp
98 * will have been updated if an error is returned.
99 *
100 * There are two possible failures:
101 * - converting the string would require accessing memory at or
102 * beyond the "end" pointer provided (-E
103 * - memory could not be allocated for the result
104 */
105static inline char *ceph_extract_encoded_string(void **p, void *end,
106 size_t *lenp, gfp_t gfp)
107{
108 u32 len;
109 void *sp = *p;
110 char *buf;
111
112 ceph_decode_32_safe(&sp, end, len, bad);
113 if (!ceph_has_room(&sp, end, len))
114 goto bad;
115
116 buf = kmalloc(len + 1, gfp);
117 if (!buf)
118 return ERR_PTR(-ENOMEM);
119
120 if (len)
121 memcpy(buf, sp, len);
122 buf[len] = '\0';
123
124 *p = (char *) *p + sizeof (u32) + len;
125 if (lenp)
126 *lenp = (size_t) len;
127
128 return buf;
129
130bad:
131 return ERR_PTR(-ERANGE);
132}
133
134/*
135 * struct ceph_timespec <-> struct timespec 82 * struct ceph_timespec <-> struct timespec
136 */ 83 */
137static inline void ceph_decode_timespec(struct timespec *ts, 84static inline void ceph_decode_timespec(struct timespec *ts,
@@ -198,7 +145,7 @@ static inline void ceph_encode_filepath(void **p, void *end,
198 u64 ino, const char *path) 145 u64 ino, const char *path)
199{ 146{
200 u32 len = path ? strlen(path) : 0; 147 u32 len = path ? strlen(path) : 0;
201 BUG_ON(*p + 1 + sizeof(ino) + sizeof(len) + len > end); 148 BUG_ON(*p + sizeof(ino) + sizeof(len) + len > end);
202 ceph_encode_8(p, 1); 149 ceph_encode_8(p, 1);
203 ceph_encode_64(p, ino); 150 ceph_encode_64(p, ino);
204 ceph_encode_32(p, len); 151 ceph_encode_32(p, len);
@@ -219,7 +166,7 @@ static inline void ceph_encode_string(void **p, void *end,
219 166
220#define ceph_encode_need(p, end, n, bad) \ 167#define ceph_encode_need(p, end, n, bad) \
221 do { \ 168 do { \
222 if (!likely(ceph_has_room(p, end, n))) \ 169 if (unlikely(*(p) + (n) > (end))) \
223 goto bad; \ 170 goto bad; \
224 } while (0) 171 } while (0)
225 172
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 084d3c622b1..563755181c1 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -1,13 +1,12 @@
1#ifndef _FS_CEPH_LIBCEPH_H 1#ifndef _FS_CEPH_LIBCEPH_H
2#define _FS_CEPH_LIBCEPH_H 2#define _FS_CEPH_LIBCEPH_H
3 3
4#include <linux/ceph/ceph_debug.h> 4#include "ceph_debug.h"
5 5
6#include <asm/unaligned.h> 6#include <asm/unaligned.h>
7#include <linux/backing-dev.h> 7#include <linux/backing-dev.h>
8#include <linux/completion.h> 8#include <linux/completion.h>
9#include <linux/exportfs.h> 9#include <linux/exportfs.h>
10#include <linux/bug.h>
11#include <linux/fs.h> 10#include <linux/fs.h>
12#include <linux/mempool.h> 11#include <linux/mempool.h>
13#include <linux/pagemap.h> 12#include <linux/pagemap.h>
@@ -15,12 +14,18 @@
15#include <linux/writeback.h> 14#include <linux/writeback.h>
16#include <linux/slab.h> 15#include <linux/slab.h>
17 16
18#include <linux/ceph/types.h> 17#include "types.h"
19#include <linux/ceph/messenger.h> 18#include "messenger.h"
20#include <linux/ceph/msgpool.h> 19#include "msgpool.h"
21#include <linux/ceph/mon_client.h> 20#include "mon_client.h"
22#include <linux/ceph/osd_client.h> 21#include "osd_client.h"
23#include <linux/ceph/ceph_fs.h> 22#include "ceph_fs.h"
23
24/*
25 * Supported features
26 */
27#define CEPH_FEATURE_SUPPORTED_DEFAULT CEPH_FEATURE_NOSRCADDR
28#define CEPH_FEATURE_REQUIRED_DEFAULT CEPH_FEATURE_NOSRCADDR
24 29
25/* 30/*
26 * mount options 31 * mount options
@@ -43,6 +48,7 @@ struct ceph_options {
43 struct ceph_entity_addr my_addr; 48 struct ceph_entity_addr my_addr;
44 int mount_timeout; 49 int mount_timeout;
45 int osd_idle_ttl; 50 int osd_idle_ttl;
51 int osd_timeout;
46 int osd_keepalive_timeout; 52 int osd_keepalive_timeout;
47 53
48 /* 54 /*
@@ -62,6 +68,7 @@ struct ceph_options {
62 * defaults 68 * defaults
63 */ 69 */
64#define CEPH_MOUNT_TIMEOUT_DEFAULT 60 70#define CEPH_MOUNT_TIMEOUT_DEFAULT 60
71#define CEPH_OSD_TIMEOUT_DEFAULT 60 /* seconds */
65#define CEPH_OSD_KEEPALIVE_DEFAULT 5 72#define CEPH_OSD_KEEPALIVE_DEFAULT 5
66#define CEPH_OSD_IDLE_TTL_DEFAULT 60 73#define CEPH_OSD_IDLE_TTL_DEFAULT 60
67 74
@@ -124,7 +131,7 @@ struct ceph_client {
124 u32 supported_features; 131 u32 supported_features;
125 u32 required_features; 132 u32 required_features;
126 133
127 struct ceph_messenger msgr; /* messenger instance */ 134 struct ceph_messenger *msgr; /* messenger instance */
128 struct ceph_mon_client monc; 135 struct ceph_mon_client monc;
129 struct ceph_osd_client osdc; 136 struct ceph_osd_client osdc;
130 137
@@ -152,7 +159,7 @@ struct ceph_client {
152struct ceph_snap_context { 159struct ceph_snap_context {
153 atomic_t nref; 160 atomic_t nref;
154 u64 seq; 161 u64 seq;
155 u32 num_snaps; 162 int num_snaps;
156 u64 snaps[]; 163 u64 snaps[];
157}; 164};
158 165
@@ -200,7 +207,7 @@ extern struct kmem_cache *ceph_cap_cachep;
200extern struct kmem_cache *ceph_dentry_cachep; 207extern struct kmem_cache *ceph_dentry_cachep;
201extern struct kmem_cache *ceph_file_cachep; 208extern struct kmem_cache *ceph_file_cachep;
202 209
203extern struct ceph_options *ceph_parse_options(char *options, 210extern int ceph_parse_options(struct ceph_options **popt, char *options,
204 const char *dev_name, const char *dev_name_end, 211 const char *dev_name, const char *dev_name_end,
205 int (*parse_extra_token)(char *c, void *private), 212 int (*parse_extra_token)(char *c, void *private),
206 void *private); 213 void *private);
@@ -208,9 +215,7 @@ extern void ceph_destroy_options(struct ceph_options *opt);
208extern int ceph_compare_options(struct ceph_options *new_opt, 215extern int ceph_compare_options(struct ceph_options *new_opt,
209 struct ceph_client *client); 216 struct ceph_client *client);
210extern struct ceph_client *ceph_create_client(struct ceph_options *opt, 217extern struct ceph_client *ceph_create_client(struct ceph_options *opt,
211 void *private, 218 void *private);
212 unsigned supported_features,
213 unsigned required_features);
214extern u64 ceph_client_id(struct ceph_client *client); 219extern u64 ceph_client_id(struct ceph_client *client);
215extern void ceph_destroy_client(struct ceph_client *client); 220extern void ceph_destroy_client(struct ceph_client *client);
216extern int __ceph_open_session(struct ceph_client *client, 221extern int __ceph_open_session(struct ceph_client *client,
diff --git a/include/linux/ceph/mdsmap.h b/include/linux/ceph/mdsmap.h
index cb15b5d867c..4c5cb0880bb 100644
--- a/include/linux/ceph/mdsmap.h
+++ b/include/linux/ceph/mdsmap.h
@@ -1,8 +1,7 @@
1#ifndef _FS_CEPH_MDSMAP_H 1#ifndef _FS_CEPH_MDSMAP_H
2#define _FS_CEPH_MDSMAP_H 2#define _FS_CEPH_MDSMAP_H
3 3
4#include <linux/bug.h> 4#include "types.h"
5#include <linux/ceph/types.h>
6 5
7/* 6/*
8 * mds map - describe servers in the mds cluster. 7 * mds map - describe servers in the mds cluster.
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index 14ba5ee738a..d7adf151d33 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -6,14 +6,17 @@
6#include <linux/net.h> 6#include <linux/net.h>
7#include <linux/radix-tree.h> 7#include <linux/radix-tree.h>
8#include <linux/uio.h> 8#include <linux/uio.h>
9#include <linux/version.h>
9#include <linux/workqueue.h> 10#include <linux/workqueue.h>
10 11
11#include <linux/ceph/types.h> 12#include "types.h"
12#include <linux/ceph/buffer.h> 13#include "buffer.h"
13 14
14struct ceph_msg; 15struct ceph_msg;
15struct ceph_connection; 16struct ceph_connection;
16 17
18extern struct workqueue_struct *ceph_msgr_wq; /* receive work queue */
19
17/* 20/*
18 * Ceph defines these callbacks for handling connection events. 21 * Ceph defines these callbacks for handling connection events.
19 */ 22 */
@@ -25,12 +28,15 @@ struct ceph_connection_operations {
25 void (*dispatch) (struct ceph_connection *con, struct ceph_msg *m); 28 void (*dispatch) (struct ceph_connection *con, struct ceph_msg *m);
26 29
27 /* authorize an outgoing connection */ 30 /* authorize an outgoing connection */
28 struct ceph_auth_handshake *(*get_authorizer) ( 31 int (*get_authorizer) (struct ceph_connection *con,
29 struct ceph_connection *con, 32 void **buf, int *len, int *proto,
30 int *proto, int force_new); 33 void **reply_buf, int *reply_len, int force_new);
31 int (*verify_authorizer_reply) (struct ceph_connection *con, int len); 34 int (*verify_authorizer_reply) (struct ceph_connection *con, int len);
32 int (*invalidate_authorizer)(struct ceph_connection *con); 35 int (*invalidate_authorizer)(struct ceph_connection *con);
33 36
37 /* protocol version mismatch */
38 void (*bad_proto) (struct ceph_connection *con);
39
34 /* there was some error on the socket (disconnect, whatever) */ 40 /* there was some error on the socket (disconnect, whatever) */
35 void (*fault) (struct ceph_connection *con); 41 void (*fault) (struct ceph_connection *con);
36 42
@@ -49,8 +55,8 @@ struct ceph_connection_operations {
49struct ceph_messenger { 55struct ceph_messenger {
50 struct ceph_entity_inst inst; /* my name+address */ 56 struct ceph_entity_inst inst; /* my name+address */
51 struct ceph_entity_addr my_enc_addr; 57 struct ceph_entity_addr my_enc_addr;
58 struct page *zero_page; /* used in certain error cases */
52 59
53 atomic_t stopping;
54 bool nocrc; 60 bool nocrc;
55 61
56 /* 62 /*
@@ -78,10 +84,7 @@ struct ceph_msg {
78 unsigned nr_pages; /* size of page array */ 84 unsigned nr_pages; /* size of page array */
79 unsigned page_alignment; /* io offset in first page */ 85 unsigned page_alignment; /* io offset in first page */
80 struct ceph_pagelist *pagelist; /* instead of pages */ 86 struct ceph_pagelist *pagelist; /* instead of pages */
81
82 struct ceph_connection *con;
83 struct list_head list_head; 87 struct list_head list_head;
84
85 struct kref kref; 88 struct kref kref;
86 struct bio *bio; /* instead of pages/pagelist */ 89 struct bio *bio; /* instead of pages/pagelist */
87 struct bio *bio_iter; /* bio iterator */ 90 struct bio *bio_iter; /* bio iterator */
@@ -99,7 +102,7 @@ struct ceph_msg {
99struct ceph_msg_pos { 102struct ceph_msg_pos {
100 int page, page_pos; /* which page; offset in page */ 103 int page, page_pos; /* which page; offset in page */
101 int data_pos; /* offset in data payload */ 104 int data_pos; /* offset in data payload */
102 bool did_page_crc; /* true if we've calculated crc for current page */ 105 int did_page_crc; /* true if we've calculated crc for current page */
103}; 106};
104 107
105/* ceph connection fault delay defaults, for exponential backoff */ 108/* ceph connection fault delay defaults, for exponential backoff */
@@ -107,6 +110,23 @@ struct ceph_msg_pos {
107#define MAX_DELAY_INTERVAL (5 * 60 * HZ) 110#define MAX_DELAY_INTERVAL (5 * 60 * HZ)
108 111
109/* 112/*
113 * ceph_connection state bit flags
114 */
115#define LOSSYTX 0 /* we can close channel or drop messages on errors */
116#define CONNECTING 1
117#define NEGOTIATING 2
118#define KEEPALIVE_PENDING 3
119#define WRITE_PENDING 4 /* we have data ready to send */
120#define STANDBY 8 /* no outgoing messages, socket closed. we keep
121 * the ceph_connection around to maintain shared
122 * state with the peer. */
123#define CLOSED 10 /* we've closed the connection */
124#define SOCK_CLOSED 11 /* socket state changed to closed */
125#define OPENING 13 /* open connection w/ (possibly new) peer */
126#define DEAD 14 /* dead, about to kfree */
127#define BACKOFF 15
128
129/*
110 * A single connection with another host. 130 * A single connection with another host.
111 * 131 *
112 * We maintain a queue of outgoing messages, and some session state to 132 * We maintain a queue of outgoing messages, and some session state to
@@ -115,22 +135,18 @@ struct ceph_msg_pos {
115 */ 135 */
116struct ceph_connection { 136struct ceph_connection {
117 void *private; 137 void *private;
138 atomic_t nref;
118 139
119 const struct ceph_connection_operations *ops; 140 const struct ceph_connection_operations *ops;
120 141
121 struct ceph_messenger *msgr; 142 struct ceph_messenger *msgr;
122
123 atomic_t sock_state;
124 struct socket *sock; 143 struct socket *sock;
125 struct ceph_entity_addr peer_addr; /* peer address */ 144 unsigned long state; /* connection state (see flags above) */
126 struct ceph_entity_addr peer_addr_for_me;
127
128 unsigned long flags;
129 unsigned long state;
130 const char *error_msg; /* error message, if any */ 145 const char *error_msg; /* error message, if any */
131 146
147 struct ceph_entity_addr peer_addr; /* peer address */
132 struct ceph_entity_name peer_name; /* peer name */ 148 struct ceph_entity_name peer_name; /* peer name */
133 149 struct ceph_entity_addr peer_addr_for_me;
134 unsigned peer_features; 150 unsigned peer_features;
135 u32 connect_seq; /* identify the most recent connection 151 u32 connect_seq; /* identify the most recent connection
136 attempt for this connection, client */ 152 attempt for this connection, client */
@@ -151,8 +167,16 @@ struct ceph_connection {
151 167
152 /* connection negotiation temps */ 168 /* connection negotiation temps */
153 char in_banner[CEPH_BANNER_MAX_LEN]; 169 char in_banner[CEPH_BANNER_MAX_LEN];
154 struct ceph_msg_connect out_connect; 170 union {
155 struct ceph_msg_connect_reply in_reply; 171 struct { /* outgoing connection */
172 struct ceph_msg_connect out_connect;
173 struct ceph_msg_connect_reply in_reply;
174 };
175 struct { /* incoming */
176 struct ceph_msg_connect in_connect;
177 struct ceph_msg_connect_reply out_reply;
178 };
179 };
156 struct ceph_entity_addr actual_peer_addr; 180 struct ceph_entity_addr actual_peer_addr;
157 181
158 /* message out temps */ 182 /* message out temps */
@@ -195,29 +219,26 @@ extern int ceph_msgr_init(void);
195extern void ceph_msgr_exit(void); 219extern void ceph_msgr_exit(void);
196extern void ceph_msgr_flush(void); 220extern void ceph_msgr_flush(void);
197 221
198extern void ceph_messenger_init(struct ceph_messenger *msgr, 222extern struct ceph_messenger *ceph_messenger_create(
199 struct ceph_entity_addr *myaddr, 223 struct ceph_entity_addr *myaddr,
200 u32 supported_features, 224 u32 features, u32 required);
201 u32 required_features, 225extern void ceph_messenger_destroy(struct ceph_messenger *);
202 bool nocrc);
203 226
204extern void ceph_con_init(struct ceph_connection *con, void *private, 227extern void ceph_con_init(struct ceph_messenger *msgr,
205 const struct ceph_connection_operations *ops, 228 struct ceph_connection *con);
206 struct ceph_messenger *msgr);
207extern void ceph_con_open(struct ceph_connection *con, 229extern void ceph_con_open(struct ceph_connection *con,
208 __u8 entity_type, __u64 entity_num,
209 struct ceph_entity_addr *addr); 230 struct ceph_entity_addr *addr);
210extern bool ceph_con_opened(struct ceph_connection *con); 231extern bool ceph_con_opened(struct ceph_connection *con);
211extern void ceph_con_close(struct ceph_connection *con); 232extern void ceph_con_close(struct ceph_connection *con);
212extern void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg); 233extern void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg);
213 234extern void ceph_con_revoke(struct ceph_connection *con, struct ceph_msg *msg);
214extern void ceph_msg_revoke(struct ceph_msg *msg); 235extern void ceph_con_revoke_message(struct ceph_connection *con,
215extern void ceph_msg_revoke_incoming(struct ceph_msg *msg); 236 struct ceph_msg *msg);
216
217extern void ceph_con_keepalive(struct ceph_connection *con); 237extern void ceph_con_keepalive(struct ceph_connection *con);
238extern struct ceph_connection *ceph_con_get(struct ceph_connection *con);
239extern void ceph_con_put(struct ceph_connection *con);
218 240
219extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, 241extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags);
220 bool can_fail);
221extern void ceph_msg_kfree(struct ceph_msg *m); 242extern void ceph_msg_kfree(struct ceph_msg *m);
222 243
223 244
diff --git a/include/linux/ceph/mon_client.h b/include/linux/ceph/mon_client.h
index a486f390dfb..545f8591778 100644
--- a/include/linux/ceph/mon_client.h
+++ b/include/linux/ceph/mon_client.h
@@ -5,7 +5,7 @@
5#include <linux/kref.h> 5#include <linux/kref.h>
6#include <linux/rbtree.h> 6#include <linux/rbtree.h>
7 7
8#include <linux/ceph/messenger.h> 8#include "messenger.h"
9 9
10struct ceph_client; 10struct ceph_client;
11struct ceph_mount_args; 11struct ceph_mount_args;
@@ -70,7 +70,8 @@ struct ceph_mon_client {
70 bool hunting; 70 bool hunting;
71 int cur_mon; /* last monitor i contacted */ 71 int cur_mon; /* last monitor i contacted */
72 unsigned long sub_sent, sub_renew_after; 72 unsigned long sub_sent, sub_renew_after;
73 struct ceph_connection con; 73 struct ceph_connection *con;
74 bool have_fsid;
74 75
75 /* pending generic requests */ 76 /* pending generic requests */
76 struct rb_root generic_request_tree; 77 struct rb_root generic_request_tree;
diff --git a/include/linux/ceph/msgpool.h b/include/linux/ceph/msgpool.h
index 4b0d3896072..a362605f936 100644
--- a/include/linux/ceph/msgpool.h
+++ b/include/linux/ceph/msgpool.h
@@ -2,7 +2,7 @@
2#define _FS_CEPH_MSGPOOL 2#define _FS_CEPH_MSGPOOL
3 3
4#include <linux/mempool.h> 4#include <linux/mempool.h>
5#include <linux/ceph/messenger.h> 5#include "messenger.h"
6 6
7/* 7/*
8 * we use memory pools for preallocating messages we may receive, to 8 * we use memory pools for preallocating messages we may receive, to
@@ -11,11 +11,10 @@
11struct ceph_msgpool { 11struct ceph_msgpool {
12 const char *name; 12 const char *name;
13 mempool_t *pool; 13 mempool_t *pool;
14 int type; /* preallocated message type */
15 int front_len; /* preallocated payload size */ 14 int front_len; /* preallocated payload size */
16}; 15};
17 16
18extern int ceph_msgpool_init(struct ceph_msgpool *pool, int type, 17extern int ceph_msgpool_init(struct ceph_msgpool *pool,
19 int front_len, int size, bool blocking, 18 int front_len, int size, bool blocking,
20 const char *name); 19 const char *name);
21extern void ceph_msgpool_destroy(struct ceph_msgpool *pool); 20extern void ceph_msgpool_destroy(struct ceph_msgpool *pool);
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index d9b880e977e..f88eacb111d 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -6,16 +6,9 @@
6#include <linux/mempool.h> 6#include <linux/mempool.h>
7#include <linux/rbtree.h> 7#include <linux/rbtree.h>
8 8
9#include <linux/ceph/types.h> 9#include "types.h"
10#include <linux/ceph/osdmap.h> 10#include "osdmap.h"
11#include <linux/ceph/messenger.h> 11#include "messenger.h"
12#include <linux/ceph/auth.h>
13
14/*
15 * Maximum object name size
16 * (must be at least as big as RBD_MAX_MD_NAME_LEN -- currently 100)
17 */
18#define MAX_OBJ_NAME_SIZE 100
19 12
20struct ceph_msg; 13struct ceph_msg;
21struct ceph_snap_context; 14struct ceph_snap_context;
@@ -41,7 +34,9 @@ struct ceph_osd {
41 struct list_head o_requests; 34 struct list_head o_requests;
42 struct list_head o_linger_requests; 35 struct list_head o_linger_requests;
43 struct list_head o_osd_lru; 36 struct list_head o_osd_lru;
44 struct ceph_auth_handshake o_auth; 37 struct ceph_authorizer *o_authorizer;
38 void *o_authorizer_buf, *o_authorizer_reply_buf;
39 size_t o_authorizer_buf_len, o_authorizer_reply_buf_len;
45 unsigned long lru_ttl; 40 unsigned long lru_ttl;
46 int o_marked_for_keepalive; 41 int o_marked_for_keepalive;
47 struct list_head o_keepalive_item; 42 struct list_head o_keepalive_item;
@@ -80,7 +75,7 @@ struct ceph_osd_request {
80 struct inode *r_inode; /* for use by callbacks */ 75 struct inode *r_inode; /* for use by callbacks */
81 void *r_priv; /* ditto */ 76 void *r_priv; /* ditto */
82 77
83 char r_oid[MAX_OBJ_NAME_SIZE]; /* object name */ 78 char r_oid[40]; /* object name */
84 int r_oid_len; 79 int r_oid_len;
85 unsigned long r_stamp; /* send OR check time */ 80 unsigned long r_stamp; /* send OR check time */
86 81
@@ -207,7 +202,7 @@ extern void ceph_osdc_handle_reply(struct ceph_osd_client *osdc,
207extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc, 202extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc,
208 struct ceph_msg *msg); 203 struct ceph_msg *msg);
209 204
210extern int ceph_calc_raw_layout(struct ceph_osd_client *osdc, 205extern void ceph_calc_raw_layout(struct ceph_osd_client *osdc,
211 struct ceph_file_layout *layout, 206 struct ceph_file_layout *layout,
212 u64 snapid, 207 u64 snapid,
213 u64 off, u64 *plen, u64 *bno, 208 u64 off, u64 *plen, u64 *bno,
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index 10a417f9f76..ba4c205cbb0 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -2,8 +2,8 @@
2#define _FS_CEPH_OSDMAP_H 2#define _FS_CEPH_OSDMAP_H
3 3
4#include <linux/rbtree.h> 4#include <linux/rbtree.h>
5#include <linux/ceph/types.h> 5#include "types.h"
6#include <linux/ceph/ceph_fs.h> 6#include "ceph_fs.h"
7#include <linux/crush/crush.h> 7#include <linux/crush/crush.h>
8 8
9/* 9/*
@@ -65,6 +65,8 @@ struct ceph_osdmap {
65#define ceph_file_layout_cas_hash(l) ((__s32)le32_to_cpu((l).fl_cas_hash)) 65#define ceph_file_layout_cas_hash(l) ((__s32)le32_to_cpu((l).fl_cas_hash))
66#define ceph_file_layout_object_su(l) \ 66#define ceph_file_layout_object_su(l) \
67 ((__s32)le32_to_cpu((l).fl_object_stripe_unit)) 67 ((__s32)le32_to_cpu((l).fl_object_stripe_unit))
68#define ceph_file_layout_pg_preferred(l) \
69 ((__s32)le32_to_cpu((l).fl_pg_preferred))
68#define ceph_file_layout_pg_pool(l) \ 70#define ceph_file_layout_pg_pool(l) \
69 ((__s32)le32_to_cpu((l).fl_pg_pool)) 71 ((__s32)le32_to_cpu((l).fl_pg_pool))
70 72
@@ -109,9 +111,9 @@ extern struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
109extern void ceph_osdmap_destroy(struct ceph_osdmap *map); 111extern void ceph_osdmap_destroy(struct ceph_osdmap *map);
110 112
111/* calculate mapping of a file extent to an object */ 113/* calculate mapping of a file extent to an object */
112extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout, 114extern void ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
113 u64 off, u64 *plen, 115 u64 off, u64 *plen,
114 u64 *bno, u64 *oxoff, u64 *oxlen); 116 u64 *bno, u64 *oxoff, u64 *oxlen);
115 117
116/* calculate mapping of object to a placement group */ 118/* calculate mapping of object to a placement group */
117extern int ceph_calc_object_layout(struct ceph_object_layout *ol, 119extern int ceph_calc_object_layout(struct ceph_object_layout *ol,
@@ -123,7 +125,6 @@ extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
123extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap, 125extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap,
124 struct ceph_pg pgid); 126 struct ceph_pg pgid);
125 127
126extern const char *ceph_pg_pool_name_by_id(struct ceph_osdmap *map, u64 id);
127extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name); 128extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name);
128 129
129#endif 130#endif
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index 2c04afeead1..0a99099801a 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -6,7 +6,7 @@
6 * (Reliable Autonomic Distributed Object Store). 6 * (Reliable Autonomic Distributed Object Store).
7 */ 7 */
8 8
9#include <linux/ceph/msgr.h> 9#include "msgr.h"
10 10
11/* 11/*
12 * osdmap encoding versions 12 * osdmap encoding versions
@@ -87,8 +87,6 @@ struct ceph_pg {
87 * 87 *
88 * lpgp_num -- as above. 88 * lpgp_num -- as above.
89 */ 89 */
90#define CEPH_NOPOOL ((__u64) (-1)) /* pool id not defined */
91
92#define CEPH_PG_TYPE_REP 1 90#define CEPH_PG_TYPE_REP 1
93#define CEPH_PG_TYPE_RAID4 2 91#define CEPH_PG_TYPE_RAID4 2
94#define CEPH_PG_POOL_VERSION 2 92#define CEPH_PG_POOL_VERSION 2
diff --git a/include/linux/ceph/types.h b/include/linux/ceph/types.h
index d3ff1cf2d27..28b35a005ec 100644
--- a/include/linux/ceph/types.h
+++ b/include/linux/ceph/types.h
@@ -7,9 +7,9 @@
7#include <linux/fcntl.h> 7#include <linux/fcntl.h>
8#include <linux/string.h> 8#include <linux/string.h>
9 9
10#include <linux/ceph/ceph_fs.h> 10#include "ceph_fs.h"
11#include <linux/ceph/ceph_frag.h> 11#include "ceph_frag.h"
12#include <linux/ceph/ceph_hash.h> 12#include "ceph_hash.h"
13 13
14/* 14/*
15 * Identify inodes by both their ino AND snapshot id (a u64). 15 * Identify inodes by both their ino AND snapshot id (a u64).