Commit ca9d93a2 authored by Sage Weil's avatar Sage Weil

ceph: resync headers with userland

Notable changes include pool op defines and types, FLOCK feature bit, and
new CMPXATTR osd ops.
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent 1a756278
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* Ceph release version * Ceph release version
*/ */
#define CEPH_VERSION_MAJOR 0 #define CEPH_VERSION_MAJOR 0
#define CEPH_VERSION_MINOR 19 #define CEPH_VERSION_MINOR 20
#define CEPH_VERSION_PATCH 0 #define CEPH_VERSION_PATCH 0
#define _CEPH_STRINGIFY(x) #x #define _CEPH_STRINGIFY(x) #x
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
* client-facing protocol. * client-facing protocol.
*/ */
#define CEPH_OSD_PROTOCOL 8 /* cluster internal */ #define CEPH_OSD_PROTOCOL 8 /* cluster internal */
#define CEPH_MDS_PROTOCOL 9 /* cluster internal */ #define CEPH_MDS_PROTOCOL 12 /* cluster internal */
#define CEPH_MON_PROTOCOL 5 /* cluster internal */ #define CEPH_MON_PROTOCOL 5 /* cluster internal */
#define CEPH_OSDC_PROTOCOL 24 /* server/client */ #define CEPH_OSDC_PROTOCOL 24 /* server/client */
#define CEPH_MDSC_PROTOCOL 32 /* server/client */ #define CEPH_MDSC_PROTOCOL 32 /* server/client */
...@@ -55,10 +55,11 @@ ...@@ -55,10 +55,11 @@
*/ */
#define CEPH_FEATURE_UID 1 #define CEPH_FEATURE_UID 1
#define CEPH_FEATURE_NOSRCADDR 2 #define CEPH_FEATURE_NOSRCADDR 2
#define CEPH_FEATURE_FLOCK 4
#define CEPH_FEATURE_SUPPORTED_MON CEPH_FEATURE_UID|CEPH_FEATURE_NOSRCADDR #define CEPH_FEATURE_SUPPORTED_MON CEPH_FEATURE_UID|CEPH_FEATURE_NOSRCADDR
#define CEPH_FEATURE_REQUIRED_MON CEPH_FEATURE_UID #define CEPH_FEATURE_REQUIRED_MON CEPH_FEATURE_UID
#define CEPH_FEATURE_SUPPORTED_MDS CEPH_FEATURE_UID|CEPH_FEATURE_NOSRCADDR #define CEPH_FEATURE_SUPPORTED_MDS CEPH_FEATURE_UID|CEPH_FEATURE_NOSRCADDR|CEPH_FEATURE_FLOCK
#define CEPH_FEATURE_REQUIRED_MDS CEPH_FEATURE_UID #define CEPH_FEATURE_REQUIRED_MDS CEPH_FEATURE_UID
#define CEPH_FEATURE_SUPPORTED_OSD CEPH_FEATURE_UID|CEPH_FEATURE_NOSRCADDR #define CEPH_FEATURE_SUPPORTED_OSD CEPH_FEATURE_UID|CEPH_FEATURE_NOSRCADDR
#define CEPH_FEATURE_REQUIRED_OSD CEPH_FEATURE_UID #define CEPH_FEATURE_REQUIRED_OSD CEPH_FEATURE_UID
...@@ -100,6 +101,8 @@ int ceph_file_layout_is_valid(const struct ceph_file_layout *layout); ...@@ -100,6 +101,8 @@ int ceph_file_layout_is_valid(const struct ceph_file_layout *layout);
#define CEPH_AUTH_NONE 0x1 #define CEPH_AUTH_NONE 0x1
#define CEPH_AUTH_CEPHX 0x2 #define CEPH_AUTH_CEPHX 0x2
#define CEPH_AUTH_UID_DEFAULT ((__u64) -1)
/********************************************* /*********************************************
* message layer * message layer
...@@ -137,11 +140,27 @@ int ceph_file_layout_is_valid(const struct ceph_file_layout *layout); ...@@ -137,11 +140,27 @@ int ceph_file_layout_is_valid(const struct ceph_file_layout *layout);
#define CEPH_MSG_CLIENT_SNAP 0x312 #define CEPH_MSG_CLIENT_SNAP 0x312
#define CEPH_MSG_CLIENT_CAPRELEASE 0x313 #define CEPH_MSG_CLIENT_CAPRELEASE 0x313
/* pool ops */
#define CEPH_MSG_POOLOP_REPLY 48
#define CEPH_MSG_POOLOP 49
/* osd */ /* osd */
#define CEPH_MSG_OSD_MAP 41 #define CEPH_MSG_OSD_MAP 41
#define CEPH_MSG_OSD_OP 42 #define CEPH_MSG_OSD_OP 42
#define CEPH_MSG_OSD_OPREPLY 43 #define CEPH_MSG_OSD_OPREPLY 43
/* pool operations */
enum {
POOL_OP_CREATE = 0x01,
POOL_OP_DELETE = 0x02,
POOL_OP_AUID_CHANGE = 0x03,
POOL_OP_CREATE_SNAP = 0x11,
POOL_OP_DELETE_SNAP = 0x12,
POOL_OP_CREATE_UNMANAGED_SNAP = 0x21,
POOL_OP_DELETE_UNMANAGED_SNAP = 0x22,
};
struct ceph_mon_request_header { struct ceph_mon_request_header {
__le64 have_version; __le64 have_version;
__le16 session_mon; __le16 session_mon;
...@@ -164,6 +183,31 @@ struct ceph_mon_statfs_reply { ...@@ -164,6 +183,31 @@ struct ceph_mon_statfs_reply {
struct ceph_statfs st; struct ceph_statfs st;
} __attribute__ ((packed)); } __attribute__ ((packed));
const char *ceph_pool_op_name(int op);
struct ceph_mon_poolop {
struct ceph_mon_request_header monhdr;
struct ceph_fsid fsid;
__le32 pool;
__le32 op;
__le64 auid;
__le64 snapid;
__le32 name_len;
} __attribute__ ((packed));
struct ceph_mon_poolop_reply {
struct ceph_mon_request_header monhdr;
struct ceph_fsid fsid;
__le32 reply_code;
__le32 epoch;
char has_data;
char data[0];
} __attribute__ ((packed));
struct ceph_mon_unmanaged_snap {
__le64 snapid;
} __attribute__ ((packed));
struct ceph_osd_getmap { struct ceph_osd_getmap {
struct ceph_mon_request_header monhdr; struct ceph_mon_request_header monhdr;
struct ceph_fsid fsid; struct ceph_fsid fsid;
......
...@@ -10,7 +10,6 @@ const char *ceph_entity_type_name(int type) ...@@ -10,7 +10,6 @@ const char *ceph_entity_type_name(int type)
case CEPH_ENTITY_TYPE_OSD: return "osd"; case CEPH_ENTITY_TYPE_OSD: return "osd";
case CEPH_ENTITY_TYPE_MON: return "mon"; case CEPH_ENTITY_TYPE_MON: return "mon";
case CEPH_ENTITY_TYPE_CLIENT: return "client"; case CEPH_ENTITY_TYPE_CLIENT: return "client";
case CEPH_ENTITY_TYPE_ADMIN: return "admin";
case CEPH_ENTITY_TYPE_AUTH: return "auth"; case CEPH_ENTITY_TYPE_AUTH: return "auth";
default: return "unknown"; default: return "unknown";
} }
...@@ -45,6 +44,7 @@ const char *ceph_osd_op_name(int op) ...@@ -45,6 +44,7 @@ const char *ceph_osd_op_name(int op)
case CEPH_OSD_OP_SETXATTRS: return "setxattrs"; case CEPH_OSD_OP_SETXATTRS: return "setxattrs";
case CEPH_OSD_OP_RESETXATTRS: return "resetxattrs"; case CEPH_OSD_OP_RESETXATTRS: return "resetxattrs";
case CEPH_OSD_OP_RMXATTR: return "rmxattr"; case CEPH_OSD_OP_RMXATTR: return "rmxattr";
case CEPH_OSD_OP_CMPXATTR: return "cmpxattr";
case CEPH_OSD_OP_PULL: return "pull"; case CEPH_OSD_OP_PULL: return "pull";
case CEPH_OSD_OP_PUSH: return "push"; case CEPH_OSD_OP_PUSH: return "push";
...@@ -174,3 +174,24 @@ const char *ceph_snap_op_name(int o) ...@@ -174,3 +174,24 @@ const char *ceph_snap_op_name(int o)
} }
return "???"; return "???";
} }
const char *ceph_pool_op_name(int op) {
switch (op) {
case POOL_OP_CREATE:
return "create pool";
case POOL_OP_DELETE:
return "delete pool";
case POOL_OP_AUID_CHANGE:
return "change auid";
case POOL_OP_CREATE_SNAP:
return "create snap";
case POOL_OP_DELETE_SNAP:
return "delete snap";
case POOL_OP_CREATE_UNMANAGED_SNAP:
return "create unmanaged snap";
case POOL_OP_DELETE_UNMANAGED_SNAP:
return "delete unmanaged snap";
default:
return "unknown";
}
}
...@@ -39,18 +39,6 @@ static void queue_con(struct ceph_connection *con); ...@@ -39,18 +39,6 @@ static void queue_con(struct ceph_connection *con);
static void con_work(struct work_struct *); static void con_work(struct work_struct *);
static void ceph_fault(struct ceph_connection *con); static void ceph_fault(struct ceph_connection *con);
const char *ceph_name_type_str(int t)
{
switch (t) {
case CEPH_ENTITY_TYPE_MON: return "mon";
case CEPH_ENTITY_TYPE_MDS: return "mds";
case CEPH_ENTITY_TYPE_OSD: return "osd";
case CEPH_ENTITY_TYPE_CLIENT: return "client";
case CEPH_ENTITY_TYPE_ADMIN: return "admin";
default: return "???";
}
}
/* /*
* nicely render a sockaddr as a string. * nicely render a sockaddr as a string.
*/ */
......
...@@ -49,10 +49,8 @@ struct ceph_connection_operations { ...@@ -49,10 +49,8 @@ struct ceph_connection_operations {
int *skip); int *skip);
}; };
extern const char *ceph_name_type_str(int t);
/* use format string %s%d */ /* use format string %s%d */
#define ENTITY_NAME(n) ceph_name_type_str((n).type), le64_to_cpu((n).num) #define ENTITY_NAME(n) ceph_entity_type_name((n).type), le64_to_cpu((n).num)
struct ceph_messenger { struct ceph_messenger {
struct ceph_entity_inst inst; /* my name+address */ struct ceph_entity_inst inst; /* my name+address */
......
...@@ -50,7 +50,6 @@ struct ceph_entity_name { ...@@ -50,7 +50,6 @@ struct ceph_entity_name {
#define CEPH_ENTITY_TYPE_MDS 0x02 #define CEPH_ENTITY_TYPE_MDS 0x02
#define CEPH_ENTITY_TYPE_OSD 0x04 #define CEPH_ENTITY_TYPE_OSD 0x04
#define CEPH_ENTITY_TYPE_CLIENT 0x08 #define CEPH_ENTITY_TYPE_CLIENT 0x08
#define CEPH_ENTITY_TYPE_ADMIN 0x10
#define CEPH_ENTITY_TYPE_AUTH 0x20 #define CEPH_ENTITY_TYPE_AUTH 0x20
#define CEPH_ENTITY_TYPE_ANY 0xFF #define CEPH_ENTITY_TYPE_ANY 0xFF
......
...@@ -101,8 +101,8 @@ struct ceph_pg_pool { ...@@ -101,8 +101,8 @@ struct ceph_pg_pool {
__le64 snap_seq; /* seq for per-pool snapshot */ __le64 snap_seq; /* seq for per-pool snapshot */
__le32 snap_epoch; /* epoch of last snap */ __le32 snap_epoch; /* epoch of last snap */
__le32 num_snaps; __le32 num_snaps;
__le32 num_removed_snap_intervals; __le32 num_removed_snap_intervals; /* if non-empty, NO per-pool snaps */
__le64 uid; __le64 auid; /* who owns the pg */
} __attribute__ ((packed)); } __attribute__ ((packed));
/* /*
...@@ -208,6 +208,7 @@ enum { ...@@ -208,6 +208,7 @@ enum {
/* read */ /* read */
CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1, CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1,
CEPH_OSD_OP_GETXATTRS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 2, CEPH_OSD_OP_GETXATTRS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 2,
CEPH_OSD_OP_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 3,
/* write */ /* write */
CEPH_OSD_OP_SETXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 1, CEPH_OSD_OP_SETXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 1,
...@@ -305,6 +306,22 @@ enum { ...@@ -305,6 +306,22 @@ enum {
#define EOLDSNAPC ERESTART /* ORDERSNAP flag set; writer has old snapc*/ #define EOLDSNAPC ERESTART /* ORDERSNAP flag set; writer has old snapc*/
#define EBLACKLISTED ESHUTDOWN /* blacklisted */ #define EBLACKLISTED ESHUTDOWN /* blacklisted */
/* xattr comparison */
enum {
CEPH_OSD_CMPXATTR_OP_NOP = 0,
CEPH_OSD_CMPXATTR_OP_EQ = 1,
CEPH_OSD_CMPXATTR_OP_NE = 2,
CEPH_OSD_CMPXATTR_OP_GT = 3,
CEPH_OSD_CMPXATTR_OP_GTE = 4,
CEPH_OSD_CMPXATTR_OP_LT = 5,
CEPH_OSD_CMPXATTR_OP_LTE = 6
};
enum {
CEPH_OSD_CMPXATTR_MODE_STRING = 1,
CEPH_OSD_CMPXATTR_MODE_U64 = 2
};
/* /*
* an individual object operation. each may be accompanied by some data * an individual object operation. each may be accompanied by some data
* payload * payload
...@@ -321,6 +338,8 @@ struct ceph_osd_op { ...@@ -321,6 +338,8 @@ struct ceph_osd_op {
struct { struct {
__le32 name_len; __le32 name_len;
__le32 value_len; __le32 value_len;
__u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */
__u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */
} __attribute__ ((packed)) xattr; } __attribute__ ((packed)) xattr;
struct { struct {
__u8 class_len; __u8 class_len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment