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.
15 #include <linux/ceph/msgr.h>
16 #include <linux/ceph/rados.h>
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.
24 #define CEPH_OSDC_PROTOCOL 24 /* server/client */
25 #define CEPH_MDSC_PROTOCOL 32 /* server/client */
26 #define CEPH_MONC_PROTOCOL 15 /* server/client */
29 #define CEPH_INO_ROOT 1
30 #define CEPH_INO_CEPH 2 /* hidden .ceph dir */
31 #define CEPH_INO_DOTDOT 3 /* used by ceph fuse for parent (..) */
33 /* arbitrary limit on max # of monitors (cluster of 3 is typical) */
34 #define CEPH_MAX_MON 31
37 * legacy ceph_file_layoute
39 struct ceph_file_layout_legacy
{
40 /* file -> object mapping */
41 __le32 fl_stripe_unit
; /* stripe unit, in bytes. must be multiple
43 __le32 fl_stripe_count
; /* over this many objects */
44 __le32 fl_object_size
; /* until objects are this big, then move to
46 __le32 fl_cas_hash
; /* UNUSED. 0 = none; 1 = sha256 */
48 /* pg -> disk layout */
49 __le32 fl_object_stripe_unit
; /* UNUSED. for per-object parity, if any */
51 /* object -> pg layout */
52 __le32 fl_unused
; /* unused; used to be preferred primary for pg (-1 for none) */
53 __le32 fl_pg_pool
; /* namespace, crush ruleset, rep level */
54 } __attribute__ ((packed
));
58 * ceph_file_layout - describe data layout for a file/inode
60 struct ceph_file_layout
{
61 /* file -> object mapping */
62 u32 stripe_unit
; /* stripe unit, in bytes */
63 u32 stripe_count
; /* over this many objects */
64 u32 object_size
; /* until objects are this big */
65 s64 pool_id
; /* rados pool id */
66 struct ceph_string __rcu
*pool_ns
; /* rados pool namespace */
69 extern int ceph_file_layout_is_valid(const struct ceph_file_layout
*layout
);
70 extern void ceph_file_layout_from_legacy(struct ceph_file_layout
*fl
,
71 struct ceph_file_layout_legacy
*legacy
);
72 extern void ceph_file_layout_to_legacy(struct ceph_file_layout
*fl
,
73 struct ceph_file_layout_legacy
*legacy
);
75 #define CEPH_MIN_STRIPE_UNIT 65536
77 struct ceph_dir_layout
{
78 __u8 dl_dir_hash
; /* see ceph_hash.h for ids */
82 } __attribute__ ((packed
));
84 /* crypto algorithms */
85 #define CEPH_CRYPTO_NONE 0x0
86 #define CEPH_CRYPTO_AES 0x1
88 #define CEPH_AES_IV "cephsageyudagreg"
90 /* security/authentication protocols */
91 #define CEPH_AUTH_UNKNOWN 0x0
92 #define CEPH_AUTH_NONE 0x1
93 #define CEPH_AUTH_CEPHX 0x2
95 #define CEPH_AUTH_UID_DEFAULT ((__u64) -1)
98 /*********************************************
107 #define CEPH_MSG_SHUTDOWN 1
108 #define CEPH_MSG_PING 2
110 /* client <-> monitor */
111 #define CEPH_MSG_MON_MAP 4
112 #define CEPH_MSG_MON_GET_MAP 5
113 #define CEPH_MSG_STATFS 13
114 #define CEPH_MSG_STATFS_REPLY 14
115 #define CEPH_MSG_MON_SUBSCRIBE 15
116 #define CEPH_MSG_MON_SUBSCRIBE_ACK 16
117 #define CEPH_MSG_AUTH 17
118 #define CEPH_MSG_AUTH_REPLY 18
119 #define CEPH_MSG_MON_GET_VERSION 19
120 #define CEPH_MSG_MON_GET_VERSION_REPLY 20
123 #define CEPH_MSG_MDS_MAP 21
124 #define CEPH_MSG_FS_MAP_USER 103
126 #define CEPH_MSG_CLIENT_SESSION 22
127 #define CEPH_MSG_CLIENT_RECONNECT 23
129 #define CEPH_MSG_CLIENT_REQUEST 24
130 #define CEPH_MSG_CLIENT_REQUEST_FORWARD 25
131 #define CEPH_MSG_CLIENT_REPLY 26
132 #define CEPH_MSG_CLIENT_CAPS 0x310
133 #define CEPH_MSG_CLIENT_LEASE 0x311
134 #define CEPH_MSG_CLIENT_SNAP 0x312
135 #define CEPH_MSG_CLIENT_CAPRELEASE 0x313
138 #define CEPH_MSG_POOLOP_REPLY 48
139 #define CEPH_MSG_POOLOP 49
142 #define CEPH_MSG_MON_COMMAND 50
143 #define CEPH_MSG_MON_COMMAND_ACK 51
146 #define CEPH_MSG_OSD_MAP 41
147 #define CEPH_MSG_OSD_OP 42
148 #define CEPH_MSG_OSD_OPREPLY 43
149 #define CEPH_MSG_WATCH_NOTIFY 44
152 /* watch-notify operations */
154 CEPH_WATCH_EVENT_NOTIFY
= 1, /* notifying watcher */
155 CEPH_WATCH_EVENT_NOTIFY_COMPLETE
= 2, /* notifier notified when done */
156 CEPH_WATCH_EVENT_DISCONNECT
= 3, /* we were disconnected */
160 struct ceph_mon_request_header
{
163 __le64 session_mon_tid
;
164 } __attribute__ ((packed
));
166 struct ceph_mon_statfs
{
167 struct ceph_mon_request_header monhdr
;
168 struct ceph_fsid fsid
;
169 } __attribute__ ((packed
));
172 __le64 kb
, kb_used
, kb_avail
;
174 } __attribute__ ((packed
));
176 struct ceph_mon_statfs_reply
{
177 struct ceph_fsid fsid
;
179 struct ceph_statfs st
;
180 } __attribute__ ((packed
));
182 struct ceph_mon_command
{
183 struct ceph_mon_request_header monhdr
;
184 struct ceph_fsid fsid
;
185 __le32 num_strs
; /* always 1 */
188 } __attribute__ ((packed
));
190 struct ceph_osd_getmap
{
191 struct ceph_mon_request_header monhdr
;
192 struct ceph_fsid fsid
;
194 } __attribute__ ((packed
));
196 struct ceph_mds_getmap
{
197 struct ceph_mon_request_header monhdr
;
198 struct ceph_fsid fsid
;
199 } __attribute__ ((packed
));
201 struct ceph_client_mount
{
202 struct ceph_mon_request_header monhdr
;
203 } __attribute__ ((packed
));
205 #define CEPH_SUBSCRIBE_ONETIME 1 /* i want only 1 update after have */
207 struct ceph_mon_subscribe_item
{
210 } __attribute__ ((packed
));
212 struct ceph_mon_subscribe_ack
{
213 __le32 duration
; /* seconds */
214 struct ceph_fsid fsid
;
215 } __attribute__ ((packed
));
217 #define CEPH_FS_CLUSTER_ID_NONE -1
222 #define CEPH_MDSMAP_DOWN (1<<0) /* cluster deliberately down */
229 #define CEPH_MDS_STATE_DNE 0 /* down, does not exist. */
230 #define CEPH_MDS_STATE_STOPPED -1 /* down, once existed, but no subtrees.
232 #define CEPH_MDS_STATE_BOOT -4 /* up, boot announcement. */
233 #define CEPH_MDS_STATE_STANDBY -5 /* up, idle. waiting for assignment. */
234 #define CEPH_MDS_STATE_CREATING -6 /* up, creating MDS instance. */
235 #define CEPH_MDS_STATE_STARTING -7 /* up, starting previously stopped mds */
236 #define CEPH_MDS_STATE_STANDBY_REPLAY -8 /* up, tailing active node's journal */
237 #define CEPH_MDS_STATE_REPLAYONCE -9 /* up, replaying an active node's journal */
239 #define CEPH_MDS_STATE_REPLAY 8 /* up, replaying journal. */
240 #define CEPH_MDS_STATE_RESOLVE 9 /* up, disambiguating distributed
241 operations (import, rename, etc.) */
242 #define CEPH_MDS_STATE_RECONNECT 10 /* up, reconnect to clients */
243 #define CEPH_MDS_STATE_REJOIN 11 /* up, rejoining distributed cache */
244 #define CEPH_MDS_STATE_CLIENTREPLAY 12 /* up, replaying client operations */
245 #define CEPH_MDS_STATE_ACTIVE 13 /* up, active */
246 #define CEPH_MDS_STATE_STOPPING 14 /* up, but exporting metadata */
248 extern const char *ceph_mds_state_name(int s
);
252 * metadata lock types.
253 * - these are bitmasks.. we can compose them
254 * - they also define the lock ordering by the MDS
255 * - a few of these are internal to the mds
257 #define CEPH_LOCK_DVERSION 1
258 #define CEPH_LOCK_DN 2
259 #define CEPH_LOCK_ISNAP 16
260 #define CEPH_LOCK_IVERSION 32 /* mds internal */
261 #define CEPH_LOCK_IFILE 64
262 #define CEPH_LOCK_IAUTH 128
263 #define CEPH_LOCK_ILINK 256
264 #define CEPH_LOCK_IDFT 512 /* dir frag tree */
265 #define CEPH_LOCK_INEST 1024 /* mds internal */
266 #define CEPH_LOCK_IXATTR 2048
267 #define CEPH_LOCK_IFLOCK 4096 /* advisory file locks */
268 #define CEPH_LOCK_INO 8192 /* immutable inode bits; not a lock */
269 #define CEPH_LOCK_IPOLICY 16384 /* policy lock on dirs. MDS internal */
271 /* client_session ops */
273 CEPH_SESSION_REQUEST_OPEN
,
275 CEPH_SESSION_REQUEST_CLOSE
,
277 CEPH_SESSION_REQUEST_RENEWCAPS
,
278 CEPH_SESSION_RENEWCAPS
,
280 CEPH_SESSION_RECALL_STATE
,
281 CEPH_SESSION_FLUSHMSG
,
282 CEPH_SESSION_FLUSHMSG_ACK
,
283 CEPH_SESSION_FORCE_RO
,
286 extern const char *ceph_session_op_name(int op
);
288 struct ceph_mds_session_head
{
291 struct ceph_timespec stamp
;
292 __le32 max_caps
, max_leases
;
293 } __attribute__ ((packed
));
298 * & 0x001000 -> write op
299 * & 0x010000 -> follow symlink (e.g. stat(), not lstat()).
300 & & 0x100000 -> use weird ino/path trace
302 #define CEPH_MDS_OP_WRITE 0x001000
304 CEPH_MDS_OP_LOOKUP
= 0x00100,
305 CEPH_MDS_OP_GETATTR
= 0x00101,
306 CEPH_MDS_OP_LOOKUPHASH
= 0x00102,
307 CEPH_MDS_OP_LOOKUPPARENT
= 0x00103,
308 CEPH_MDS_OP_LOOKUPINO
= 0x00104,
309 CEPH_MDS_OP_LOOKUPNAME
= 0x00105,
311 CEPH_MDS_OP_SETXATTR
= 0x01105,
312 CEPH_MDS_OP_RMXATTR
= 0x01106,
313 CEPH_MDS_OP_SETLAYOUT
= 0x01107,
314 CEPH_MDS_OP_SETATTR
= 0x01108,
315 CEPH_MDS_OP_SETFILELOCK
= 0x01109,
316 CEPH_MDS_OP_GETFILELOCK
= 0x00110,
317 CEPH_MDS_OP_SETDIRLAYOUT
=0x0110a,
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,
335 CEPH_MDS_OP_RENAMESNAP
= 0x01403,
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
350 * Ceph setxattr request flags.
352 #define CEPH_XATTR_CREATE (1 << 0)
353 #define CEPH_XATTR_REPLACE (1 << 1)
354 #define CEPH_XATTR_REMOVE (1 << 31)
357 * readdir request flags;
359 #define CEPH_READDIR_REPLY_BITFLAGS (1<<0)
362 * readdir reply flags.
364 #define CEPH_READDIR_FRAG_END (1<<0)
365 #define CEPH_READDIR_FRAG_COMPLETE (1<<8)
366 #define CEPH_READDIR_HASH_ORDER (1<<9)
368 union ceph_mds_request_args
{
370 __le32 mask
; /* CEPH_CAP_* */
371 } __attribute__ ((packed
)) getattr
;
376 struct ceph_timespec mtime
;
377 struct ceph_timespec atime
;
378 __le64 size
, old_size
; /* old_size needed by truncate */
379 __le32 mask
; /* CEPH_SETATTR_* */
380 } __attribute__ ((packed
)) setattr
;
382 __le32 frag
; /* which dir fragment */
383 __le32 max_entries
; /* how many dentries to grab */
386 } __attribute__ ((packed
)) readdir
;
390 } __attribute__ ((packed
)) mknod
;
393 } __attribute__ ((packed
)) mkdir
;
397 __le32 stripe_unit
; /* layout for newly created file */
398 __le32 stripe_count
; /* ... */
400 __le32 file_replication
;
401 __le32 mask
; /* CEPH_CAP_* */
403 } __attribute__ ((packed
)) open
;
406 } __attribute__ ((packed
)) setxattr
;
408 struct ceph_file_layout_legacy layout
;
409 } __attribute__ ((packed
)) setlayout
;
411 __u8 rule
; /* currently fcntl or flock */
412 __u8 type
; /* shared, exclusive, remove*/
413 __le64 owner
; /* owner of the lock */
414 __le64 pid
; /* process id requesting the lock */
415 __le64 start
; /* initial location to lock */
416 __le64 length
; /* num bytes to lock from start */
417 __u8 wait
; /* will caller wait for lock to become available? */
418 } __attribute__ ((packed
)) filelock_change
;
419 } __attribute__ ((packed
));
421 #define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */
422 #define CEPH_MDS_FLAG_WANT_DENTRY 2 /* want dentry in reply */
424 struct ceph_mds_request_head
{
425 __le64 oldest_client_tid
;
426 __le32 mdsmap_epoch
; /* on client */
427 __le32 flags
; /* CEPH_MDS_FLAG_* */
428 __u8 num_retry
, num_fwd
; /* count retry, fwd attempts */
429 __le16 num_releases
; /* # include cap/lease release records */
430 __le32 op
; /* mds op code */
431 __le32 caller_uid
, caller_gid
;
432 __le64 ino
; /* use this ino for openc, mkdir, mknod,
433 etc. (if replaying) */
434 union ceph_mds_request_args args
;
435 } __attribute__ ((packed
));
437 /* cap/lease release record */
438 struct ceph_mds_request_release
{
439 __le64 ino
, cap_id
; /* ino and unique cap id */
440 __le32 caps
, wanted
; /* new issued, wanted */
441 __le32 seq
, issue_seq
, mseq
;
442 __le32 dname_seq
; /* if releasing a dentry lease, a */
443 __le32 dname_len
; /* string follows. */
444 } __attribute__ ((packed
));
447 struct ceph_mds_reply_head
{
451 __u8 safe
; /* true if committed to disk */
452 __u8 is_dentry
, is_target
; /* true if dentry, target inode records
453 are included with reply */
454 } __attribute__ ((packed
));
456 /* one for each node split */
457 struct ceph_frag_tree_split
{
458 __le32 frag
; /* this frag splits... */
459 __le32 by
; /* ...by this many bits */
460 } __attribute__ ((packed
));
462 struct ceph_frag_tree_head
{
463 __le32 nsplits
; /* num ceph_frag_tree_split records */
464 struct ceph_frag_tree_split splits
[];
465 } __attribute__ ((packed
));
467 /* capability issue, for bundling with mds reply */
468 struct ceph_mds_reply_cap
{
469 __le32 caps
, wanted
; /* caps issued, wanted */
472 __le64 realm
; /* snap realm */
473 __u8 flags
; /* CEPH_CAP_FLAG_* */
474 } __attribute__ ((packed
));
476 #define CEPH_CAP_FLAG_AUTH (1 << 0) /* cap is issued by auth mds */
477 #define CEPH_CAP_FLAG_RELEASE (1 << 1) /* release the cap */
479 /* inode record, for bundling with mds reply */
480 struct ceph_mds_reply_inode
{
484 __le64 version
; /* inode version */
485 __le64 xattr_version
; /* version for xattr blob */
486 struct ceph_mds_reply_cap cap
; /* caps issued for this inode */
487 struct ceph_file_layout_legacy layout
;
488 struct ceph_timespec ctime
, mtime
, atime
;
489 __le32 time_warp_seq
;
490 __le64 size
, max_size
, truncate_size
;
492 __le32 mode
, uid
, gid
;
494 __le64 files
, subdirs
, rbytes
, rfiles
, rsubdirs
; /* dir stats */
495 struct ceph_timespec rctime
;
496 struct ceph_frag_tree_head fragtree
; /* (must be at end of struct) */
497 } __attribute__ ((packed
));
498 /* followed by frag array, symlink string, dir layout, xattr blob */
500 /* reply_lease follows dname, and reply_inode */
501 struct ceph_mds_reply_lease
{
502 __le16 mask
; /* lease type(s) */
503 __le32 duration_ms
; /* lease duration */
505 } __attribute__ ((packed
));
507 struct ceph_mds_reply_dirfrag
{
508 __le32 frag
; /* fragment */
509 __le32 auth
; /* auth mds, if this is a delegation point */
510 __le32 ndist
; /* number of mds' this is replicated on */
512 } __attribute__ ((packed
));
514 #define CEPH_LOCK_FCNTL 1
515 #define CEPH_LOCK_FLOCK 2
516 #define CEPH_LOCK_FCNTL_INTR 3
517 #define CEPH_LOCK_FLOCK_INTR 4
520 #define CEPH_LOCK_SHARED 1
521 #define CEPH_LOCK_EXCL 2
522 #define CEPH_LOCK_UNLOCK 4
524 struct ceph_filelock
{
525 __le64 start
;/* file offset to start lock at */
526 __le64 length
; /* num bytes to lock; 0 for all following start */
527 __le64 client
; /* which client holds the lock */
528 __le64 owner
; /* owner the lock */
529 __le64 pid
; /* process id holding the lock on the client */
530 __u8 type
; /* shared lock, exclusive lock, or unlock */
531 } __attribute__ ((packed
));
534 /* file access modes */
535 #define CEPH_FILE_MODE_PIN 0
536 #define CEPH_FILE_MODE_RD 1
537 #define CEPH_FILE_MODE_WR 2
538 #define CEPH_FILE_MODE_RDWR 3 /* RD | WR */
539 #define CEPH_FILE_MODE_LAZY 4 /* lazy io */
540 #define CEPH_FILE_MODE_BITS 4
542 int ceph_flags_to_mode(int flags
);
544 #define CEPH_INLINE_NONE ((__u64)-1)
546 /* capability bits */
547 #define CEPH_CAP_PIN 1 /* no specific capabilities beyond the pin */
549 /* generic cap bits */
550 #define CEPH_CAP_GSHARED 1 /* client can reads */
551 #define CEPH_CAP_GEXCL 2 /* client can read and update */
552 #define CEPH_CAP_GCACHE 4 /* (file) client can cache reads */
553 #define CEPH_CAP_GRD 8 /* (file) client can read */
554 #define CEPH_CAP_GWR 16 /* (file) client can write */
555 #define CEPH_CAP_GBUFFER 32 /* (file) client can buffer writes */
556 #define CEPH_CAP_GWREXTEND 64 /* (file) client can extend EOF */
557 #define CEPH_CAP_GLAZYIO 128 /* (file) client can perform lazy io */
559 #define CEPH_CAP_SIMPLE_BITS 2
560 #define CEPH_CAP_FILE_BITS 8
563 #define CEPH_CAP_SAUTH 2
564 #define CEPH_CAP_SLINK 4
565 #define CEPH_CAP_SXATTR 6
566 #define CEPH_CAP_SFILE 8
567 #define CEPH_CAP_SFLOCK 20
569 #define CEPH_CAP_BITS 22
571 /* composed values */
572 #define CEPH_CAP_AUTH_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SAUTH)
573 #define CEPH_CAP_AUTH_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SAUTH)
574 #define CEPH_CAP_LINK_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SLINK)
575 #define CEPH_CAP_LINK_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SLINK)
576 #define CEPH_CAP_XATTR_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SXATTR)
577 #define CEPH_CAP_XATTR_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SXATTR)
578 #define CEPH_CAP_FILE(x) (x << CEPH_CAP_SFILE)
579 #define CEPH_CAP_FILE_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SFILE)
580 #define CEPH_CAP_FILE_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SFILE)
581 #define CEPH_CAP_FILE_CACHE (CEPH_CAP_GCACHE << CEPH_CAP_SFILE)
582 #define CEPH_CAP_FILE_RD (CEPH_CAP_GRD << CEPH_CAP_SFILE)
583 #define CEPH_CAP_FILE_WR (CEPH_CAP_GWR << CEPH_CAP_SFILE)
584 #define CEPH_CAP_FILE_BUFFER (CEPH_CAP_GBUFFER << CEPH_CAP_SFILE)
585 #define CEPH_CAP_FILE_WREXTEND (CEPH_CAP_GWREXTEND << CEPH_CAP_SFILE)
586 #define CEPH_CAP_FILE_LAZYIO (CEPH_CAP_GLAZYIO << CEPH_CAP_SFILE)
587 #define CEPH_CAP_FLOCK_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SFLOCK)
588 #define CEPH_CAP_FLOCK_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SFLOCK)
591 /* cap masks (for getattr) */
592 #define CEPH_STAT_CAP_INODE CEPH_CAP_PIN
593 #define CEPH_STAT_CAP_TYPE CEPH_CAP_PIN /* mode >> 12 */
594 #define CEPH_STAT_CAP_SYMLINK CEPH_CAP_PIN
595 #define CEPH_STAT_CAP_UID CEPH_CAP_AUTH_SHARED
596 #define CEPH_STAT_CAP_GID CEPH_CAP_AUTH_SHARED
597 #define CEPH_STAT_CAP_MODE CEPH_CAP_AUTH_SHARED
598 #define CEPH_STAT_CAP_NLINK CEPH_CAP_LINK_SHARED
599 #define CEPH_STAT_CAP_LAYOUT CEPH_CAP_FILE_SHARED
600 #define CEPH_STAT_CAP_MTIME CEPH_CAP_FILE_SHARED
601 #define CEPH_STAT_CAP_SIZE CEPH_CAP_FILE_SHARED
602 #define CEPH_STAT_CAP_ATIME CEPH_CAP_FILE_SHARED /* fixme */
603 #define CEPH_STAT_CAP_XATTR CEPH_CAP_XATTR_SHARED
604 #define CEPH_STAT_CAP_INODE_ALL (CEPH_CAP_PIN | \
605 CEPH_CAP_AUTH_SHARED | \
606 CEPH_CAP_LINK_SHARED | \
607 CEPH_CAP_FILE_SHARED | \
608 CEPH_CAP_XATTR_SHARED)
609 #define CEPH_STAT_CAP_INLINE_DATA (CEPH_CAP_FILE_SHARED | \
612 #define CEPH_CAP_ANY_SHARED (CEPH_CAP_AUTH_SHARED | \
613 CEPH_CAP_LINK_SHARED | \
614 CEPH_CAP_XATTR_SHARED | \
615 CEPH_CAP_FILE_SHARED)
616 #define CEPH_CAP_ANY_RD (CEPH_CAP_ANY_SHARED | CEPH_CAP_FILE_RD | \
619 #define CEPH_CAP_ANY_EXCL (CEPH_CAP_AUTH_EXCL | \
620 CEPH_CAP_LINK_EXCL | \
621 CEPH_CAP_XATTR_EXCL | \
623 #define CEPH_CAP_ANY_FILE_RD (CEPH_CAP_FILE_RD | CEPH_CAP_FILE_CACHE | \
624 CEPH_CAP_FILE_SHARED)
625 #define CEPH_CAP_ANY_FILE_WR (CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER | \
627 #define CEPH_CAP_ANY_WR (CEPH_CAP_ANY_EXCL | CEPH_CAP_ANY_FILE_WR)
628 #define CEPH_CAP_ANY (CEPH_CAP_ANY_RD | CEPH_CAP_ANY_EXCL | \
629 CEPH_CAP_ANY_FILE_WR | CEPH_CAP_FILE_LAZYIO | \
632 #define CEPH_CAP_LOCKS (CEPH_LOCK_IFILE | CEPH_LOCK_IAUTH | CEPH_LOCK_ILINK | \
635 int ceph_caps_for_mode(int mode
);
638 CEPH_CAP_OP_GRANT
, /* mds->client grant */
639 CEPH_CAP_OP_REVOKE
, /* mds->client revoke */
640 CEPH_CAP_OP_TRUNC
, /* mds->client trunc notify */
641 CEPH_CAP_OP_EXPORT
, /* mds has exported the cap */
642 CEPH_CAP_OP_IMPORT
, /* mds has imported the cap */
643 CEPH_CAP_OP_UPDATE
, /* client->mds update */
644 CEPH_CAP_OP_DROP
, /* client->mds drop cap bits */
645 CEPH_CAP_OP_FLUSH
, /* client->mds cap writeback */
646 CEPH_CAP_OP_FLUSH_ACK
, /* mds->client flushed */
647 CEPH_CAP_OP_FLUSHSNAP
, /* client->mds flush snapped metadata */
648 CEPH_CAP_OP_FLUSHSNAP_ACK
, /* mds->client flushed snapped metadata */
649 CEPH_CAP_OP_RELEASE
, /* client->mds release (clean) cap */
650 CEPH_CAP_OP_RENEW
, /* client->mds renewal request */
653 extern const char *ceph_cap_op_name(int op
);
656 * caps message, used for capability callbacks, acks, requests, etc.
658 struct ceph_mds_caps
{
659 __le32 op
; /* CEPH_CAP_OP_* */
662 __le32 seq
, issue_seq
;
663 __le32 caps
, wanted
, dirty
; /* latest issued/wanted/dirty */
666 __le32 snap_trace_len
;
669 __le32 uid
, gid
, mode
;
676 __le64 xattr_version
;
679 __le64 size
, max_size
, truncate_size
;
681 struct ceph_timespec mtime
, atime
, ctime
;
682 struct ceph_file_layout_legacy layout
;
683 __le32 time_warp_seq
;
684 } __attribute__ ((packed
));
686 struct ceph_mds_cap_peer
{
692 } __attribute__ ((packed
));
694 /* cap release msg head */
695 struct ceph_mds_cap_release
{
696 __le32 num
; /* number of cap_items that follow */
697 } __attribute__ ((packed
));
699 struct ceph_mds_cap_item
{
702 __le32 migrate_seq
, seq
;
703 } __attribute__ ((packed
));
705 #define CEPH_MDS_LEASE_REVOKE 1 /* mds -> client */
706 #define CEPH_MDS_LEASE_RELEASE 2 /* client -> mds */
707 #define CEPH_MDS_LEASE_RENEW 3 /* client <-> mds */
708 #define CEPH_MDS_LEASE_REVOKE_ACK 4 /* client -> mds */
710 extern const char *ceph_lease_op_name(int o
);
712 /* lease msg header */
713 struct ceph_mds_lease
{
714 __u8 action
; /* CEPH_MDS_LEASE_* */
715 __le16 mask
; /* which lease */
717 __le64 first
, last
; /* snap range */
719 __le32 duration_ms
; /* duration of renewal */
720 } __attribute__ ((packed
));
721 /* followed by a __le32+string for dname */
723 /* client reconnect */
724 struct ceph_mds_cap_reconnect
{
729 __le64 pathbase
; /* base ino for our path to this ino */
730 __le32 flock_len
; /* size of flock state blob, if any */
731 } __attribute__ ((packed
));
732 /* followed by flock blob */
734 struct ceph_mds_cap_reconnect_v1
{
739 struct ceph_timespec mtime
, atime
;
741 __le64 pathbase
; /* base ino for our path to this ino */
742 } __attribute__ ((packed
));
744 struct ceph_mds_snaprealm_reconnect
{
745 __le64 ino
; /* snap realm base */
746 __le64 seq
; /* snap seq for this snap realm */
747 __le64 parent
; /* parent realm */
748 } __attribute__ ((packed
));
754 CEPH_SNAP_OP_UPDATE
, /* CREATE or DESTROY */
756 CEPH_SNAP_OP_DESTROY
,
760 extern const char *ceph_snap_op_name(int o
);
762 /* snap msg header */
763 struct ceph_mds_snap_head
{
764 __le32 op
; /* CEPH_SNAP_OP_* */
765 __le64 split
; /* ino to split off, if any */
766 __le32 num_split_inos
; /* # inos belonging to new child realm */
767 __le32 num_split_realms
; /* # child realms udner new child realm */
768 __le32 trace_len
; /* size of snap trace blob */
769 } __attribute__ ((packed
));
770 /* followed by split ino list, then split realms, then the trace blob */
773 * encode info about a snaprealm, as viewed by a client
775 struct ceph_mds_snap_realm
{
776 __le64 ino
; /* ino */
777 __le64 created
; /* snap: when created */
778 __le64 parent
; /* ino: parent realm */
779 __le64 parent_since
; /* snap: same parent since */
780 __le64 seq
; /* snap: version */
782 __le32 num_prior_parent_snaps
;
783 } __attribute__ ((packed
));
784 /* followed by my snap list, then prior parent snap list */