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_DN 1
269 #define CEPH_LOCK_ISNAP 2
270 #define CEPH_LOCK_IVERSION 4 /* mds internal */
271 #define CEPH_LOCK_IFILE 8 /* mds internal */
272 #define CEPH_LOCK_IAUTH 32
273 #define CEPH_LOCK_ILINK 64
274 #define CEPH_LOCK_IDFT 128 /* dir frag tree */
275 #define CEPH_LOCK_INEST 256 /* mds internal */
276 #define CEPH_LOCK_IXATTR 512
277 #define CEPH_LOCK_INO 2048 /* immutable inode bits; not a lock */
279 /* client_session ops */
281 CEPH_SESSION_REQUEST_OPEN
,
283 CEPH_SESSION_REQUEST_CLOSE
,
285 CEPH_SESSION_REQUEST_RENEWCAPS
,
286 CEPH_SESSION_RENEWCAPS
,
288 CEPH_SESSION_RECALL_STATE
,
291 extern const char *ceph_session_op_name(int op
);
293 struct ceph_mds_session_head
{
296 struct ceph_timespec stamp
;
297 __le32 max_caps
, max_leases
;
298 } __attribute__ ((packed
));
303 * & 0x001000 -> write op
304 * & 0x010000 -> follow symlink (e.g. stat(), not lstat()).
305 & & 0x100000 -> use weird ino/path trace
307 #define CEPH_MDS_OP_WRITE 0x001000
309 CEPH_MDS_OP_LOOKUP
= 0x00100,
310 CEPH_MDS_OP_GETATTR
= 0x00101,
311 CEPH_MDS_OP_LOOKUPHASH
= 0x00102,
312 CEPH_MDS_OP_LOOKUPPARENT
= 0x00103,
314 CEPH_MDS_OP_SETXATTR
= 0x01105,
315 CEPH_MDS_OP_RMXATTR
= 0x01106,
316 CEPH_MDS_OP_SETLAYOUT
= 0x01107,
317 CEPH_MDS_OP_SETATTR
= 0x01108,
319 CEPH_MDS_OP_MKNOD
= 0x01201,
320 CEPH_MDS_OP_LINK
= 0x01202,
321 CEPH_MDS_OP_UNLINK
= 0x01203,
322 CEPH_MDS_OP_RENAME
= 0x01204,
323 CEPH_MDS_OP_MKDIR
= 0x01220,
324 CEPH_MDS_OP_RMDIR
= 0x01221,
325 CEPH_MDS_OP_SYMLINK
= 0x01222,
327 CEPH_MDS_OP_CREATE
= 0x01301,
328 CEPH_MDS_OP_OPEN
= 0x00302,
329 CEPH_MDS_OP_READDIR
= 0x00305,
331 CEPH_MDS_OP_LOOKUPSNAP
= 0x00400,
332 CEPH_MDS_OP_MKSNAP
= 0x01400,
333 CEPH_MDS_OP_RMSNAP
= 0x01401,
334 CEPH_MDS_OP_LSSNAP
= 0x00402,
337 extern const char *ceph_mds_op_name(int op
);
340 #define CEPH_SETATTR_MODE 1
341 #define CEPH_SETATTR_UID 2
342 #define CEPH_SETATTR_GID 4
343 #define CEPH_SETATTR_MTIME 8
344 #define CEPH_SETATTR_ATIME 16
345 #define CEPH_SETATTR_SIZE 32
346 #define CEPH_SETATTR_CTIME 64
348 union ceph_mds_request_args
{
350 __le32 mask
; /* CEPH_CAP_* */
351 } __attribute__ ((packed
)) getattr
;
356 struct ceph_timespec mtime
;
357 struct ceph_timespec atime
;
358 __le64 size
, old_size
; /* old_size needed by truncate */
359 __le32 mask
; /* CEPH_SETATTR_* */
360 } __attribute__ ((packed
)) setattr
;
362 __le32 frag
; /* which dir fragment */
363 __le32 max_entries
; /* how many dentries to grab */
365 } __attribute__ ((packed
)) readdir
;
369 } __attribute__ ((packed
)) mknod
;
372 } __attribute__ ((packed
)) mkdir
;
376 __le32 stripe_unit
; /* layout for newly created file */
377 __le32 stripe_count
; /* ... */
379 __le32 file_replication
;
381 } __attribute__ ((packed
)) open
;
384 } __attribute__ ((packed
)) setxattr
;
386 struct ceph_file_layout layout
;
387 } __attribute__ ((packed
)) setlayout
;
388 } __attribute__ ((packed
));
390 #define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */
391 #define CEPH_MDS_FLAG_WANT_DENTRY 2 /* want dentry in reply */
393 struct ceph_mds_request_head
{
394 __le64 oldest_client_tid
;
395 __le32 mdsmap_epoch
; /* on client */
396 __le32 flags
; /* CEPH_MDS_FLAG_* */
397 __u8 num_retry
, num_fwd
; /* count retry, fwd attempts */
398 __le16 num_releases
; /* # include cap/lease release records */
399 __le32 op
; /* mds op code */
400 __le32 caller_uid
, caller_gid
;
401 __le64 ino
; /* use this ino for openc, mkdir, mknod,
402 etc. (if replaying) */
403 union ceph_mds_request_args args
;
404 } __attribute__ ((packed
));
406 /* cap/lease release record */
407 struct ceph_mds_request_release
{
408 __le64 ino
, cap_id
; /* ino and unique cap id */
409 __le32 caps
, wanted
; /* new issued, wanted */
410 __le32 seq
, issue_seq
, mseq
;
411 __le32 dname_seq
; /* if releasing a dentry lease, a */
412 __le32 dname_len
; /* string follows. */
413 } __attribute__ ((packed
));
416 struct ceph_mds_reply_head
{
420 __u8 safe
; /* true if committed to disk */
421 __u8 is_dentry
, is_target
; /* true if dentry, target inode records
422 are included with reply */
423 } __attribute__ ((packed
));
425 /* one for each node split */
426 struct ceph_frag_tree_split
{
427 __le32 frag
; /* this frag splits... */
428 __le32 by
; /* ...by this many bits */
429 } __attribute__ ((packed
));
431 struct ceph_frag_tree_head
{
432 __le32 nsplits
; /* num ceph_frag_tree_split records */
433 struct ceph_frag_tree_split splits
[];
434 } __attribute__ ((packed
));
436 /* capability issue, for bundling with mds reply */
437 struct ceph_mds_reply_cap
{
438 __le32 caps
, wanted
; /* caps issued, wanted */
441 __le64 realm
; /* snap realm */
442 __u8 flags
; /* CEPH_CAP_FLAG_* */
443 } __attribute__ ((packed
));
445 #define CEPH_CAP_FLAG_AUTH 1 /* cap is issued by auth mds */
447 /* inode record, for bundling with mds reply */
448 struct ceph_mds_reply_inode
{
452 __le64 version
; /* inode version */
453 __le64 xattr_version
; /* version for xattr blob */
454 struct ceph_mds_reply_cap cap
; /* caps issued for this inode */
455 struct ceph_file_layout layout
;
456 struct ceph_timespec ctime
, mtime
, atime
;
457 __le32 time_warp_seq
;
458 __le64 size
, max_size
, truncate_size
;
460 __le32 mode
, uid
, gid
;
462 __le64 files
, subdirs
, rbytes
, rfiles
, rsubdirs
; /* dir stats */
463 struct ceph_timespec rctime
;
464 struct ceph_frag_tree_head fragtree
; /* (must be at end of struct) */
465 } __attribute__ ((packed
));
466 /* followed by frag array, then symlink string, then xattr blob */
468 /* reply_lease follows dname, and reply_inode */
469 struct ceph_mds_reply_lease
{
470 __le16 mask
; /* lease type(s) */
471 __le32 duration_ms
; /* lease duration */
473 } __attribute__ ((packed
));
475 struct ceph_mds_reply_dirfrag
{
476 __le32 frag
; /* fragment */
477 __le32 auth
; /* auth mds, if this is a delegation point */
478 __le32 ndist
; /* number of mds' this is replicated on */
480 } __attribute__ ((packed
));
482 /* file access modes */
483 #define CEPH_FILE_MODE_PIN 0
484 #define CEPH_FILE_MODE_RD 1
485 #define CEPH_FILE_MODE_WR 2
486 #define CEPH_FILE_MODE_RDWR 3 /* RD | WR */
487 #define CEPH_FILE_MODE_LAZY 4 /* lazy io */
488 #define CEPH_FILE_MODE_NUM 8 /* bc these are bit fields.. mostly */
490 int ceph_flags_to_mode(int flags
);
493 /* capability bits */
494 #define CEPH_CAP_PIN 1 /* no specific capabilities beyond the pin */
496 /* generic cap bits */
497 #define CEPH_CAP_GSHARED 1 /* client can reads */
498 #define CEPH_CAP_GEXCL 2 /* client can read and update */
499 #define CEPH_CAP_GCACHE 4 /* (file) client can cache reads */
500 #define CEPH_CAP_GRD 8 /* (file) client can read */
501 #define CEPH_CAP_GWR 16 /* (file) client can write */
502 #define CEPH_CAP_GBUFFER 32 /* (file) client can buffer writes */
503 #define CEPH_CAP_GWREXTEND 64 /* (file) client can extend EOF */
504 #define CEPH_CAP_GLAZYIO 128 /* (file) client can perform lazy io */
507 #define CEPH_CAP_SAUTH 2
508 #define CEPH_CAP_SLINK 4
509 #define CEPH_CAP_SXATTR 6
510 #define CEPH_CAP_SFILE 8 /* goes at the end (uses >2 cap bits) */
512 #define CEPH_CAP_BITS 16
514 /* composed values */
515 #define CEPH_CAP_AUTH_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SAUTH)
516 #define CEPH_CAP_AUTH_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SAUTH)
517 #define CEPH_CAP_LINK_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SLINK)
518 #define CEPH_CAP_LINK_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SLINK)
519 #define CEPH_CAP_XATTR_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SXATTR)
520 #define CEPH_CAP_XATTR_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SXATTR)
521 #define CEPH_CAP_FILE(x) (x << CEPH_CAP_SFILE)
522 #define CEPH_CAP_FILE_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SFILE)
523 #define CEPH_CAP_FILE_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SFILE)
524 #define CEPH_CAP_FILE_CACHE (CEPH_CAP_GCACHE << CEPH_CAP_SFILE)
525 #define CEPH_CAP_FILE_RD (CEPH_CAP_GRD << CEPH_CAP_SFILE)
526 #define CEPH_CAP_FILE_WR (CEPH_CAP_GWR << CEPH_CAP_SFILE)
527 #define CEPH_CAP_FILE_BUFFER (CEPH_CAP_GBUFFER << CEPH_CAP_SFILE)
528 #define CEPH_CAP_FILE_WREXTEND (CEPH_CAP_GWREXTEND << CEPH_CAP_SFILE)
529 #define CEPH_CAP_FILE_LAZYIO (CEPH_CAP_GLAZYIO << CEPH_CAP_SFILE)
531 /* cap masks (for getattr) */
532 #define CEPH_STAT_CAP_INODE CEPH_CAP_PIN
533 #define CEPH_STAT_CAP_TYPE CEPH_CAP_PIN /* mode >> 12 */
534 #define CEPH_STAT_CAP_SYMLINK CEPH_CAP_PIN
535 #define CEPH_STAT_CAP_UID CEPH_CAP_AUTH_SHARED
536 #define CEPH_STAT_CAP_GID CEPH_CAP_AUTH_SHARED
537 #define CEPH_STAT_CAP_MODE CEPH_CAP_AUTH_SHARED
538 #define CEPH_STAT_CAP_NLINK CEPH_CAP_LINK_SHARED
539 #define CEPH_STAT_CAP_LAYOUT CEPH_CAP_FILE_SHARED
540 #define CEPH_STAT_CAP_MTIME CEPH_CAP_FILE_SHARED
541 #define CEPH_STAT_CAP_SIZE CEPH_CAP_FILE_SHARED
542 #define CEPH_STAT_CAP_ATIME CEPH_CAP_FILE_SHARED /* fixme */
543 #define CEPH_STAT_CAP_XATTR CEPH_CAP_XATTR_SHARED
544 #define CEPH_STAT_CAP_INODE_ALL (CEPH_CAP_PIN | \
545 CEPH_CAP_AUTH_SHARED | \
546 CEPH_CAP_LINK_SHARED | \
547 CEPH_CAP_FILE_SHARED | \
548 CEPH_CAP_XATTR_SHARED)
550 #define CEPH_CAP_ANY_SHARED (CEPH_CAP_AUTH_SHARED | \
551 CEPH_CAP_LINK_SHARED | \
552 CEPH_CAP_XATTR_SHARED | \
553 CEPH_CAP_FILE_SHARED)
554 #define CEPH_CAP_ANY_RD (CEPH_CAP_ANY_SHARED | CEPH_CAP_FILE_RD | \
557 #define CEPH_CAP_ANY_EXCL (CEPH_CAP_AUTH_EXCL | \
558 CEPH_CAP_LINK_EXCL | \
559 CEPH_CAP_XATTR_EXCL | \
561 #define CEPH_CAP_ANY_FILE_WR (CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER | \
563 #define CEPH_CAP_ANY_WR (CEPH_CAP_ANY_EXCL | CEPH_CAP_ANY_FILE_WR)
564 #define CEPH_CAP_ANY (CEPH_CAP_ANY_RD | CEPH_CAP_ANY_EXCL | \
565 CEPH_CAP_ANY_FILE_WR | CEPH_CAP_PIN)
567 #define CEPH_CAP_LOCKS (CEPH_LOCK_IFILE | CEPH_LOCK_IAUTH | CEPH_LOCK_ILINK | \
570 int ceph_caps_for_mode(int mode
);
573 CEPH_CAP_OP_GRANT
, /* mds->client grant */
574 CEPH_CAP_OP_REVOKE
, /* mds->client revoke */
575 CEPH_CAP_OP_TRUNC
, /* mds->client trunc notify */
576 CEPH_CAP_OP_EXPORT
, /* mds has exported the cap */
577 CEPH_CAP_OP_IMPORT
, /* mds has imported the cap */
578 CEPH_CAP_OP_UPDATE
, /* client->mds update */
579 CEPH_CAP_OP_DROP
, /* client->mds drop cap bits */
580 CEPH_CAP_OP_FLUSH
, /* client->mds cap writeback */
581 CEPH_CAP_OP_FLUSH_ACK
, /* mds->client flushed */
582 CEPH_CAP_OP_FLUSHSNAP
, /* client->mds flush snapped metadata */
583 CEPH_CAP_OP_FLUSHSNAP_ACK
, /* mds->client flushed snapped metadata */
584 CEPH_CAP_OP_RELEASE
, /* client->mds release (clean) cap */
585 CEPH_CAP_OP_RENEW
, /* client->mds renewal request */
588 extern const char *ceph_cap_op_name(int op
);
591 * caps message, used for capability callbacks, acks, requests, etc.
593 struct ceph_mds_caps
{
594 __le32 op
; /* CEPH_CAP_OP_* */
597 __le32 seq
, issue_seq
;
598 __le32 caps
, wanted
, dirty
; /* latest issued/wanted/dirty */
601 __le32 snap_trace_len
;
604 __le32 uid
, gid
, mode
;
611 __le64 xattr_version
;
614 __le64 size
, max_size
, truncate_size
;
616 struct ceph_timespec mtime
, atime
, ctime
;
617 struct ceph_file_layout layout
;
618 __le32 time_warp_seq
;
619 } __attribute__ ((packed
));
621 /* cap release msg head */
622 struct ceph_mds_cap_release
{
623 __le32 num
; /* number of cap_items that follow */
624 } __attribute__ ((packed
));
626 struct ceph_mds_cap_item
{
629 __le32 migrate_seq
, seq
;
630 } __attribute__ ((packed
));
632 #define CEPH_MDS_LEASE_REVOKE 1 /* mds -> client */
633 #define CEPH_MDS_LEASE_RELEASE 2 /* client -> mds */
634 #define CEPH_MDS_LEASE_RENEW 3 /* client <-> mds */
635 #define CEPH_MDS_LEASE_REVOKE_ACK 4 /* client -> mds */
637 extern const char *ceph_lease_op_name(int o
);
639 /* lease msg header */
640 struct ceph_mds_lease
{
641 __u8 action
; /* CEPH_MDS_LEASE_* */
642 __le16 mask
; /* which lease */
644 __le64 first
, last
; /* snap range */
646 __le32 duration_ms
; /* duration of renewal */
647 } __attribute__ ((packed
));
648 /* followed by a __le32+string for dname */
650 /* client reconnect */
651 struct ceph_mds_cap_reconnect
{
656 struct ceph_timespec mtime
, atime
;
658 __le64 pathbase
; /* base ino for our path to this ino */
659 } __attribute__ ((packed
));
660 /* followed by encoded string */
662 struct ceph_mds_snaprealm_reconnect
{
663 __le64 ino
; /* snap realm base */
664 __le64 seq
; /* snap seq for this snap realm */
665 __le64 parent
; /* parent realm */
666 } __attribute__ ((packed
));
672 CEPH_SNAP_OP_UPDATE
, /* CREATE or DESTROY */
674 CEPH_SNAP_OP_DESTROY
,
678 extern const char *ceph_snap_op_name(int o
);
680 /* snap msg header */
681 struct ceph_mds_snap_head
{
682 __le32 op
; /* CEPH_SNAP_OP_* */
683 __le64 split
; /* ino to split off, if any */
684 __le32 num_split_inos
; /* # inos belonging to new child realm */
685 __le32 num_split_realms
; /* # child realms udner new child realm */
686 __le32 trace_len
; /* size of snap trace blob */
687 } __attribute__ ((packed
));
688 /* followed by split ino list, then split realms, then the trace blob */
691 * encode info about a snaprealm, as viewed by a client
693 struct ceph_mds_snap_realm
{
694 __le64 ino
; /* ino */
695 __le64 created
; /* snap: when created */
696 __le64 parent
; /* ino: parent realm */
697 __le64 parent_since
; /* snap: same parent since */
698 __le64 seq
; /* snap: version */
700 __le32 num_prior_parent_snaps
;
701 } __attribute__ ((packed
));
702 /* followed by my snap list, then prior parent snap list */