Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 1 | /* |
| 2 | * ceph_fs.h - Ceph constants and data types to share between kernel and |
| 3 | * user space. |
| 4 | * |
| 5 | * Most types in this file are defined as little-endian, and are |
| 6 | * primarily intended to describe data structures that pass over the |
| 7 | * wire or that are stored on disk. |
| 8 | * |
| 9 | * LGPL2 |
| 10 | */ |
| 11 | |
Sage Weil | 5cd068c | 2010-07-07 08:38:17 -0700 | [diff] [blame] | 12 | #ifndef CEPH_FS_H |
| 13 | #define CEPH_FS_H |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 14 | |
David Howells | a1ce392 | 2012-10-02 18:01:25 +0100 | [diff] [blame] | 15 | #include <linux/ceph/msgr.h> |
| 16 | #include <linux/ceph/rados.h> |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 17 | |
| 18 | /* |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 19 | * subprotocol versions. when specific messages types or high-level |
| 20 | * protocols change, bump the affected components. we keep rev |
| 21 | * internal cluster protocols separately from the public, |
| 22 | * client-facing protocol. |
| 23 | */ |
Sage Weil | 6df058c | 2009-12-22 11:24:33 -0800 | [diff] [blame] | 24 | #define CEPH_OSD_PROTOCOL 8 /* cluster internal */ |
Sage Weil | ca9d93a | 2010-05-12 14:48:20 -0700 | [diff] [blame] | 25 | #define CEPH_MDS_PROTOCOL 12 /* cluster internal */ |
Sage Weil | 13e38c8 | 2009-10-09 16:36:34 -0700 | [diff] [blame] | 26 | #define CEPH_MON_PROTOCOL 5 /* cluster internal */ |
Yehuda Sadeh | 0c94899 | 2010-02-01 16:10:45 -0800 | [diff] [blame] | 27 | #define CEPH_OSDC_PROTOCOL 24 /* server/client */ |
Sage Weil | 3ea25f9 | 2010-01-25 11:18:17 -0800 | [diff] [blame] | 28 | #define CEPH_MDSC_PROTOCOL 32 /* server/client */ |
Sage Weil | 13e38c8 | 2009-10-09 16:36:34 -0700 | [diff] [blame] | 29 | #define CEPH_MONC_PROTOCOL 15 /* server/client */ |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 30 | |
| 31 | |
| 32 | #define CEPH_INO_ROOT 1 |
Sage Weil | 1d1de916 | 2009-12-02 11:54:25 -0800 | [diff] [blame] | 33 | #define CEPH_INO_CEPH 2 /* hidden .ceph dir */ |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 34 | |
| 35 | /* arbitrary limit on max # of monitors (cluster of 3 is typical) */ |
| 36 | #define CEPH_MAX_MON 31 |
| 37 | |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 38 | /* |
| 39 | * ceph_file_layout - describe data layout for a file/inode |
| 40 | */ |
| 41 | struct ceph_file_layout { |
| 42 | /* file -> object mapping */ |
| 43 | __le32 fl_stripe_unit; /* stripe unit, in bytes. must be multiple |
| 44 | of page size. */ |
| 45 | __le32 fl_stripe_count; /* over this many objects */ |
| 46 | __le32 fl_object_size; /* until objects are this big, then move to |
| 47 | new objects */ |
Sage Weil | 6c0f3af | 2010-11-16 11:14:34 -0800 | [diff] [blame] | 48 | __le32 fl_cas_hash; /* UNUSED. 0 = none; 1 = sha256 */ |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 49 | |
| 50 | /* pg -> disk layout */ |
Sage Weil | 6c0f3af | 2010-11-16 11:14:34 -0800 | [diff] [blame] | 51 | __le32 fl_object_stripe_unit; /* UNUSED. for per-object parity, if any */ |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 52 | |
| 53 | /* object -> pg layout */ |
Sage Weil | 3469ac1a | 2012-05-07 15:33:36 -0700 | [diff] [blame] | 54 | __le32 fl_unused; /* unused; used to be preferred primary (-1) */ |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 55 | __le32 fl_pg_pool; /* namespace, crush ruleset, rep level */ |
| 56 | } __attribute__ ((packed)); |
| 57 | |
Sage Weil | 752727a | 2009-10-09 16:38:45 -0700 | [diff] [blame] | 58 | #define CEPH_MIN_STRIPE_UNIT 65536 |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 59 | |
Sage Weil | 752727a | 2009-10-09 16:38:45 -0700 | [diff] [blame] | 60 | int ceph_file_layout_is_valid(const struct ceph_file_layout *layout); |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 61 | |
Sage Weil | 6c0f3af | 2010-11-16 11:14:34 -0800 | [diff] [blame] | 62 | struct ceph_dir_layout { |
| 63 | __u8 dl_dir_hash; /* see ceph_hash.h for ids */ |
| 64 | __u8 dl_unused1; |
| 65 | __u16 dl_unused2; |
| 66 | __u32 dl_unused3; |
| 67 | } __attribute__ ((packed)); |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 68 | |
Sage Weil | 4e7a5dc | 2009-11-18 16:19:57 -0800 | [diff] [blame] | 69 | /* crypto algorithms */ |
| 70 | #define CEPH_CRYPTO_NONE 0x0 |
| 71 | #define CEPH_CRYPTO_AES 0x1 |
| 72 | |
Sage Weil | cbbfe49 | 2010-08-02 15:48:23 -0700 | [diff] [blame] | 73 | #define CEPH_AES_IV "cephsageyudagreg" |
| 74 | |
Sage Weil | 4e7a5dc | 2009-11-18 16:19:57 -0800 | [diff] [blame] | 75 | /* security/authentication protocols */ |
| 76 | #define CEPH_AUTH_UNKNOWN 0x0 |
| 77 | #define CEPH_AUTH_NONE 0x1 |
| 78 | #define CEPH_AUTH_CEPHX 0x2 |
| 79 | |
Sage Weil | ca9d93a | 2010-05-12 14:48:20 -0700 | [diff] [blame] | 80 | #define CEPH_AUTH_UID_DEFAULT ((__u64) -1) |
| 81 | |
Sage Weil | 4e7a5dc | 2009-11-18 16:19:57 -0800 | [diff] [blame] | 82 | |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 83 | /********************************************* |
| 84 | * message layer |
| 85 | */ |
| 86 | |
| 87 | /* |
| 88 | * message types |
| 89 | */ |
| 90 | |
| 91 | /* misc */ |
| 92 | #define CEPH_MSG_SHUTDOWN 1 |
| 93 | #define CEPH_MSG_PING 2 |
| 94 | |
| 95 | /* client <-> monitor */ |
| 96 | #define CEPH_MSG_MON_MAP 4 |
| 97 | #define CEPH_MSG_MON_GET_MAP 5 |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 98 | #define CEPH_MSG_STATFS 13 |
| 99 | #define CEPH_MSG_STATFS_REPLY 14 |
| 100 | #define CEPH_MSG_MON_SUBSCRIBE 15 |
| 101 | #define CEPH_MSG_MON_SUBSCRIBE_ACK 16 |
Sage Weil | 4e7a5dc | 2009-11-18 16:19:57 -0800 | [diff] [blame] | 102 | #define CEPH_MSG_AUTH 17 |
| 103 | #define CEPH_MSG_AUTH_REPLY 18 |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 104 | |
| 105 | /* client <-> mds */ |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 106 | #define CEPH_MSG_MDS_MAP 21 |
| 107 | |
| 108 | #define CEPH_MSG_CLIENT_SESSION 22 |
| 109 | #define CEPH_MSG_CLIENT_RECONNECT 23 |
| 110 | |
| 111 | #define CEPH_MSG_CLIENT_REQUEST 24 |
| 112 | #define CEPH_MSG_CLIENT_REQUEST_FORWARD 25 |
| 113 | #define CEPH_MSG_CLIENT_REPLY 26 |
| 114 | #define CEPH_MSG_CLIENT_CAPS 0x310 |
| 115 | #define CEPH_MSG_CLIENT_LEASE 0x311 |
| 116 | #define CEPH_MSG_CLIENT_SNAP 0x312 |
| 117 | #define CEPH_MSG_CLIENT_CAPRELEASE 0x313 |
| 118 | |
Sage Weil | ca9d93a | 2010-05-12 14:48:20 -0700 | [diff] [blame] | 119 | /* pool ops */ |
| 120 | #define CEPH_MSG_POOLOP_REPLY 48 |
| 121 | #define CEPH_MSG_POOLOP 49 |
| 122 | |
| 123 | |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 124 | /* osd */ |
Yehuda Sadeh | 483fac7 | 2011-01-20 16:36:06 -0800 | [diff] [blame] | 125 | #define CEPH_MSG_OSD_MAP 41 |
| 126 | #define CEPH_MSG_OSD_OP 42 |
| 127 | #define CEPH_MSG_OSD_OPREPLY 43 |
| 128 | #define CEPH_MSG_WATCH_NOTIFY 44 |
| 129 | |
| 130 | |
| 131 | /* watch-notify operations */ |
| 132 | enum { |
| 133 | WATCH_NOTIFY = 1, /* notifying watcher */ |
| 134 | WATCH_NOTIFY_COMPLETE = 2, /* notifier notified when done */ |
| 135 | }; |
| 136 | |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 137 | |
Sage Weil | ca9d93a | 2010-05-12 14:48:20 -0700 | [diff] [blame] | 138 | /* pool operations */ |
| 139 | enum { |
| 140 | POOL_OP_CREATE = 0x01, |
| 141 | POOL_OP_DELETE = 0x02, |
| 142 | POOL_OP_AUID_CHANGE = 0x03, |
| 143 | POOL_OP_CREATE_SNAP = 0x11, |
| 144 | POOL_OP_DELETE_SNAP = 0x12, |
| 145 | POOL_OP_CREATE_UNMANAGED_SNAP = 0x21, |
| 146 | POOL_OP_DELETE_UNMANAGED_SNAP = 0x22, |
| 147 | }; |
| 148 | |
Sage Weil | 13e38c8 | 2009-10-09 16:36:34 -0700 | [diff] [blame] | 149 | struct ceph_mon_request_header { |
| 150 | __le64 have_version; |
| 151 | __le16 session_mon; |
| 152 | __le64 session_mon_tid; |
| 153 | } __attribute__ ((packed)); |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 154 | |
| 155 | struct ceph_mon_statfs { |
Sage Weil | 13e38c8 | 2009-10-09 16:36:34 -0700 | [diff] [blame] | 156 | struct ceph_mon_request_header monhdr; |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 157 | struct ceph_fsid fsid; |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 158 | } __attribute__ ((packed)); |
| 159 | |
| 160 | struct ceph_statfs { |
| 161 | __le64 kb, kb_used, kb_avail; |
| 162 | __le64 num_objects; |
| 163 | } __attribute__ ((packed)); |
| 164 | |
| 165 | struct ceph_mon_statfs_reply { |
| 166 | struct ceph_fsid fsid; |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 167 | __le64 version; |
| 168 | struct ceph_statfs st; |
| 169 | } __attribute__ ((packed)); |
| 170 | |
Sage Weil | ca9d93a | 2010-05-12 14:48:20 -0700 | [diff] [blame] | 171 | const char *ceph_pool_op_name(int op); |
| 172 | |
| 173 | struct ceph_mon_poolop { |
| 174 | struct ceph_mon_request_header monhdr; |
| 175 | struct ceph_fsid fsid; |
| 176 | __le32 pool; |
| 177 | __le32 op; |
| 178 | __le64 auid; |
| 179 | __le64 snapid; |
| 180 | __le32 name_len; |
| 181 | } __attribute__ ((packed)); |
| 182 | |
| 183 | struct ceph_mon_poolop_reply { |
| 184 | struct ceph_mon_request_header monhdr; |
| 185 | struct ceph_fsid fsid; |
| 186 | __le32 reply_code; |
| 187 | __le32 epoch; |
| 188 | char has_data; |
| 189 | char data[0]; |
| 190 | } __attribute__ ((packed)); |
| 191 | |
| 192 | struct ceph_mon_unmanaged_snap { |
| 193 | __le64 snapid; |
| 194 | } __attribute__ ((packed)); |
| 195 | |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 196 | struct ceph_osd_getmap { |
Sage Weil | 13e38c8 | 2009-10-09 16:36:34 -0700 | [diff] [blame] | 197 | struct ceph_mon_request_header monhdr; |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 198 | struct ceph_fsid fsid; |
| 199 | __le32 start; |
| 200 | } __attribute__ ((packed)); |
| 201 | |
| 202 | struct ceph_mds_getmap { |
Sage Weil | 13e38c8 | 2009-10-09 16:36:34 -0700 | [diff] [blame] | 203 | struct ceph_mon_request_header monhdr; |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 204 | struct ceph_fsid fsid; |
| 205 | } __attribute__ ((packed)); |
| 206 | |
| 207 | struct ceph_client_mount { |
Sage Weil | 13e38c8 | 2009-10-09 16:36:34 -0700 | [diff] [blame] | 208 | struct ceph_mon_request_header monhdr; |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 209 | } __attribute__ ((packed)); |
| 210 | |
Yehuda Sadeh | 483fac7 | 2011-01-20 16:36:06 -0800 | [diff] [blame] | 211 | #define CEPH_SUBSCRIBE_ONETIME 1 /* i want only 1 update after have */ |
| 212 | |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 213 | struct ceph_mon_subscribe_item { |
Yehuda Sadeh | 483fac7 | 2011-01-20 16:36:06 -0800 | [diff] [blame] | 214 | __le64 have_version; __le64 have; |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 215 | __u8 onetime; |
| 216 | } __attribute__ ((packed)); |
| 217 | |
Sage Weil | 07bd10f | 2009-10-14 17:26:40 -0700 | [diff] [blame] | 218 | struct ceph_mon_subscribe_ack { |
| 219 | __le32 duration; /* seconds */ |
| 220 | struct ceph_fsid fsid; |
| 221 | } __attribute__ ((packed)); |
| 222 | |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 223 | /* |
| 224 | * mds states |
| 225 | * > 0 -> in |
| 226 | * <= 0 -> out |
| 227 | */ |
| 228 | #define CEPH_MDS_STATE_DNE 0 /* down, does not exist. */ |
| 229 | #define CEPH_MDS_STATE_STOPPED -1 /* down, once existed, but no subtrees. |
| 230 | empty log. */ |
| 231 | #define CEPH_MDS_STATE_BOOT -4 /* up, boot announcement. */ |
| 232 | #define CEPH_MDS_STATE_STANDBY -5 /* up, idle. waiting for assignment. */ |
| 233 | #define CEPH_MDS_STATE_CREATING -6 /* up, creating MDS instance. */ |
| 234 | #define CEPH_MDS_STATE_STARTING -7 /* up, starting previously stopped mds */ |
| 235 | #define CEPH_MDS_STATE_STANDBY_REPLAY -8 /* up, tailing active node's journal */ |
| 236 | |
| 237 | #define CEPH_MDS_STATE_REPLAY 8 /* up, replaying journal. */ |
| 238 | #define CEPH_MDS_STATE_RESOLVE 9 /* up, disambiguating distributed |
| 239 | operations (import, rename, etc.) */ |
| 240 | #define CEPH_MDS_STATE_RECONNECT 10 /* up, reconnect to clients */ |
| 241 | #define CEPH_MDS_STATE_REJOIN 11 /* up, rejoining distributed cache */ |
| 242 | #define CEPH_MDS_STATE_CLIENTREPLAY 12 /* up, replaying client operations */ |
| 243 | #define CEPH_MDS_STATE_ACTIVE 13 /* up, active */ |
| 244 | #define CEPH_MDS_STATE_STOPPING 14 /* up, but exporting metadata */ |
| 245 | |
| 246 | extern const char *ceph_mds_state_name(int s); |
| 247 | |
| 248 | |
| 249 | /* |
| 250 | * metadata lock types. |
| 251 | * - these are bitmasks.. we can compose them |
| 252 | * - they also define the lock ordering by the MDS |
| 253 | * - a few of these are internal to the mds |
| 254 | */ |
Sage Weil | dd1c905 | 2010-05-25 16:45:25 -0700 | [diff] [blame] | 255 | #define CEPH_LOCK_DVERSION 1 |
| 256 | #define CEPH_LOCK_DN 2 |
| 257 | #define CEPH_LOCK_ISNAP 16 |
| 258 | #define CEPH_LOCK_IVERSION 32 /* mds internal */ |
| 259 | #define CEPH_LOCK_IFILE 64 |
| 260 | #define CEPH_LOCK_IAUTH 128 |
| 261 | #define CEPH_LOCK_ILINK 256 |
| 262 | #define CEPH_LOCK_IDFT 512 /* dir frag tree */ |
| 263 | #define CEPH_LOCK_INEST 1024 /* mds internal */ |
| 264 | #define CEPH_LOCK_IXATTR 2048 |
Sage Weil | f0b18d9 | 2010-07-07 08:39:03 -0700 | [diff] [blame] | 265 | #define CEPH_LOCK_IFLOCK 4096 /* advisory file locks */ |
Sage Weil | dd1c905 | 2010-05-25 16:45:25 -0700 | [diff] [blame] | 266 | #define CEPH_LOCK_INO 8192 /* immutable inode bits; not a lock */ |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 267 | |
| 268 | /* client_session ops */ |
| 269 | enum { |
| 270 | CEPH_SESSION_REQUEST_OPEN, |
| 271 | CEPH_SESSION_OPEN, |
| 272 | CEPH_SESSION_REQUEST_CLOSE, |
| 273 | CEPH_SESSION_CLOSE, |
| 274 | CEPH_SESSION_REQUEST_RENEWCAPS, |
| 275 | CEPH_SESSION_RENEWCAPS, |
| 276 | CEPH_SESSION_STALE, |
| 277 | CEPH_SESSION_RECALL_STATE, |
| 278 | }; |
| 279 | |
| 280 | extern const char *ceph_session_op_name(int op); |
| 281 | |
| 282 | struct ceph_mds_session_head { |
| 283 | __le32 op; |
| 284 | __le64 seq; |
| 285 | struct ceph_timespec stamp; |
| 286 | __le32 max_caps, max_leases; |
| 287 | } __attribute__ ((packed)); |
| 288 | |
| 289 | /* client_request */ |
| 290 | /* |
| 291 | * metadata ops. |
| 292 | * & 0x001000 -> write op |
| 293 | * & 0x010000 -> follow symlink (e.g. stat(), not lstat()). |
| 294 | & & 0x100000 -> use weird ino/path trace |
| 295 | */ |
| 296 | #define CEPH_MDS_OP_WRITE 0x001000 |
| 297 | enum { |
| 298 | CEPH_MDS_OP_LOOKUP = 0x00100, |
| 299 | CEPH_MDS_OP_GETATTR = 0x00101, |
| 300 | CEPH_MDS_OP_LOOKUPHASH = 0x00102, |
| 301 | CEPH_MDS_OP_LOOKUPPARENT = 0x00103, |
Sage Weil | 3c454cf | 2011-04-06 09:31:40 -0700 | [diff] [blame] | 302 | CEPH_MDS_OP_LOOKUPINO = 0x00104, |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 303 | |
| 304 | CEPH_MDS_OP_SETXATTR = 0x01105, |
| 305 | CEPH_MDS_OP_RMXATTR = 0x01106, |
| 306 | CEPH_MDS_OP_SETLAYOUT = 0x01107, |
| 307 | CEPH_MDS_OP_SETATTR = 0x01108, |
Greg Farnum | fbaad97 | 2010-08-02 15:30:08 -0700 | [diff] [blame] | 308 | CEPH_MDS_OP_SETFILELOCK= 0x01109, |
| 309 | CEPH_MDS_OP_GETFILELOCK= 0x00110, |
Greg Farnum | 571dba5 | 2010-09-24 14:56:40 -0700 | [diff] [blame] | 310 | CEPH_MDS_OP_SETDIRLAYOUT=0x0110a, |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 311 | |
| 312 | CEPH_MDS_OP_MKNOD = 0x01201, |
| 313 | CEPH_MDS_OP_LINK = 0x01202, |
| 314 | CEPH_MDS_OP_UNLINK = 0x01203, |
| 315 | CEPH_MDS_OP_RENAME = 0x01204, |
| 316 | CEPH_MDS_OP_MKDIR = 0x01220, |
| 317 | CEPH_MDS_OP_RMDIR = 0x01221, |
| 318 | CEPH_MDS_OP_SYMLINK = 0x01222, |
| 319 | |
Sage Weil | 3ea25f9 | 2010-01-25 11:18:17 -0800 | [diff] [blame] | 320 | CEPH_MDS_OP_CREATE = 0x01301, |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 321 | CEPH_MDS_OP_OPEN = 0x00302, |
| 322 | CEPH_MDS_OP_READDIR = 0x00305, |
| 323 | |
| 324 | CEPH_MDS_OP_LOOKUPSNAP = 0x00400, |
| 325 | CEPH_MDS_OP_MKSNAP = 0x01400, |
| 326 | CEPH_MDS_OP_RMSNAP = 0x01401, |
| 327 | CEPH_MDS_OP_LSSNAP = 0x00402, |
| 328 | }; |
| 329 | |
| 330 | extern const char *ceph_mds_op_name(int op); |
| 331 | |
| 332 | |
| 333 | #define CEPH_SETATTR_MODE 1 |
| 334 | #define CEPH_SETATTR_UID 2 |
| 335 | #define CEPH_SETATTR_GID 4 |
| 336 | #define CEPH_SETATTR_MTIME 8 |
| 337 | #define CEPH_SETATTR_ATIME 16 |
| 338 | #define CEPH_SETATTR_SIZE 32 |
| 339 | #define CEPH_SETATTR_CTIME 64 |
| 340 | |
| 341 | union ceph_mds_request_args { |
| 342 | struct { |
| 343 | __le32 mask; /* CEPH_CAP_* */ |
| 344 | } __attribute__ ((packed)) getattr; |
| 345 | struct { |
| 346 | __le32 mode; |
| 347 | __le32 uid; |
| 348 | __le32 gid; |
| 349 | struct ceph_timespec mtime; |
| 350 | struct ceph_timespec atime; |
| 351 | __le64 size, old_size; /* old_size needed by truncate */ |
| 352 | __le32 mask; /* CEPH_SETATTR_* */ |
| 353 | } __attribute__ ((packed)) setattr; |
| 354 | struct { |
| 355 | __le32 frag; /* which dir fragment */ |
| 356 | __le32 max_entries; /* how many dentries to grab */ |
Sage Weil | 23804d9 | 2010-05-14 13:06:30 -0700 | [diff] [blame] | 357 | __le32 max_bytes; |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 358 | } __attribute__ ((packed)) readdir; |
| 359 | struct { |
| 360 | __le32 mode; |
| 361 | __le32 rdev; |
| 362 | } __attribute__ ((packed)) mknod; |
| 363 | struct { |
| 364 | __le32 mode; |
| 365 | } __attribute__ ((packed)) mkdir; |
| 366 | struct { |
| 367 | __le32 flags; |
| 368 | __le32 mode; |
| 369 | __le32 stripe_unit; /* layout for newly created file */ |
| 370 | __le32 stripe_count; /* ... */ |
| 371 | __le32 object_size; |
| 372 | __le32 file_replication; |
Sage Weil | 3469ac1a | 2012-05-07 15:33:36 -0700 | [diff] [blame] | 373 | __le32 unused; /* used to be preferred osd */ |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 374 | } __attribute__ ((packed)) open; |
| 375 | struct { |
| 376 | __le32 flags; |
| 377 | } __attribute__ ((packed)) setxattr; |
| 378 | struct { |
| 379 | struct ceph_file_layout layout; |
| 380 | } __attribute__ ((packed)) setlayout; |
Greg Farnum | fbaad97 | 2010-08-02 15:30:08 -0700 | [diff] [blame] | 381 | struct { |
| 382 | __u8 rule; /* currently fcntl or flock */ |
| 383 | __u8 type; /* shared, exclusive, remove*/ |
| 384 | __le64 pid; /* process id requesting the lock */ |
| 385 | __le64 pid_namespace; |
| 386 | __le64 start; /* initial location to lock */ |
| 387 | __le64 length; /* num bytes to lock from start */ |
| 388 | __u8 wait; /* will caller wait for lock to become available? */ |
| 389 | } __attribute__ ((packed)) filelock_change; |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 390 | } __attribute__ ((packed)); |
| 391 | |
| 392 | #define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */ |
| 393 | #define CEPH_MDS_FLAG_WANT_DENTRY 2 /* want dentry in reply */ |
| 394 | |
| 395 | struct ceph_mds_request_head { |
Sage Weil | 6df058c | 2009-12-22 11:24:33 -0800 | [diff] [blame] | 396 | __le64 oldest_client_tid; |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 397 | __le32 mdsmap_epoch; /* on client */ |
| 398 | __le32 flags; /* CEPH_MDS_FLAG_* */ |
| 399 | __u8 num_retry, num_fwd; /* count retry, fwd attempts */ |
| 400 | __le16 num_releases; /* # include cap/lease release records */ |
| 401 | __le32 op; /* mds op code */ |
| 402 | __le32 caller_uid, caller_gid; |
| 403 | __le64 ino; /* use this ino for openc, mkdir, mknod, |
| 404 | etc. (if replaying) */ |
| 405 | union ceph_mds_request_args args; |
| 406 | } __attribute__ ((packed)); |
| 407 | |
| 408 | /* cap/lease release record */ |
| 409 | struct ceph_mds_request_release { |
| 410 | __le64 ino, cap_id; /* ino and unique cap id */ |
| 411 | __le32 caps, wanted; /* new issued, wanted */ |
| 412 | __le32 seq, issue_seq, mseq; |
| 413 | __le32 dname_seq; /* if releasing a dentry lease, a */ |
| 414 | __le32 dname_len; /* string follows. */ |
| 415 | } __attribute__ ((packed)); |
| 416 | |
| 417 | /* client reply */ |
| 418 | struct ceph_mds_reply_head { |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 419 | __le32 op; |
| 420 | __le32 result; |
| 421 | __le32 mdsmap_epoch; |
| 422 | __u8 safe; /* true if committed to disk */ |
| 423 | __u8 is_dentry, is_target; /* true if dentry, target inode records |
| 424 | are included with reply */ |
| 425 | } __attribute__ ((packed)); |
| 426 | |
| 427 | /* one for each node split */ |
| 428 | struct ceph_frag_tree_split { |
| 429 | __le32 frag; /* this frag splits... */ |
| 430 | __le32 by; /* ...by this many bits */ |
| 431 | } __attribute__ ((packed)); |
| 432 | |
| 433 | struct ceph_frag_tree_head { |
| 434 | __le32 nsplits; /* num ceph_frag_tree_split records */ |
| 435 | struct ceph_frag_tree_split splits[]; |
| 436 | } __attribute__ ((packed)); |
| 437 | |
| 438 | /* capability issue, for bundling with mds reply */ |
| 439 | struct ceph_mds_reply_cap { |
| 440 | __le32 caps, wanted; /* caps issued, wanted */ |
| 441 | __le64 cap_id; |
| 442 | __le32 seq, mseq; |
| 443 | __le64 realm; /* snap realm */ |
| 444 | __u8 flags; /* CEPH_CAP_FLAG_* */ |
| 445 | } __attribute__ ((packed)); |
| 446 | |
| 447 | #define CEPH_CAP_FLAG_AUTH 1 /* cap is issued by auth mds */ |
| 448 | |
| 449 | /* inode record, for bundling with mds reply */ |
| 450 | struct ceph_mds_reply_inode { |
| 451 | __le64 ino; |
| 452 | __le64 snapid; |
| 453 | __le32 rdev; |
| 454 | __le64 version; /* inode version */ |
| 455 | __le64 xattr_version; /* version for xattr blob */ |
| 456 | struct ceph_mds_reply_cap cap; /* caps issued for this inode */ |
| 457 | struct ceph_file_layout layout; |
| 458 | struct ceph_timespec ctime, mtime, atime; |
| 459 | __le32 time_warp_seq; |
| 460 | __le64 size, max_size, truncate_size; |
| 461 | __le32 truncate_seq; |
| 462 | __le32 mode, uid, gid; |
| 463 | __le32 nlink; |
| 464 | __le64 files, subdirs, rbytes, rfiles, rsubdirs; /* dir stats */ |
| 465 | struct ceph_timespec rctime; |
| 466 | struct ceph_frag_tree_head fragtree; /* (must be at end of struct) */ |
| 467 | } __attribute__ ((packed)); |
Sage Weil | 6c0f3af | 2010-11-16 11:14:34 -0800 | [diff] [blame] | 468 | /* followed by frag array, symlink string, dir layout, xattr blob */ |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 469 | |
| 470 | /* reply_lease follows dname, and reply_inode */ |
| 471 | struct ceph_mds_reply_lease { |
| 472 | __le16 mask; /* lease type(s) */ |
| 473 | __le32 duration_ms; /* lease duration */ |
| 474 | __le32 seq; |
| 475 | } __attribute__ ((packed)); |
| 476 | |
| 477 | struct ceph_mds_reply_dirfrag { |
| 478 | __le32 frag; /* fragment */ |
| 479 | __le32 auth; /* auth mds, if this is a delegation point */ |
| 480 | __le32 ndist; /* number of mds' this is replicated on */ |
| 481 | __le32 dist[]; |
| 482 | } __attribute__ ((packed)); |
| 483 | |
Greg Farnum | fbaad97 | 2010-08-02 15:30:08 -0700 | [diff] [blame] | 484 | #define CEPH_LOCK_FCNTL 1 |
| 485 | #define CEPH_LOCK_FLOCK 2 |
| 486 | |
| 487 | #define CEPH_LOCK_SHARED 1 |
| 488 | #define CEPH_LOCK_EXCL 2 |
| 489 | #define CEPH_LOCK_UNLOCK 4 |
| 490 | |
| 491 | struct ceph_filelock { |
| 492 | __le64 start;/* file offset to start lock at */ |
| 493 | __le64 length; /* num bytes to lock; 0 for all following start */ |
| 494 | __le64 client; /* which client holds the lock */ |
| 495 | __le64 pid; /* process id holding the lock on the client */ |
| 496 | __le64 pid_namespace; |
| 497 | __u8 type; /* shared lock, exclusive lock, or unlock */ |
| 498 | } __attribute__ ((packed)); |
| 499 | |
| 500 | |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 501 | /* file access modes */ |
| 502 | #define CEPH_FILE_MODE_PIN 0 |
| 503 | #define CEPH_FILE_MODE_RD 1 |
| 504 | #define CEPH_FILE_MODE_WR 2 |
| 505 | #define CEPH_FILE_MODE_RDWR 3 /* RD | WR */ |
| 506 | #define CEPH_FILE_MODE_LAZY 4 /* lazy io */ |
| 507 | #define CEPH_FILE_MODE_NUM 8 /* bc these are bit fields.. mostly */ |
| 508 | |
| 509 | int ceph_flags_to_mode(int flags); |
| 510 | |
| 511 | |
| 512 | /* capability bits */ |
| 513 | #define CEPH_CAP_PIN 1 /* no specific capabilities beyond the pin */ |
| 514 | |
| 515 | /* generic cap bits */ |
| 516 | #define CEPH_CAP_GSHARED 1 /* client can reads */ |
| 517 | #define CEPH_CAP_GEXCL 2 /* client can read and update */ |
| 518 | #define CEPH_CAP_GCACHE 4 /* (file) client can cache reads */ |
| 519 | #define CEPH_CAP_GRD 8 /* (file) client can read */ |
| 520 | #define CEPH_CAP_GWR 16 /* (file) client can write */ |
| 521 | #define CEPH_CAP_GBUFFER 32 /* (file) client can buffer writes */ |
| 522 | #define CEPH_CAP_GWREXTEND 64 /* (file) client can extend EOF */ |
| 523 | #define CEPH_CAP_GLAZYIO 128 /* (file) client can perform lazy io */ |
| 524 | |
| 525 | /* per-lock shift */ |
| 526 | #define CEPH_CAP_SAUTH 2 |
| 527 | #define CEPH_CAP_SLINK 4 |
| 528 | #define CEPH_CAP_SXATTR 6 |
Greg Farnum | fbaad97 | 2010-08-02 15:30:08 -0700 | [diff] [blame] | 529 | #define CEPH_CAP_SFILE 8 |
| 530 | #define CEPH_CAP_SFLOCK 20 |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 531 | |
Greg Farnum | fbaad97 | 2010-08-02 15:30:08 -0700 | [diff] [blame] | 532 | #define CEPH_CAP_BITS 22 |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 533 | |
| 534 | /* composed values */ |
| 535 | #define CEPH_CAP_AUTH_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SAUTH) |
| 536 | #define CEPH_CAP_AUTH_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SAUTH) |
| 537 | #define CEPH_CAP_LINK_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SLINK) |
| 538 | #define CEPH_CAP_LINK_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SLINK) |
| 539 | #define CEPH_CAP_XATTR_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SXATTR) |
| 540 | #define CEPH_CAP_XATTR_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SXATTR) |
| 541 | #define CEPH_CAP_FILE(x) (x << CEPH_CAP_SFILE) |
| 542 | #define CEPH_CAP_FILE_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SFILE) |
| 543 | #define CEPH_CAP_FILE_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SFILE) |
| 544 | #define CEPH_CAP_FILE_CACHE (CEPH_CAP_GCACHE << CEPH_CAP_SFILE) |
| 545 | #define CEPH_CAP_FILE_RD (CEPH_CAP_GRD << CEPH_CAP_SFILE) |
| 546 | #define CEPH_CAP_FILE_WR (CEPH_CAP_GWR << CEPH_CAP_SFILE) |
| 547 | #define CEPH_CAP_FILE_BUFFER (CEPH_CAP_GBUFFER << CEPH_CAP_SFILE) |
| 548 | #define CEPH_CAP_FILE_WREXTEND (CEPH_CAP_GWREXTEND << CEPH_CAP_SFILE) |
| 549 | #define CEPH_CAP_FILE_LAZYIO (CEPH_CAP_GLAZYIO << CEPH_CAP_SFILE) |
Greg Farnum | fbaad97 | 2010-08-02 15:30:08 -0700 | [diff] [blame] | 550 | #define CEPH_CAP_FLOCK_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SFLOCK) |
| 551 | #define CEPH_CAP_FLOCK_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SFLOCK) |
| 552 | |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 553 | |
| 554 | /* cap masks (for getattr) */ |
| 555 | #define CEPH_STAT_CAP_INODE CEPH_CAP_PIN |
| 556 | #define CEPH_STAT_CAP_TYPE CEPH_CAP_PIN /* mode >> 12 */ |
| 557 | #define CEPH_STAT_CAP_SYMLINK CEPH_CAP_PIN |
| 558 | #define CEPH_STAT_CAP_UID CEPH_CAP_AUTH_SHARED |
| 559 | #define CEPH_STAT_CAP_GID CEPH_CAP_AUTH_SHARED |
| 560 | #define CEPH_STAT_CAP_MODE CEPH_CAP_AUTH_SHARED |
| 561 | #define CEPH_STAT_CAP_NLINK CEPH_CAP_LINK_SHARED |
| 562 | #define CEPH_STAT_CAP_LAYOUT CEPH_CAP_FILE_SHARED |
| 563 | #define CEPH_STAT_CAP_MTIME CEPH_CAP_FILE_SHARED |
| 564 | #define CEPH_STAT_CAP_SIZE CEPH_CAP_FILE_SHARED |
| 565 | #define CEPH_STAT_CAP_ATIME CEPH_CAP_FILE_SHARED /* fixme */ |
| 566 | #define CEPH_STAT_CAP_XATTR CEPH_CAP_XATTR_SHARED |
| 567 | #define CEPH_STAT_CAP_INODE_ALL (CEPH_CAP_PIN | \ |
| 568 | CEPH_CAP_AUTH_SHARED | \ |
| 569 | CEPH_CAP_LINK_SHARED | \ |
| 570 | CEPH_CAP_FILE_SHARED | \ |
| 571 | CEPH_CAP_XATTR_SHARED) |
| 572 | |
| 573 | #define CEPH_CAP_ANY_SHARED (CEPH_CAP_AUTH_SHARED | \ |
| 574 | CEPH_CAP_LINK_SHARED | \ |
| 575 | CEPH_CAP_XATTR_SHARED | \ |
| 576 | CEPH_CAP_FILE_SHARED) |
| 577 | #define CEPH_CAP_ANY_RD (CEPH_CAP_ANY_SHARED | CEPH_CAP_FILE_RD | \ |
| 578 | CEPH_CAP_FILE_CACHE) |
| 579 | |
| 580 | #define CEPH_CAP_ANY_EXCL (CEPH_CAP_AUTH_EXCL | \ |
| 581 | CEPH_CAP_LINK_EXCL | \ |
| 582 | CEPH_CAP_XATTR_EXCL | \ |
| 583 | CEPH_CAP_FILE_EXCL) |
| 584 | #define CEPH_CAP_ANY_FILE_WR (CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER | \ |
| 585 | CEPH_CAP_FILE_EXCL) |
| 586 | #define CEPH_CAP_ANY_WR (CEPH_CAP_ANY_EXCL | CEPH_CAP_ANY_FILE_WR) |
| 587 | #define CEPH_CAP_ANY (CEPH_CAP_ANY_RD | CEPH_CAP_ANY_EXCL | \ |
Sage Weil | 84d9509 | 2010-05-25 16:46:24 -0700 | [diff] [blame] | 588 | CEPH_CAP_ANY_FILE_WR | CEPH_CAP_FILE_LAZYIO | \ |
| 589 | CEPH_CAP_PIN) |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 590 | |
| 591 | #define CEPH_CAP_LOCKS (CEPH_LOCK_IFILE | CEPH_LOCK_IAUTH | CEPH_LOCK_ILINK | \ |
| 592 | CEPH_LOCK_IXATTR) |
| 593 | |
| 594 | int ceph_caps_for_mode(int mode); |
| 595 | |
| 596 | enum { |
| 597 | CEPH_CAP_OP_GRANT, /* mds->client grant */ |
| 598 | CEPH_CAP_OP_REVOKE, /* mds->client revoke */ |
| 599 | CEPH_CAP_OP_TRUNC, /* mds->client trunc notify */ |
| 600 | CEPH_CAP_OP_EXPORT, /* mds has exported the cap */ |
| 601 | CEPH_CAP_OP_IMPORT, /* mds has imported the cap */ |
| 602 | CEPH_CAP_OP_UPDATE, /* client->mds update */ |
| 603 | CEPH_CAP_OP_DROP, /* client->mds drop cap bits */ |
| 604 | CEPH_CAP_OP_FLUSH, /* client->mds cap writeback */ |
| 605 | CEPH_CAP_OP_FLUSH_ACK, /* mds->client flushed */ |
| 606 | CEPH_CAP_OP_FLUSHSNAP, /* client->mds flush snapped metadata */ |
| 607 | CEPH_CAP_OP_FLUSHSNAP_ACK, /* mds->client flushed snapped metadata */ |
| 608 | CEPH_CAP_OP_RELEASE, /* client->mds release (clean) cap */ |
| 609 | CEPH_CAP_OP_RENEW, /* client->mds renewal request */ |
| 610 | }; |
| 611 | |
| 612 | extern const char *ceph_cap_op_name(int op); |
| 613 | |
| 614 | /* |
| 615 | * caps message, used for capability callbacks, acks, requests, etc. |
| 616 | */ |
| 617 | struct ceph_mds_caps { |
| 618 | __le32 op; /* CEPH_CAP_OP_* */ |
| 619 | __le64 ino, realm; |
| 620 | __le64 cap_id; |
| 621 | __le32 seq, issue_seq; |
| 622 | __le32 caps, wanted, dirty; /* latest issued/wanted/dirty */ |
| 623 | __le32 migrate_seq; |
| 624 | __le64 snap_follows; |
| 625 | __le32 snap_trace_len; |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 626 | |
| 627 | /* authlock */ |
| 628 | __le32 uid, gid, mode; |
| 629 | |
| 630 | /* linklock */ |
| 631 | __le32 nlink; |
| 632 | |
| 633 | /* xattrlock */ |
| 634 | __le32 xattr_len; |
| 635 | __le64 xattr_version; |
| 636 | |
| 637 | /* filelock */ |
| 638 | __le64 size, max_size, truncate_size; |
| 639 | __le32 truncate_seq; |
| 640 | struct ceph_timespec mtime, atime, ctime; |
| 641 | struct ceph_file_layout layout; |
| 642 | __le32 time_warp_seq; |
| 643 | } __attribute__ ((packed)); |
| 644 | |
| 645 | /* cap release msg head */ |
| 646 | struct ceph_mds_cap_release { |
| 647 | __le32 num; /* number of cap_items that follow */ |
| 648 | } __attribute__ ((packed)); |
| 649 | |
| 650 | struct ceph_mds_cap_item { |
| 651 | __le64 ino; |
| 652 | __le64 cap_id; |
| 653 | __le32 migrate_seq, seq; |
| 654 | } __attribute__ ((packed)); |
| 655 | |
| 656 | #define CEPH_MDS_LEASE_REVOKE 1 /* mds -> client */ |
| 657 | #define CEPH_MDS_LEASE_RELEASE 2 /* client -> mds */ |
| 658 | #define CEPH_MDS_LEASE_RENEW 3 /* client <-> mds */ |
| 659 | #define CEPH_MDS_LEASE_REVOKE_ACK 4 /* client -> mds */ |
| 660 | |
| 661 | extern const char *ceph_lease_op_name(int o); |
| 662 | |
| 663 | /* lease msg header */ |
| 664 | struct ceph_mds_lease { |
| 665 | __u8 action; /* CEPH_MDS_LEASE_* */ |
| 666 | __le16 mask; /* which lease */ |
| 667 | __le64 ino; |
| 668 | __le64 first, last; /* snap range */ |
| 669 | __le32 seq; |
| 670 | __le32 duration_ms; /* duration of renewal */ |
| 671 | } __attribute__ ((packed)); |
| 672 | /* followed by a __le32+string for dname */ |
| 673 | |
| 674 | /* client reconnect */ |
| 675 | struct ceph_mds_cap_reconnect { |
| 676 | __le64 cap_id; |
| 677 | __le32 wanted; |
| 678 | __le32 issued; |
Sage Weil | 20cb34a | 2010-05-12 15:21:32 -0700 | [diff] [blame] | 679 | __le64 snaprealm; |
| 680 | __le64 pathbase; /* base ino for our path to this ino */ |
| 681 | __le32 flock_len; /* size of flock state blob, if any */ |
| 682 | } __attribute__ ((packed)); |
| 683 | /* followed by flock blob */ |
| 684 | |
| 685 | struct ceph_mds_cap_reconnect_v1 { |
| 686 | __le64 cap_id; |
| 687 | __le32 wanted; |
| 688 | __le32 issued; |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 689 | __le64 size; |
| 690 | struct ceph_timespec mtime, atime; |
| 691 | __le64 snaprealm; |
| 692 | __le64 pathbase; /* base ino for our path to this ino */ |
| 693 | } __attribute__ ((packed)); |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 694 | |
| 695 | struct ceph_mds_snaprealm_reconnect { |
| 696 | __le64 ino; /* snap realm base */ |
| 697 | __le64 seq; /* snap seq for this snap realm */ |
| 698 | __le64 parent; /* parent realm */ |
| 699 | } __attribute__ ((packed)); |
| 700 | |
| 701 | /* |
| 702 | * snaps |
| 703 | */ |
| 704 | enum { |
| 705 | CEPH_SNAP_OP_UPDATE, /* CREATE or DESTROY */ |
| 706 | CEPH_SNAP_OP_CREATE, |
| 707 | CEPH_SNAP_OP_DESTROY, |
| 708 | CEPH_SNAP_OP_SPLIT, |
| 709 | }; |
| 710 | |
| 711 | extern const char *ceph_snap_op_name(int o); |
| 712 | |
| 713 | /* snap msg header */ |
| 714 | struct ceph_mds_snap_head { |
| 715 | __le32 op; /* CEPH_SNAP_OP_* */ |
| 716 | __le64 split; /* ino to split off, if any */ |
| 717 | __le32 num_split_inos; /* # inos belonging to new child realm */ |
| 718 | __le32 num_split_realms; /* # child realms udner new child realm */ |
| 719 | __le32 trace_len; /* size of snap trace blob */ |
| 720 | } __attribute__ ((packed)); |
| 721 | /* followed by split ino list, then split realms, then the trace blob */ |
| 722 | |
| 723 | /* |
| 724 | * encode info about a snaprealm, as viewed by a client |
| 725 | */ |
| 726 | struct ceph_mds_snap_realm { |
| 727 | __le64 ino; /* ino */ |
| 728 | __le64 created; /* snap: when created */ |
| 729 | __le64 parent; /* ino: parent realm */ |
| 730 | __le64 parent_since; /* snap: same parent since */ |
| 731 | __le64 seq; /* snap: version */ |
| 732 | __le32 num_snaps; |
| 733 | __le32 num_prior_parent_snaps; |
| 734 | } __attribute__ ((packed)); |
| 735 | /* followed by my snap list, then prior parent snap list */ |
| 736 | |
| 737 | #endif |