提交 ae1533b6 编写于 作者: Y Yehuda Sadeh 提交者: Sage Weil

ceph-rbd: osdc support for osd call and rollback operations

This will be used for rbd snapshots administration.
Signed-off-by: NYehuda Sadeh <yehuda@hq.newdream.net>
上级 68b4476b
...@@ -191,6 +191,11 @@ static inline void ceph_encode_string(void **p, void *end, ...@@ -191,6 +191,11 @@ static inline void ceph_encode_string(void **p, void *end,
ceph_encode_need(p, end, n, bad); \ ceph_encode_need(p, end, n, bad); \
ceph_encode_copy(p, pv, n); \ ceph_encode_copy(p, pv, n); \
} while (0) } while (0)
#define ceph_encode_string_safe(p, end, s, n, bad) \
do { \
ceph_encode_need(p, end, n, bad); \
ceph_encode_string(p, end, s, n); \
} while (0)
#endif #endif
...@@ -161,6 +161,7 @@ static int op_needs_trail(int op) ...@@ -161,6 +161,7 @@ static int op_needs_trail(int op)
case CEPH_OSD_OP_GETXATTR: case CEPH_OSD_OP_GETXATTR:
case CEPH_OSD_OP_SETXATTR: case CEPH_OSD_OP_SETXATTR:
case CEPH_OSD_OP_CMPXATTR: case CEPH_OSD_OP_CMPXATTR:
case CEPH_OSD_OP_CALL:
return 1; return 1;
default: default:
return 0; return 0;
...@@ -301,6 +302,23 @@ static void osd_req_encode_op(struct ceph_osd_request *req, ...@@ -301,6 +302,23 @@ static void osd_req_encode_op(struct ceph_osd_request *req,
ceph_pagelist_append(req->r_trail, src->xattr.val, ceph_pagelist_append(req->r_trail, src->xattr.val,
src->xattr.value_len); src->xattr.value_len);
break; break;
case CEPH_OSD_OP_CALL:
BUG_ON(!req->r_trail);
dst->cls.class_len = src->cls.class_len;
dst->cls.method_len = src->cls.method_len;
dst->cls.indata_len = cpu_to_le32(src->cls.indata_len);
ceph_pagelist_append(req->r_trail, src->cls.class_name,
src->cls.class_len);
ceph_pagelist_append(req->r_trail, src->cls.method_name,
src->cls.method_len);
ceph_pagelist_append(req->r_trail, src->cls.indata,
src->cls.indata_len);
break;
case CEPH_OSD_OP_ROLLBACK:
dst->snap.snapid = cpu_to_le64(src->snap.snapid);
break;
case CEPH_OSD_OP_STARTSYNC: case CEPH_OSD_OP_STARTSYNC:
break; break;
default: default:
......
...@@ -134,14 +134,20 @@ struct ceph_osd_req_op { ...@@ -134,14 +134,20 @@ struct ceph_osd_req_op {
__u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */ __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */
} xattr; } xattr;
struct { struct {
const char *class_name;
__u8 class_len; __u8 class_len;
const char *method_name;
__u8 method_len; __u8 method_len;
__u8 argc; __u8 argc;
const char *indata;
u32 indata_len; u32 indata_len;
} cls; } cls;
struct { struct {
u64 cookie, count; u64 cookie, count;
} pgls; } pgls;
struct {
u64 snapid;
} snap;
}; };
u32 payload_len; u32 payload_len;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册