2 * ceph_fs.h - Ceph constants and data types to share between kernel and
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.
12 #ifndef _FS_CEPH_CEPH_FS_H
13 #define _FS_CEPH_CEPH_FS_H
19 * Ceph release version
21 #define CEPH_VERSION_MAJOR 0
22 #define CEPH_VERSION_MINOR 20
23 #define CEPH_VERSION_PATCH 0
25 #define _CEPH_STRINGIFY(x) #x
26 #define CEPH_STRINGIFY(x) _CEPH_STRINGIFY(x)
27 #define CEPH_MAKE_VERSION(x, y, z) CEPH_STRINGIFY(x) "." CEPH_STRINGIFY(y) \
29 #define CEPH_VERSION CEPH_MAKE_VERSION(CEPH_VERSION_MAJOR, \
30 CEPH_VERSION_MINOR, CEPH_VERSION_PATCH)
33 * subprotocol versions. when specific messages types or high-level
34 * protocols change, bump the affected components. we keep rev
35 * internal cluster protocols separately from the public,
36 * client-facing protocol.
38 #define CEPH_OSD_PROTOCOL 8 /* cluster internal */
39 #define CEPH_MDS_PROTOCOL 12 /* cluster internal */
40 #define CEPH_MON_PROTOCOL 5 /* cluster internal */
41 #define CEPH_OSDC_PROTOCOL 24 /* server/client */
42 #define CEPH_MDSC_PROTOCOL 32 /* server/client */
43 #define CEPH_MONC_PROTOCOL 15 /* server/client */
46 #define CEPH_INO_ROOT 1
47 #define CEPH_INO_CEPH 2 /* hidden .ceph dir */
49 /* arbitrary limit on max # of monitors (cluster of 3 is typical) */
50 #define CEPH_MAX_MON 31
56 #define CEPH_FEATURE_UID 1
57 #define CEPH_FEATURE_NOSRCADDR 2
58 #define CEPH_FEATURE_FLOCK 4
60 #define CEPH_FEATURE_SUPPORTED_MON CEPH_FEATURE_UID|CEPH_FEATURE_NOSRCADDR
61 #define CEPH_FEATURE_REQUIRED_MON CEPH_FEATURE_UID
62 #define CEPH_FEATURE_SUPPORTED_MDS CEPH_FEATURE_UID|CEPH_FEATURE_NOSRCADDR|CEPH_FEATURE_FLOCK
63 #define CEPH_FEATURE_REQUIRED_MDS CEPH_FEATURE_UID
64 #define CEPH_FEATURE_SUPPORTED_OSD CEPH_FEATURE_UID|CEPH_FEATURE_NOSRCADDR
65 #define CEPH_FEATURE_REQUIRED_OSD CEPH_FEATURE_UID
66 #define CEPH_FEATURE_SUPPORTED_CLIENT CEPH_FEATURE_NOSRCADDR
67 #define CEPH_FEATURE_REQUIRED_CLIENT CEPH_FEATURE_NOSRCADDR
71 * ceph_file_layout - describe data layout for a file/inode
73 struct ceph_file_layout {
74 /* file -> object mapping */
75 __le32 fl_stripe_unit; /* stripe unit, in bytes. must be multiple
77 __le32 fl_stripe_count; /* over this many objects */
78 __le32 fl_object_size; /* until objects are this big, then move to
80 __le32 fl_cas_hash; /* 0 = none; 1 = sha256 */
82 /* pg -> disk layout */
83 __le32 fl_object_stripe_unit; /* for per-object parity, if any */
85 /* object -> pg layout */
86 __le32 fl_pg_preferred; /* preferred primary for pg (-1 for none) */
87 __le32 fl_pg_pool; /* namespace, crush ruleset, rep level */
88 } __attribute__ ((packed));
90 #define CEPH_MIN_STRIPE_UNIT 65536
92 int ceph_file_layout_is_valid(const struct ceph_file_layout *layout);
95 /* crypto algorithms */
96 #define CEPH_CRYPTO_NONE 0x0
97 #define CEPH_CRYPTO_AES 0x1
99 /* security/authentication protocols */
100 #define CEPH_AUTH_UNKNOWN 0x0
101 #define CEPH_AUTH_NONE 0x1
102 #define CEPH_AUTH_CEPHX 0x2
104 #define CEPH_AUTH_UID_DEFAULT ((__u64) -1)
107 /*********************************************
116 #define CEPH_MSG_SHUTDOWN 1
117 #define CEPH_MSG_PING 2
119 /* client <-> monitor */
120 #define CEPH_MSG_MON_MAP 4
121 #define CEPH_MSG_MON_GET_MAP 5
122 #define CEPH_MSG_STATFS 13
123 #define CEPH_MSG_STATFS_REPLY 14
124 #define CEPH_MSG_MON_SUBSCRIBE 15
125 #define CEPH_MSG_MON_SUBSCRIBE_ACK 16
126 #define CEPH_MSG_AUTH 17
127 #define CEPH_MSG_AUTH_REPLY 18
130 #define CEPH_MSG_MDS_MAP 21
132 #define CEPH_MSG_CLIENT_SESSION 22
133 #define CEPH_MSG_CLIENT_RECONNECT 23
135 #define CEPH_MSG_CLIENT_REQUEST 24
136 #define CEPH_MSG_CLIENT_REQUEST_FORWARD 25
137 #define CEPH_MSG_CLIENT_REPLY 26
138 #define CEPH_MSG_CLIENT_CAPS 0x310
139 #define CEPH_MSG_CLIENT_LEASE 0x311
140 #define CEPH_MSG_CLIENT_SNAP 0x312
141 #define CEPH_MSG_CLIENT_CAPRELEASE 0x313
144 #define CEPH_MSG_POOLOP_REPLY 48
145 #define CEPH_MSG_POOLOP 49
149 #define CEPH_MSG_OSD_MAP 41
150 #define CEPH_MSG_OSD_OP 42
151 #define CEPH_MSG_OSD_OPREPLY 43
153 /* pool operations */
155 POOL_OP_CREATE = 0x01,
156 POOL_OP_DELETE = 0x02,
157 POOL_OP_AUID_CHANGE = 0x03,
158 POOL_OP_CREATE_SNAP = 0x11,
159 POOL_OP_DELETE_SNAP = 0x12,
160 POOL_OP_CREATE_UNMANAGED_SNAP = 0x21,
161 POOL_OP_DELETE_UNMANAGED_SNAP = 0x22,
164 struct ceph_mon_request_header {
167 __le64 session_mon_tid;
168 } __attribute__ ((packed));
170 struct ceph_mon_statfs {
171 struct ceph_mon_request_header monhdr;
172 struct ceph_fsid fsid;
173 } __attribute__ ((packed));
176 __le64 kb, kb_used, kb_avail;
178 } __attribute__ ((packed));
180 struct ceph_mon_statfs_reply {
181 struct ceph_fsid fsid;
183 struct ceph_statfs st;
184 } __attribute__ ((packed));
186 const char *ceph_pool_op_name(int op);
188 struct ceph_mon_poolop {
189 struct ceph_mon_request_header monhdr;
190 struct ceph_fsid fsid;
196 } __attribute__ ((packed));
198 struct ceph_mon_poolop_reply {
199 struct ceph_mon_request_header monhdr;
200 struct ceph_fsid fsid;
205 } __attribute__ ((packed));
207 struct ceph_mon_unmanaged_snap {
209 } __attribute__ ((packed));
211 struct ceph_osd_getmap {
212 struct ceph_mon_request_header monhdr;
213 struct ceph_fsid fsid;
215 } __attribute__ ((packed));
217 struct ceph_mds_getmap {
218 struct ceph_mon_request_header monhdr;
219 struct ceph_fsid fsid;
220 } __attribute__ ((packed));
222 struct ceph_client_mount {
223 struct ceph_mon_request_header monhdr;
224 } __attribute__ ((packed));
226 struct ceph_mon_subscribe_item {
227 __le64 have_version; __le64 have;
229 } __attribute__ ((packed));
231 struct ceph_mon_subscribe_ack {
232 __le32 duration; /* seconds */
233 struct ceph_fsid fsid;
234 } __attribute__ ((packed));
241 #define CEPH_MDS_STATE_DNE 0 /* down, does not exist. */
242 #define CEPH_MDS_STATE_STOPPED -1 /* down, once existed, but no subtrees.
244 #define CEPH_MDS_STATE_BOOT -4 /* up, boot announcement. */
245 #define CEPH_MDS_STATE_STANDBY -5 /* up, idle. waiting for assignment. */
246 #define CEPH_MDS_STATE_CREATING -6 /* up, creating MDS instance. */
247 #define CEPH_MDS_STATE_STARTING -7 /* up, starting previously stopped mds */
248 #define CEPH_MDS_STATE_STANDBY_REPLAY -8 /* up, tailing active node's journal */
250 #define CEPH_MDS_STATE_REPLAY 8 /* up, replaying journal. */
251 #define CEPH_MDS_STATE_RESOLVE 9 /* up, disambiguating distributed
252 operations (import, rename, etc.) */
253 #define CEPH_MDS_STATE_RECONNECT 10 /* up, reconnect to clients */
254 #define CEPH_MDS_STATE_REJOIN 11 /* up, rejoining distributed cache */
255 #define CEPH_MDS_STATE_CLIENTREPLAY 12 /* up, replaying client operations */
256 #define CEPH_MDS_STATE_ACTIVE 13 /* up, active */
257 #define CEPH_MDS_STATE_STOPPING 14 /* up, but exporting metadata */
259 extern const char *ceph_mds_state_name(int s);
263 * metadata lock types.
264 * - these are bitmasks.. we can compose them
265 * - they also define the lock ordering by the MDS
266 * - a few of these are internal to the mds
268 #define CEPH_LOCK_DVERSION 1
269 #define CEPH_LOCK_DN 2
270 #define CEPH_LOCK_ISNAP 16
271 #define CEPH_LOCK_IVERSION 32 /* mds internal */
272 #define CEPH_LOCK_IFILE 64
273 #define CEPH_LOCK_IAUTH 128
274 #define CEPH_LOCK_ILINK 256
275 #define CEPH_LOCK_IDFT 512 /* dir frag tree */
276 #define CEPH_LOCK_INEST 1024 /* mds internal */
277 #define CEPH_LOCK_IXATTR 2048
278 #define CEPH_LOCK_INO 8192 /* immutable inode bits; not a lock */
280 /* client_session ops */
282 CEPH_SESSION_REQUEST_OPEN,
284 CEPH_SESSION_REQUEST_CLOSE,
286 CEPH_SESSION_REQUEST_RENEWCAPS,
287 CEPH_SESSION_RENEWCAPS,
289 CEPH_SESSION_RECALL_STATE,
292 extern const char *ceph_session_op_name(int op);
294 struct ceph_mds_session_head {
297 struct ceph_timespec stamp;
298 __le32 max_caps, max_leases;
299 } __attribute__ ((packed));
304 * & 0x001000 -> write op
305 * & 0x010000 -> follow symlink (e.g. stat(), not lstat()).
306 & & 0x100000 -> use weird ino/path trace
308 #define CEPH_MDS_OP_WRITE 0x001000
310 CEPH_MDS_OP_LOOKUP = 0x00100,
311 CEPH_MDS_OP_GETATTR = 0x00101,
312 CEPH_MDS_OP_LOOKUPHASH = 0x00102,
313 CEPH_MDS_OP_LOOKUPPARENT = 0x00103,
315 CEPH_MDS_OP_SETXATTR = 0x01105,
316 CEPH_MDS_OP_RMXATTR = 0x01106,
317 CEPH_MDS_OP_SETLAYOUT = 0x01107,
318 CEPH_MDS_OP_SETATTR = 0x01108,
320 CEPH_MDS_OP_MKNOD = 0x01201,
321 CEPH_MDS_OP_LINK = 0x01202,
322 CEPH_MDS_OP_UNLINK = 0x01203,
323 CEPH_MDS_OP_RENAME = 0x01204,
324 CEPH_MDS_OP_MKDIR = 0x01220,
325 CEPH_MDS_OP_RMDIR = 0x01221,
326 CEPH_MDS_OP_SYMLINK = 0x01222,
328 CEPH_MDS_OP_CREATE = 0x01301,
329 CEPH_MDS_OP_OPEN = 0x00302,
330 CEPH_MDS_OP_READDIR = 0x00305,
332 CEPH_MDS_OP_LOOKUPSNAP = 0x00400,
333 CEPH_MDS_OP_MKSNAP = 0x01400,
334 CEPH_MDS_OP_RMSNAP = 0x01401,
335 CEPH_MDS_OP_LSSNAP = 0x00402,
338 extern const char *ceph_mds_op_name(int op);
341 #define CEPH_SETATTR_MODE 1
342 #define CEPH_SETATTR_UID 2
343 #define CEPH_SETATTR_GID 4
344 #define CEPH_SETATTR_MTIME 8
345 #define CEPH_SETATTR_ATIME 16
346 #define CEPH_SETATTR_SIZE 32
347 #define CEPH_SETATTR_CTIME 64
349 union ceph_mds_request_args {
351 __le32 mask; /* CEPH_CAP_* */
352 } __attribute__ ((packed)) getattr;
357 struct ceph_timespec mtime;
358 struct ceph_timespec atime;
359 __le64 size, old_size; /* old_size needed by truncate */
360 __le32 mask; /* CEPH_SETATTR_* */
361 } __attribute__ ((packed)) setattr;
363 __le32 frag; /* which dir fragment */
364 __le32 max_entries; /* how many dentries to grab */
366 } __attribute__ ((packed)) readdir;
370 } __attribute__ ((packed)) mknod;
373 } __attribute__ ((packed)) mkdir;
377 __le32 stripe_unit; /* layout for newly created file */
378 __le32 stripe_count; /* ... */
380 __le32 file_replication;
382 } __attribute__ ((packed)) open;
385 } __attribute__ ((packed)) setxattr;
387 struct ceph_file_layout layout;
388 } __attribute__ ((packed)) setlayout;
389 } __attribute__ ((packed));
391 #define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */
392 #define CEPH_MDS_FLAG_WANT_DENTRY 2 /* want dentry in reply */
394 struct ceph_mds_request_head {
395 __le64 oldest_client_tid;
396 __le32 mdsmap_epoch; /* on client */
397 __le32 flags; /* CEPH_MDS_FLAG_* */
398 __u8 num_retry, num_fwd; /* count retry, fwd attempts */
399 __le16 num_releases; /* # include cap/lease release records */
400 __le32 op; /* mds op code */
401 __le32 caller_uid, caller_gid;
402 __le64 ino; /* use this ino for openc, mkdir, mknod,
403 etc. (if replaying) */
404 union ceph_mds_request_args args;
405 } __attribute__ ((packed));
407 /* cap/lease release record */
408 struct ceph_mds_request_release {
409 __le64 ino, cap_id; /* ino and unique cap id */
410 __le32 caps, wanted; /* new issued, wanted */
411 __le32 seq, issue_seq, mseq;
412 __le32 dname_seq; /* if releasing a dentry lease, a */
413 __le32 dname_len; /* string follows. */
414 } __attribute__ ((packed));
417 struct ceph_mds_reply_head {
421 __u8 safe; /* true if committed to disk */
422 __u8 is_dentry, is_target; /* true if dentry, target inode records
423 are included with reply */
424 } __attribute__ ((packed));
426 /* one for each node split */
427 struct ceph_frag_tree_split {
428 __le32 frag; /* this frag splits... */
429 __le32 by; /* ...by this many bits */
430 } __attribute__ ((packed));
432 struct ceph_frag_tree_head {
433 __le32 nsplits; /* num ceph_frag_tree_split records */
434 struct ceph_frag_tree_split splits[];
435 } __attribute__ ((packed));
437 /* capability issue, for bundling with mds reply */
438 struct ceph_mds_reply_cap {
439 __le32 caps, wanted; /* caps issued, wanted */
442 __le64 realm; /* snap realm */
443 __u8 flags; /* CEPH_CAP_FLAG_* */
444 } __attribute__ ((packed));
446 #define CEPH_CAP_FLAG_AUTH 1 /* cap is issued by auth mds */
448 /* inode record, for bundling with mds reply */
449 struct ceph_mds_reply_inode {
453 __le64 version; /* inode version */
454 __le64 xattr_version; /* version for xattr blob */
455 struct ceph_mds_reply_cap cap; /* caps issued for this inode */
456 struct ceph_file_layout layout;
457 struct ceph_timespec ctime, mtime, atime;
458 __le32 time_warp_seq;
459 __le64 size, max_size, truncate_size;
461 __le32 mode, uid, gid;
463 __le64 files, subdirs, rbytes, rfiles, rsubdirs; /* dir stats */
464 struct ceph_timespec rctime;
465 struct ceph_frag_tree_head fragtree; /* (must be at end of struct) */
466 } __attribute__ ((packed));
467 /* followed by frag array, then symlink string, then xattr blob */
469 /* reply_lease follows dname, and reply_inode */
470 struct ceph_mds_reply_lease {
471 __le16 mask; /* lease type(s) */
472 __le32 duration_ms; /* lease duration */
474 } __attribute__ ((packed));
476 struct ceph_mds_reply_dirfrag {
477 __le32 frag; /* fragment */
478 __le32 auth; /* auth mds, if this is a delegation point */
479 __le32 ndist; /* number of mds' this is replicated on */
481 } __attribute__ ((packed));
483 /* file access modes */
484 #define CEPH_FILE_MODE_PIN 0
485 #define CEPH_FILE_MODE_RD 1
486 #define CEPH_FILE_MODE_WR 2
487 #define CEPH_FILE_MODE_RDWR 3 /* RD | WR */
488 #define CEPH_FILE_MODE_LAZY 4 /* lazy io */
489 #define CEPH_FILE_MODE_NUM 8 /* bc these are bit fields.. mostly */
491 int ceph_flags_to_mode(int flags);
494 /* capability bits */
495 #define CEPH_CAP_PIN 1 /* no specific capabilities beyond the pin */
497 /* generic cap bits */
498 #define CEPH_CAP_GSHARED 1 /* client can reads */
499 #define CEPH_CAP_GEXCL 2 /* client can read and update */
500 #define CEPH_CAP_GCACHE 4 /* (file) client can cache reads */
501 #define CEPH_CAP_GRD 8 /* (file) client can read */
502 #define CEPH_CAP_GWR 16 /* (file) client can write */
503 #define CEPH_CAP_GBUFFER 32 /* (file) client can buffer writes */
504 #define CEPH_CAP_GWREXTEND 64 /* (file) client can extend EOF */
505 #define CEPH_CAP_GLAZYIO 128 /* (file) client can perform lazy io */
508 #define CEPH_CAP_SAUTH 2
509 #define CEPH_CAP_SLINK 4
510 #define CEPH_CAP_SXATTR 6
511 #define CEPH_CAP_SFILE 8 /* goes at the end (uses >2 cap bits) */
513 #define CEPH_CAP_BITS 16
515 /* composed values */
516 #define CEPH_CAP_AUTH_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SAUTH)
517 #define CEPH_CAP_AUTH_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SAUTH)
518 #define CEPH_CAP_LINK_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SLINK)
519 #define CEPH_CAP_LINK_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SLINK)
520 #define CEPH_CAP_XATTR_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SXATTR)
521 #define CEPH_CAP_XATTR_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SXATTR)
522 #define CEPH_CAP_FILE(x) (x << CEPH_CAP_SFILE)
523 #define CEPH_CAP_FILE_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SFILE)
524 #define CEPH_CAP_FILE_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SFILE)
525 #define CEPH_CAP_FILE_CACHE (CEPH_CAP_GCACHE << CEPH_CAP_SFILE)
526 #define CEPH_CAP_FILE_RD (CEPH_CAP_GRD << CEPH_CAP_SFILE)
527 #define CEPH_CAP_FILE_WR (CEPH_CAP_GWR << CEPH_CAP_SFILE)
528 #define CEPH_CAP_FILE_BUFFER (CEPH_CAP_GBUFFER << CEPH_CAP_SFILE)
529 #define CEPH_CAP_FILE_WREXTEND (CEPH_CAP_GWREXTEND << CEPH_CAP_SFILE)
530 #define CEPH_CAP_FILE_LAZYIO (CEPH_CAP_GLAZYIO << CEPH_CAP_SFILE)
532 /* cap masks (for getattr) */
533 #define CEPH_STAT_CAP_INODE CEPH_CAP_PIN
534 #define CEPH_STAT_CAP_TYPE CEPH_CAP_PIN /* mode >> 12 */
535 #define CEPH_STAT_CAP_SYMLINK CEPH_CAP_PIN
536 #define CEPH_STAT_CAP_UID CEPH_CAP_AUTH_SHARED
537 #define CEPH_STAT_CAP_GID CEPH_CAP_AUTH_SHARED
538 #define CEPH_STAT_CAP_MODE CEPH_CAP_AUTH_SHARED
539 #define CEPH_STAT_CAP_NLINK CEPH_CAP_LINK_SHARED
540 #define CEPH_STAT_CAP_LAYOUT CEPH_CAP_FILE_SHARED
541 #define CEPH_STAT_CAP_MTIME CEPH_CAP_FILE_SHARED
542 #define CEPH_STAT_CAP_SIZE CEPH_CAP_FILE_SHARED
543 #define CEPH_STAT_CAP_ATIME CEPH_CAP_FILE_SHARED /* fixme */
544 #define CEPH_STAT_CAP_XATTR CEPH_CAP_XATTR_SHARED
545 #define CEPH_STAT_CAP_INODE_ALL (CEPH_CAP_PIN | \
546 CEPH_CAP_AUTH_SHARED | \
547 CEPH_CAP_LINK_SHARED | \
548 CEPH_CAP_FILE_SHARED | \
549 CEPH_CAP_XATTR_SHARED)
551 #define CEPH_CAP_ANY_SHARED (CEPH_CAP_AUTH_SHARED | \
552 CEPH_CAP_LINK_SHARED | \
553 CEPH_CAP_XATTR_SHARED | \
554 CEPH_CAP_FILE_SHARED)
555 #define CEPH_CAP_ANY_RD (CEPH_CAP_ANY_SHARED | CEPH_CAP_FILE_RD | \
558 #define CEPH_CAP_ANY_EXCL (CEPH_CAP_AUTH_EXCL | \
559 CEPH_CAP_LINK_EXCL | \
560 CEPH_CAP_XATTR_EXCL | \
562 #define CEPH_CAP_ANY_FILE_WR (CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER | \
564 #define CEPH_CAP_ANY_WR (CEPH_CAP_ANY_EXCL | CEPH_CAP_ANY_FILE_WR)
565 #define CEPH_CAP_ANY (CEPH_CAP_ANY_RD | CEPH_CAP_ANY_EXCL | \
566 CEPH_CAP_ANY_FILE_WR | CEPH_CAP_PIN)
568 #define CEPH_CAP_LOCKS (CEPH_LOCK_IFILE | CEPH_LOCK_IAUTH | CEPH_LOCK_ILINK | \
571 int ceph_caps_for_mode(int mode);
574 CEPH_CAP_OP_GRANT, /* mds->client grant */
575 CEPH_CAP_OP_REVOKE, /* mds->client revoke */
576 CEPH_CAP_OP_TRUNC, /* mds->client trunc notify */
577 CEPH_CAP_OP_EXPORT, /* mds has exported the cap */
578 CEPH_CAP_OP_IMPORT, /* mds has imported the cap */
579 CEPH_CAP_OP_UPDATE, /* client->mds update */
580 CEPH_CAP_OP_DROP, /* client->mds drop cap bits */
581 CEPH_CAP_OP_FLUSH, /* client->mds cap writeback */
582 CEPH_CAP_OP_FLUSH_ACK, /* mds->client flushed */
583 CEPH_CAP_OP_FLUSHSNAP, /* client->mds flush snapped metadata */
584 CEPH_CAP_OP_FLUSHSNAP_ACK, /* mds->client flushed snapped metadata */
585 CEPH_CAP_OP_RELEASE, /* client->mds release (clean) cap */
586 CEPH_CAP_OP_RENEW, /* client->mds renewal request */
589 extern const char *ceph_cap_op_name(int op);
592 * caps message, used for capability callbacks, acks, requests, etc.
594 struct ceph_mds_caps {
595 __le32 op; /* CEPH_CAP_OP_* */
598 __le32 seq, issue_seq;
599 __le32 caps, wanted, dirty; /* latest issued/wanted/dirty */
602 __le32 snap_trace_len;
605 __le32 uid, gid, mode;
612 __le64 xattr_version;
615 __le64 size, max_size, truncate_size;
617 struct ceph_timespec mtime, atime, ctime;
618 struct ceph_file_layout layout;
619 __le32 time_warp_seq;
620 } __attribute__ ((packed));
622 /* cap release msg head */
623 struct ceph_mds_cap_release {
624 __le32 num; /* number of cap_items that follow */
625 } __attribute__ ((packed));
627 struct ceph_mds_cap_item {
630 __le32 migrate_seq, seq;
631 } __attribute__ ((packed));
633 #define CEPH_MDS_LEASE_REVOKE 1 /* mds -> client */
634 #define CEPH_MDS_LEASE_RELEASE 2 /* client -> mds */
635 #define CEPH_MDS_LEASE_RENEW 3 /* client <-> mds */
636 #define CEPH_MDS_LEASE_REVOKE_ACK 4 /* client -> mds */
638 extern const char *ceph_lease_op_name(int o);
640 /* lease msg header */
641 struct ceph_mds_lease {
642 __u8 action; /* CEPH_MDS_LEASE_* */
643 __le16 mask; /* which lease */
645 __le64 first, last; /* snap range */
647 __le32 duration_ms; /* duration of renewal */
648 } __attribute__ ((packed));
649 /* followed by a __le32+string for dname */
651 /* client reconnect */
652 struct ceph_mds_cap_reconnect {
657 struct ceph_timespec mtime, atime;
659 __le64 pathbase; /* base ino for our path to this ino */
660 } __attribute__ ((packed));
661 /* followed by encoded string */
663 struct ceph_mds_snaprealm_reconnect {
664 __le64 ino; /* snap realm base */
665 __le64 seq; /* snap seq for this snap realm */
666 __le64 parent; /* parent realm */
667 } __attribute__ ((packed));
673 CEPH_SNAP_OP_UPDATE, /* CREATE or DESTROY */
675 CEPH_SNAP_OP_DESTROY,
679 extern const char *ceph_snap_op_name(int o);
681 /* snap msg header */
682 struct ceph_mds_snap_head {
683 __le32 op; /* CEPH_SNAP_OP_* */
684 __le64 split; /* ino to split off, if any */
685 __le32 num_split_inos; /* # inos belonging to new child realm */
686 __le32 num_split_realms; /* # child realms udner new child realm */
687 __le32 trace_len; /* size of snap trace blob */
688 } __attribute__ ((packed));
689 /* followed by split ino list, then split realms, then the trace blob */
692 * encode info about a snaprealm, as viewed by a client
694 struct ceph_mds_snap_realm {
695 __le64 ino; /* ino */
696 __le64 created; /* snap: when created */
697 __le64 parent; /* ino: parent realm */
698 __le64 parent_since; /* snap: same parent since */
699 __le64 seq; /* snap: version */
701 __le32 num_prior_parent_snaps;
702 } __attribute__ ((packed));
703 /* followed by my snap list, then prior parent snap list */