aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2010-05-18 19:38:08 -0400
committerSage Weil <sage@newdream.net>2010-10-20 18:37:25 -0400
commitae1533b62b3369e6ae32338f4a77d64d0e88f676 (patch)
tree9a54b1c1c8a52a4ae46bc0c5421d04e93ac6495f /fs
parent68b4476b0bc13fef18266b4140309a30e86739d2 (diff)
ceph-rbd: osdc support for osd call and rollback operations
This will be used for rbd snapshots administration. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Diffstat (limited to 'fs')
-rw-r--r--fs/ceph/decode.h5
-rw-r--r--fs/ceph/osd_client.c18
-rw-r--r--fs/ceph/osd_client.h6
3 files changed, 29 insertions, 0 deletions
diff --git a/fs/ceph/decode.h b/fs/ceph/decode.h
index 3d25415afe63..c5b6939fb32a 100644
--- a/fs/ceph/decode.h
+++ b/fs/ceph/decode.h
@@ -191,6 +191,11 @@ static inline void ceph_encode_string(void **p, void *end,
191 ceph_encode_need(p, end, n, bad); \ 191 ceph_encode_need(p, end, n, bad); \
192 ceph_encode_copy(p, pv, n); \ 192 ceph_encode_copy(p, pv, n); \
193 } while (0) 193 } while (0)
194#define ceph_encode_string_safe(p, end, s, n, bad) \
195 do { \
196 ceph_encode_need(p, end, n, bad); \
197 ceph_encode_string(p, end, s, n); \
198 } while (0)
194 199
195 200
196#endif 201#endif
diff --git a/fs/ceph/osd_client.c b/fs/ceph/osd_client.c
index c5d818e73add..0edb43f1ef26 100644
--- a/fs/ceph/osd_client.c
+++ b/fs/ceph/osd_client.c
@@ -161,6 +161,7 @@ static int op_needs_trail(int op)
161 case CEPH_OSD_OP_GETXATTR: 161 case CEPH_OSD_OP_GETXATTR:
162 case CEPH_OSD_OP_SETXATTR: 162 case CEPH_OSD_OP_SETXATTR:
163 case CEPH_OSD_OP_CMPXATTR: 163 case CEPH_OSD_OP_CMPXATTR:
164 case CEPH_OSD_OP_CALL:
164 return 1; 165 return 1;
165 default: 166 default:
166 return 0; 167 return 0;
@@ -301,6 +302,23 @@ static void osd_req_encode_op(struct ceph_osd_request *req,
301 ceph_pagelist_append(req->r_trail, src->xattr.val, 302 ceph_pagelist_append(req->r_trail, src->xattr.val,
302 src->xattr.value_len); 303 src->xattr.value_len);
303 break; 304 break;
305 case CEPH_OSD_OP_CALL:
306 BUG_ON(!req->r_trail);
307
308 dst->cls.class_len = src->cls.class_len;
309 dst->cls.method_len = src->cls.method_len;
310 dst->cls.indata_len = cpu_to_le32(src->cls.indata_len);
311
312 ceph_pagelist_append(req->r_trail, src->cls.class_name,
313 src->cls.class_len);
314 ceph_pagelist_append(req->r_trail, src->cls.method_name,
315 src->cls.method_len);
316 ceph_pagelist_append(req->r_trail, src->cls.indata,
317 src->cls.indata_len);
318 break;
319 case CEPH_OSD_OP_ROLLBACK:
320 dst->snap.snapid = cpu_to_le64(src->snap.snapid);
321 break;
304 case CEPH_OSD_OP_STARTSYNC: 322 case CEPH_OSD_OP_STARTSYNC:
305 break; 323 break;
306 default: 324 default:
diff --git a/fs/ceph/osd_client.h b/fs/ceph/osd_client.h
index d583d1bf6cd9..65c9c560f1ac 100644
--- a/fs/ceph/osd_client.h
+++ b/fs/ceph/osd_client.h
@@ -134,14 +134,20 @@ struct ceph_osd_req_op {
134 __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */ 134 __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */
135 } xattr; 135 } xattr;
136 struct { 136 struct {
137 const char *class_name;
137 __u8 class_len; 138 __u8 class_len;
139 const char *method_name;
138 __u8 method_len; 140 __u8 method_len;
139 __u8 argc; 141 __u8 argc;
142 const char *indata;
140 u32 indata_len; 143 u32 indata_len;
141 } cls; 144 } cls;
142 struct { 145 struct {
143 u64 cookie, count; 146 u64 cookie, count;
144 } pgls; 147 } pgls;
148 struct {
149 u64 snapid;
150 } snap;
145 }; 151 };
146 u32 payload_len; 152 u32 payload_len;
147}; 153};