aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-03-13 21:50:00 -0400
committerSage Weil <sage@inktank.com>2013-05-02 00:17:45 -0400
commit33803f3300265661b5c5d20a9811c6a2a157d545 (patch)
tree192ee4eb2d726fee466eb667f6fe938ba4a41a1e /include/linux/ceph
parenta8dd0a37bc016cfb3ac75cf8484428573bb8d862 (diff)
libceph: define source request op functions
The rbd code has a function that allocates and populates a ceph_osd_req_op structure (the in-core version of an osd request operation). When reviewed, Josh suggested two things: that the big varargs function might be better split into type-specific functions; and that this functionality really belongs in the osd client rather than rbd. This patch implements both of Josh's suggestions. It breaks up the rbd function into separate functions and defines them in the osd client module as exported interfaces. Unlike the rbd version, however, the functions don't allocate an osd_req_op structure; they are provided the address of one and that is initialized instead. The rbd function has been eliminated and calls to it have been replaced by calls to the new routines. The rbd code now now use a stack (struct) variable to hold the op rather than allocating and freeing it each time. For now only the capabilities used by rbd are implemented. Implementing all the other osd op types, and making the rest of the code use it will be done separately, in the next few patches. Note that only the extent, cls, and watch portions of the ceph_osd_req_op structure are currently used. Delete the others (xattr, pgls, and snap) from its definition so nobody thinks it's actually implemented or needed. We can add it back again later if needed, when we know it's been tested. This (and a few follow-on patches) resolves: http://tracker.ceph.com/issues/3861 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.h26
1 files changed, 11 insertions, 15 deletions
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index 1dab291b2dc6..5fd2cbfcfd91 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -202,14 +202,6 @@ struct ceph_osd_req_op {
202 u32 truncate_seq; 202 u32 truncate_seq;
203 } extent; 203 } extent;
204 struct { 204 struct {
205 const char *name;
206 const void *val;
207 u32 name_len;
208 u32 value_len;
209 __u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */
210 __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */
211 } xattr;
212 struct {
213 const char *class_name; 205 const char *class_name;
214 const char *method_name; 206 const char *method_name;
215 const void *indata; 207 const void *indata;
@@ -220,13 +212,6 @@ struct ceph_osd_req_op {
220 } cls; 212 } cls;
221 struct { 213 struct {
222 u64 cookie; 214 u64 cookie;
223 u64 count;
224 } pgls;
225 struct {
226 u64 snapid;
227 } snap;
228 struct {
229 u64 cookie;
230 u64 ver; 215 u64 ver;
231 u32 prot_ver; 216 u32 prot_ver;
232 u32 timeout; 217 u32 timeout;
@@ -244,6 +229,17 @@ extern void ceph_osdc_handle_reply(struct ceph_osd_client *osdc,
244extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc, 229extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc,
245 struct ceph_msg *msg); 230 struct ceph_msg *msg);
246 231
232extern void osd_req_op_init(struct ceph_osd_req_op *op, u16 opcode);
233extern void osd_req_op_extent_init(struct ceph_osd_req_op *op, u16 opcode,
234 u64 offset, u64 length,
235 u64 truncate_size, u32 truncate_seq);
236extern void osd_req_op_cls_init(struct ceph_osd_req_op *op, u16 opcode,
237 const char *class, const char *method,
238 const void *request_data,
239 size_t request_data_size);
240extern void osd_req_op_watch_init(struct ceph_osd_req_op *op, u16 opcode,
241 u64 cookie, u64 version, int flag);
242
247extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, 243extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
248 struct ceph_snap_context *snapc, 244 struct ceph_snap_context *snapc,
249 unsigned int num_op, 245 unsigned int num_op,