aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-04-03 22:32:51 -0400
committerSage Weil <sage@inktank.com>2013-05-02 00:18:12 -0400
commit79528734f3ae4699a2886f62f55e18fb34fb3651 (patch)
tree51905378486b592fc2d4037d67ef3b577fe4eaa7 /include/linux/ceph
parent430c28c3cb7f3dbd87de266ed52d65928957ff78 (diff)
libceph: keep source rather than message osd op array
An osd request keeps a pointer to the osd operations (ops) array that it builds in its request message. In order to allow each op in the array to have its own distinct data, we will need to keep track of each op's data, and that information does not go over the wire. As long as we're tracking the data we might as well just track the entire (source) op definition for each of the ops. And if we're doing that, we'll have no more need to keep a pointer to the wire-encoded version. This patch makes the array of source ops be kept with the osd request structure, and uses that instead of the version encoded in the message in places where that was previously used. The array will be embedded in the request structure, and the maximum number of ops we ever actually use is currently 2. So reduce CEPH_OSD_MAX_OP to 2 to reduce the size of the structure. The result of doing this sort of ripples back up, and as a result various function parameters and local variables become unnecessary. Make r_num_ops be unsigned, and move the definition of struct ceph_osd_req_op earlier to ensure it's defined where needed. It does not yet add per-op data, that's coming soon. This resolves: http://tracker.ceph.com/issues/4656 Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'include/linux/ceph')
-rw-r--r--include/linux/ceph/osd_client.h70
1 files changed, 34 insertions, 36 deletions
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index af60dac1f9c0..f4c1a2a22a14 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -48,7 +48,7 @@ struct ceph_osd {
48}; 48};
49 49
50 50
51#define CEPH_OSD_MAX_OP 10 51#define CEPH_OSD_MAX_OP 2
52 52
53enum ceph_osd_data_type { 53enum ceph_osd_data_type {
54 CEPH_OSD_DATA_TYPE_NONE, 54 CEPH_OSD_DATA_TYPE_NONE,
@@ -79,6 +79,34 @@ struct ceph_osd_data {
79 }; 79 };
80}; 80};
81 81
82struct ceph_osd_req_op {
83 u16 op; /* CEPH_OSD_OP_* */
84 u32 payload_len;
85 union {
86 struct {
87 u64 offset, length;
88 u64 truncate_size;
89 u32 truncate_seq;
90 } extent;
91 struct {
92 const char *class_name;
93 const char *method_name;
94 const void *indata;
95 u32 indata_len;
96 __u8 class_len;
97 __u8 method_len;
98 __u8 argc;
99 } cls;
100 struct {
101 u64 cookie;
102 u64 ver;
103 u32 prot_ver;
104 u32 timeout;
105 __u8 flag;
106 } watch;
107 };
108};
109
82/* an in-flight request */ 110/* an in-flight request */
83struct ceph_osd_request { 111struct ceph_osd_request {
84 u64 r_tid; /* unique for this client */ 112 u64 r_tid; /* unique for this client */
@@ -95,10 +123,11 @@ struct ceph_osd_request {
95 struct ceph_msg *r_request, *r_reply; 123 struct ceph_msg *r_request, *r_reply;
96 int r_flags; /* any additional flags for the osd */ 124 int r_flags; /* any additional flags for the osd */
97 u32 r_sent; /* >0 if r_request is sending/sent */ 125 u32 r_sent; /* >0 if r_request is sending/sent */
98 int r_num_ops;
99 126
100 /* encoded message content */ 127 /* request osd ops array */
101 struct ceph_osd_op *r_request_ops; 128 unsigned int r_num_ops;
129 struct ceph_osd_req_op r_ops[CEPH_OSD_MAX_OP];
130
102 /* these are updated on each send */ 131 /* these are updated on each send */
103 __le32 *r_request_osdmap_epoch; 132 __le32 *r_request_osdmap_epoch;
104 __le32 *r_request_flags; 133 __le32 *r_request_flags;
@@ -193,34 +222,6 @@ struct ceph_osd_client {
193 struct workqueue_struct *notify_wq; 222 struct workqueue_struct *notify_wq;
194}; 223};
195 224
196struct ceph_osd_req_op {
197 u16 op; /* CEPH_OSD_OP_* */
198 u32 payload_len;
199 union {
200 struct {
201 u64 offset, length;
202 u64 truncate_size;
203 u32 truncate_seq;
204 } extent;
205 struct {
206 const char *class_name;
207 const char *method_name;
208 const void *indata;
209 u32 indata_len;
210 __u8 class_len;
211 __u8 method_len;
212 __u8 argc;
213 } cls;
214 struct {
215 u64 cookie;
216 u64 ver;
217 u32 prot_ver;
218 u32 timeout;
219 __u8 flag;
220 } watch;
221 };
222};
223
224extern int ceph_osdc_init(struct ceph_osd_client *osdc, 225extern int ceph_osdc_init(struct ceph_osd_client *osdc,
225 struct ceph_client *client); 226 struct ceph_client *client);
226extern void ceph_osdc_stop(struct ceph_osd_client *osdc); 227extern void ceph_osdc_stop(struct ceph_osd_client *osdc);
@@ -249,8 +250,6 @@ extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *
249 gfp_t gfp_flags); 250 gfp_t gfp_flags);
250 251
251extern void ceph_osdc_build_request(struct ceph_osd_request *req, u64 off, 252extern void ceph_osdc_build_request(struct ceph_osd_request *req, u64 off,
252 unsigned int num_ops,
253 struct ceph_osd_req_op *src_ops,
254 struct ceph_snap_context *snapc, 253 struct ceph_snap_context *snapc,
255 u64 snap_id, 254 u64 snap_id,
256 struct timespec *mtime); 255 struct timespec *mtime);
@@ -259,8 +258,7 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
259 struct ceph_file_layout *layout, 258 struct ceph_file_layout *layout,
260 struct ceph_vino vino, 259 struct ceph_vino vino,
261 u64 offset, u64 *len, 260 u64 offset, u64 *len,
262 int num_ops, struct ceph_osd_req_op *ops, 261 int num_ops, int opcode, int flags,
263 int opcode, int flags,
264 struct ceph_snap_context *snapc, 262 struct ceph_snap_context *snapc,
265 u32 truncate_seq, u64 truncate_size, 263 u32 truncate_seq, u64 truncate_size,
266 bool use_mempool); 264 bool use_mempool);