Remove dead CONFIG_SIBYTE_BCM1480_PROF
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / fs / ceph / ceph_fs.h
blob0c2241ef3653242657fc56a8c9cd7c49ea89af7b
1 /*
2 * ceph_fs.h - Ceph constants and data types to share between kernel and
3 * user space.
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.
9 * LGPL2
12 #ifndef _FS_CEPH_CEPH_FS_H
13 #define _FS_CEPH_CEPH_FS_H
15 #include "msgr.h"
16 #include "rados.h"
19 * Ceph release version
21 #define CEPH_VERSION_MAJOR 0
22 #define CEPH_VERSION_MINOR 19
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) \
28 "." CEPH_STRINGIFY(z)
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 9 /* 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
54 * feature bits
56 #define CEPH_FEATURE_SUPPORTED 0
57 #define CEPH_FEATURE_REQUIRED 0
61 * ceph_file_layout - describe data layout for a file/inode
63 struct ceph_file_layout {
64 /* file -> object mapping */
65 __le32 fl_stripe_unit; /* stripe unit, in bytes. must be multiple
66 of page size. */
67 __le32 fl_stripe_count; /* over this many objects */
68 __le32 fl_object_size; /* until objects are this big, then move to
69 new objects */
70 __le32 fl_cas_hash; /* 0 = none; 1 = sha256 */
72 /* pg -> disk layout */
73 __le32 fl_object_stripe_unit; /* for per-object parity, if any */
75 /* object -> pg layout */
76 __le32 fl_pg_preferred; /* preferred primary for pg (-1 for none) */
77 __le32 fl_pg_pool; /* namespace, crush ruleset, rep level */
78 } __attribute__ ((packed));
80 #define CEPH_MIN_STRIPE_UNIT 65536
82 int ceph_file_layout_is_valid(const struct ceph_file_layout *layout);
85 /* crypto algorithms */
86 #define CEPH_CRYPTO_NONE 0x0
87 #define CEPH_CRYPTO_AES 0x1
89 /* security/authentication protocols */
90 #define CEPH_AUTH_UNKNOWN 0x0
91 #define CEPH_AUTH_NONE 0x1
92 #define CEPH_AUTH_CEPHX 0x2
95 /*********************************************
96 * message layer
100 * message types
103 /* misc */
104 #define CEPH_MSG_SHUTDOWN 1
105 #define CEPH_MSG_PING 2
107 /* client <-> monitor */
108 #define CEPH_MSG_MON_MAP 4
109 #define CEPH_MSG_MON_GET_MAP 5
110 #define CEPH_MSG_STATFS 13
111 #define CEPH_MSG_STATFS_REPLY 14
112 #define CEPH_MSG_MON_SUBSCRIBE 15
113 #define CEPH_MSG_MON_SUBSCRIBE_ACK 16
114 #define CEPH_MSG_AUTH 17
115 #define CEPH_MSG_AUTH_REPLY 18
117 /* client <-> mds */
118 #define CEPH_MSG_MDS_MAP 21
120 #define CEPH_MSG_CLIENT_SESSION 22
121 #define CEPH_MSG_CLIENT_RECONNECT 23
123 #define CEPH_MSG_CLIENT_REQUEST 24
124 #define CEPH_MSG_CLIENT_REQUEST_FORWARD 25
125 #define CEPH_MSG_CLIENT_REPLY 26
126 #define CEPH_MSG_CLIENT_CAPS 0x310
127 #define CEPH_MSG_CLIENT_LEASE 0x311
128 #define CEPH_MSG_CLIENT_SNAP 0x312
129 #define CEPH_MSG_CLIENT_CAPRELEASE 0x313
131 /* osd */
132 #define CEPH_MSG_OSD_MAP 41
133 #define CEPH_MSG_OSD_OP 42
134 #define CEPH_MSG_OSD_OPREPLY 43
136 struct ceph_mon_request_header {
137 __le64 have_version;
138 __le16 session_mon;
139 __le64 session_mon_tid;
140 } __attribute__ ((packed));
142 struct ceph_mon_statfs {
143 struct ceph_mon_request_header monhdr;
144 struct ceph_fsid fsid;
145 } __attribute__ ((packed));
147 struct ceph_statfs {
148 __le64 kb, kb_used, kb_avail;
149 __le64 num_objects;
150 } __attribute__ ((packed));
152 struct ceph_mon_statfs_reply {
153 struct ceph_fsid fsid;
154 __le64 version;
155 struct ceph_statfs st;
156 } __attribute__ ((packed));
158 struct ceph_osd_getmap {
159 struct ceph_mon_request_header monhdr;
160 struct ceph_fsid fsid;
161 __le32 start;
162 } __attribute__ ((packed));
164 struct ceph_mds_getmap {
165 struct ceph_mon_request_header monhdr;
166 struct ceph_fsid fsid;
167 } __attribute__ ((packed));
169 struct ceph_client_mount {
170 struct ceph_mon_request_header monhdr;
171 } __attribute__ ((packed));
173 struct ceph_mon_subscribe_item {
174 __le64 have_version; __le64 have;
175 __u8 onetime;
176 } __attribute__ ((packed));
178 struct ceph_mon_subscribe_ack {
179 __le32 duration; /* seconds */
180 struct ceph_fsid fsid;
181 } __attribute__ ((packed));
184 * mds states
185 * > 0 -> in
186 * <= 0 -> out
188 #define CEPH_MDS_STATE_DNE 0 /* down, does not exist. */
189 #define CEPH_MDS_STATE_STOPPED -1 /* down, once existed, but no subtrees.
190 empty log. */
191 #define CEPH_MDS_STATE_BOOT -4 /* up, boot announcement. */
192 #define CEPH_MDS_STATE_STANDBY -5 /* up, idle. waiting for assignment. */
193 #define CEPH_MDS_STATE_CREATING -6 /* up, creating MDS instance. */
194 #define CEPH_MDS_STATE_STARTING -7 /* up, starting previously stopped mds */
195 #define CEPH_MDS_STATE_STANDBY_REPLAY -8 /* up, tailing active node's journal */
197 #define CEPH_MDS_STATE_REPLAY 8 /* up, replaying journal. */
198 #define CEPH_MDS_STATE_RESOLVE 9 /* up, disambiguating distributed
199 operations (import, rename, etc.) */
200 #define CEPH_MDS_STATE_RECONNECT 10 /* up, reconnect to clients */
201 #define CEPH_MDS_STATE_REJOIN 11 /* up, rejoining distributed cache */
202 #define CEPH_MDS_STATE_CLIENTREPLAY 12 /* up, replaying client operations */
203 #define CEPH_MDS_STATE_ACTIVE 13 /* up, active */
204 #define CEPH_MDS_STATE_STOPPING 14 /* up, but exporting metadata */
206 extern const char *ceph_mds_state_name(int s);
210 * metadata lock types.
211 * - these are bitmasks.. we can compose them
212 * - they also define the lock ordering by the MDS
213 * - a few of these are internal to the mds
215 #define CEPH_LOCK_DN 1
216 #define CEPH_LOCK_ISNAP 2
217 #define CEPH_LOCK_IVERSION 4 /* mds internal */
218 #define CEPH_LOCK_IFILE 8 /* mds internal */
219 #define CEPH_LOCK_IAUTH 32
220 #define CEPH_LOCK_ILINK 64
221 #define CEPH_LOCK_IDFT 128 /* dir frag tree */
222 #define CEPH_LOCK_INEST 256 /* mds internal */
223 #define CEPH_LOCK_IXATTR 512
224 #define CEPH_LOCK_INO 2048 /* immutable inode bits; not a lock */
226 /* client_session ops */
227 enum {
228 CEPH_SESSION_REQUEST_OPEN,
229 CEPH_SESSION_OPEN,
230 CEPH_SESSION_REQUEST_CLOSE,
231 CEPH_SESSION_CLOSE,
232 CEPH_SESSION_REQUEST_RENEWCAPS,
233 CEPH_SESSION_RENEWCAPS,
234 CEPH_SESSION_STALE,
235 CEPH_SESSION_RECALL_STATE,
238 extern const char *ceph_session_op_name(int op);
240 struct ceph_mds_session_head {
241 __le32 op;
242 __le64 seq;
243 struct ceph_timespec stamp;
244 __le32 max_caps, max_leases;
245 } __attribute__ ((packed));
247 /* client_request */
249 * metadata ops.
250 * & 0x001000 -> write op
251 * & 0x010000 -> follow symlink (e.g. stat(), not lstat()).
252 & & 0x100000 -> use weird ino/path trace
254 #define CEPH_MDS_OP_WRITE 0x001000
255 enum {
256 CEPH_MDS_OP_LOOKUP = 0x00100,
257 CEPH_MDS_OP_GETATTR = 0x00101,
258 CEPH_MDS_OP_LOOKUPHASH = 0x00102,
259 CEPH_MDS_OP_LOOKUPPARENT = 0x00103,
261 CEPH_MDS_OP_SETXATTR = 0x01105,
262 CEPH_MDS_OP_RMXATTR = 0x01106,
263 CEPH_MDS_OP_SETLAYOUT = 0x01107,
264 CEPH_MDS_OP_SETATTR = 0x01108,
266 CEPH_MDS_OP_MKNOD = 0x01201,
267 CEPH_MDS_OP_LINK = 0x01202,
268 CEPH_MDS_OP_UNLINK = 0x01203,
269 CEPH_MDS_OP_RENAME = 0x01204,
270 CEPH_MDS_OP_MKDIR = 0x01220,
271 CEPH_MDS_OP_RMDIR = 0x01221,
272 CEPH_MDS_OP_SYMLINK = 0x01222,
274 CEPH_MDS_OP_CREATE = 0x01301,
275 CEPH_MDS_OP_OPEN = 0x00302,
276 CEPH_MDS_OP_READDIR = 0x00305,
278 CEPH_MDS_OP_LOOKUPSNAP = 0x00400,
279 CEPH_MDS_OP_MKSNAP = 0x01400,
280 CEPH_MDS_OP_RMSNAP = 0x01401,
281 CEPH_MDS_OP_LSSNAP = 0x00402,
284 extern const char *ceph_mds_op_name(int op);
287 #define CEPH_SETATTR_MODE 1
288 #define CEPH_SETATTR_UID 2
289 #define CEPH_SETATTR_GID 4
290 #define CEPH_SETATTR_MTIME 8
291 #define CEPH_SETATTR_ATIME 16
292 #define CEPH_SETATTR_SIZE 32
293 #define CEPH_SETATTR_CTIME 64
295 union ceph_mds_request_args {
296 struct {
297 __le32 mask; /* CEPH_CAP_* */
298 } __attribute__ ((packed)) getattr;
299 struct {
300 __le32 mode;
301 __le32 uid;
302 __le32 gid;
303 struct ceph_timespec mtime;
304 struct ceph_timespec atime;
305 __le64 size, old_size; /* old_size needed by truncate */
306 __le32 mask; /* CEPH_SETATTR_* */
307 } __attribute__ ((packed)) setattr;
308 struct {
309 __le32 frag; /* which dir fragment */
310 __le32 max_entries; /* how many dentries to grab */
311 } __attribute__ ((packed)) readdir;
312 struct {
313 __le32 mode;
314 __le32 rdev;
315 } __attribute__ ((packed)) mknod;
316 struct {
317 __le32 mode;
318 } __attribute__ ((packed)) mkdir;
319 struct {
320 __le32 flags;
321 __le32 mode;
322 __le32 stripe_unit; /* layout for newly created file */
323 __le32 stripe_count; /* ... */
324 __le32 object_size;
325 __le32 file_replication;
326 __le32 preferred;
327 } __attribute__ ((packed)) open;
328 struct {
329 __le32 flags;
330 } __attribute__ ((packed)) setxattr;
331 struct {
332 struct ceph_file_layout layout;
333 } __attribute__ ((packed)) setlayout;
334 } __attribute__ ((packed));
336 #define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */
337 #define CEPH_MDS_FLAG_WANT_DENTRY 2 /* want dentry in reply */
339 struct ceph_mds_request_head {
340 __le64 oldest_client_tid;
341 __le32 mdsmap_epoch; /* on client */
342 __le32 flags; /* CEPH_MDS_FLAG_* */
343 __u8 num_retry, num_fwd; /* count retry, fwd attempts */
344 __le16 num_releases; /* # include cap/lease release records */
345 __le32 op; /* mds op code */
346 __le32 caller_uid, caller_gid;
347 __le64 ino; /* use this ino for openc, mkdir, mknod,
348 etc. (if replaying) */
349 union ceph_mds_request_args args;
350 } __attribute__ ((packed));
352 /* cap/lease release record */
353 struct ceph_mds_request_release {
354 __le64 ino, cap_id; /* ino and unique cap id */
355 __le32 caps, wanted; /* new issued, wanted */
356 __le32 seq, issue_seq, mseq;
357 __le32 dname_seq; /* if releasing a dentry lease, a */
358 __le32 dname_len; /* string follows. */
359 } __attribute__ ((packed));
361 /* client reply */
362 struct ceph_mds_reply_head {
363 __le32 op;
364 __le32 result;
365 __le32 mdsmap_epoch;
366 __u8 safe; /* true if committed to disk */
367 __u8 is_dentry, is_target; /* true if dentry, target inode records
368 are included with reply */
369 } __attribute__ ((packed));
371 /* one for each node split */
372 struct ceph_frag_tree_split {
373 __le32 frag; /* this frag splits... */
374 __le32 by; /* ...by this many bits */
375 } __attribute__ ((packed));
377 struct ceph_frag_tree_head {
378 __le32 nsplits; /* num ceph_frag_tree_split records */
379 struct ceph_frag_tree_split splits[];
380 } __attribute__ ((packed));
382 /* capability issue, for bundling with mds reply */
383 struct ceph_mds_reply_cap {
384 __le32 caps, wanted; /* caps issued, wanted */
385 __le64 cap_id;
386 __le32 seq, mseq;
387 __le64 realm; /* snap realm */
388 __u8 flags; /* CEPH_CAP_FLAG_* */
389 } __attribute__ ((packed));
391 #define CEPH_CAP_FLAG_AUTH 1 /* cap is issued by auth mds */
393 /* inode record, for bundling with mds reply */
394 struct ceph_mds_reply_inode {
395 __le64 ino;
396 __le64 snapid;
397 __le32 rdev;
398 __le64 version; /* inode version */
399 __le64 xattr_version; /* version for xattr blob */
400 struct ceph_mds_reply_cap cap; /* caps issued for this inode */
401 struct ceph_file_layout layout;
402 struct ceph_timespec ctime, mtime, atime;
403 __le32 time_warp_seq;
404 __le64 size, max_size, truncate_size;
405 __le32 truncate_seq;
406 __le32 mode, uid, gid;
407 __le32 nlink;
408 __le64 files, subdirs, rbytes, rfiles, rsubdirs; /* dir stats */
409 struct ceph_timespec rctime;
410 struct ceph_frag_tree_head fragtree; /* (must be at end of struct) */
411 } __attribute__ ((packed));
412 /* followed by frag array, then symlink string, then xattr blob */
414 /* reply_lease follows dname, and reply_inode */
415 struct ceph_mds_reply_lease {
416 __le16 mask; /* lease type(s) */
417 __le32 duration_ms; /* lease duration */
418 __le32 seq;
419 } __attribute__ ((packed));
421 struct ceph_mds_reply_dirfrag {
422 __le32 frag; /* fragment */
423 __le32 auth; /* auth mds, if this is a delegation point */
424 __le32 ndist; /* number of mds' this is replicated on */
425 __le32 dist[];
426 } __attribute__ ((packed));
428 /* file access modes */
429 #define CEPH_FILE_MODE_PIN 0
430 #define CEPH_FILE_MODE_RD 1
431 #define CEPH_FILE_MODE_WR 2
432 #define CEPH_FILE_MODE_RDWR 3 /* RD | WR */
433 #define CEPH_FILE_MODE_LAZY 4 /* lazy io */
434 #define CEPH_FILE_MODE_NUM 8 /* bc these are bit fields.. mostly */
436 int ceph_flags_to_mode(int flags);
439 /* capability bits */
440 #define CEPH_CAP_PIN 1 /* no specific capabilities beyond the pin */
442 /* generic cap bits */
443 #define CEPH_CAP_GSHARED 1 /* client can reads */
444 #define CEPH_CAP_GEXCL 2 /* client can read and update */
445 #define CEPH_CAP_GCACHE 4 /* (file) client can cache reads */
446 #define CEPH_CAP_GRD 8 /* (file) client can read */
447 #define CEPH_CAP_GWR 16 /* (file) client can write */
448 #define CEPH_CAP_GBUFFER 32 /* (file) client can buffer writes */
449 #define CEPH_CAP_GWREXTEND 64 /* (file) client can extend EOF */
450 #define CEPH_CAP_GLAZYIO 128 /* (file) client can perform lazy io */
452 /* per-lock shift */
453 #define CEPH_CAP_SAUTH 2
454 #define CEPH_CAP_SLINK 4
455 #define CEPH_CAP_SXATTR 6
456 #define CEPH_CAP_SFILE 8 /* goes at the end (uses >2 cap bits) */
458 #define CEPH_CAP_BITS 16
460 /* composed values */
461 #define CEPH_CAP_AUTH_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SAUTH)
462 #define CEPH_CAP_AUTH_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SAUTH)
463 #define CEPH_CAP_LINK_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SLINK)
464 #define CEPH_CAP_LINK_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SLINK)
465 #define CEPH_CAP_XATTR_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SXATTR)
466 #define CEPH_CAP_XATTR_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SXATTR)
467 #define CEPH_CAP_FILE(x) (x << CEPH_CAP_SFILE)
468 #define CEPH_CAP_FILE_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SFILE)
469 #define CEPH_CAP_FILE_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SFILE)
470 #define CEPH_CAP_FILE_CACHE (CEPH_CAP_GCACHE << CEPH_CAP_SFILE)
471 #define CEPH_CAP_FILE_RD (CEPH_CAP_GRD << CEPH_CAP_SFILE)
472 #define CEPH_CAP_FILE_WR (CEPH_CAP_GWR << CEPH_CAP_SFILE)
473 #define CEPH_CAP_FILE_BUFFER (CEPH_CAP_GBUFFER << CEPH_CAP_SFILE)
474 #define CEPH_CAP_FILE_WREXTEND (CEPH_CAP_GWREXTEND << CEPH_CAP_SFILE)
475 #define CEPH_CAP_FILE_LAZYIO (CEPH_CAP_GLAZYIO << CEPH_CAP_SFILE)
477 /* cap masks (for getattr) */
478 #define CEPH_STAT_CAP_INODE CEPH_CAP_PIN
479 #define CEPH_STAT_CAP_TYPE CEPH_CAP_PIN /* mode >> 12 */
480 #define CEPH_STAT_CAP_SYMLINK CEPH_CAP_PIN
481 #define CEPH_STAT_CAP_UID CEPH_CAP_AUTH_SHARED
482 #define CEPH_STAT_CAP_GID CEPH_CAP_AUTH_SHARED
483 #define CEPH_STAT_CAP_MODE CEPH_CAP_AUTH_SHARED
484 #define CEPH_STAT_CAP_NLINK CEPH_CAP_LINK_SHARED
485 #define CEPH_STAT_CAP_LAYOUT CEPH_CAP_FILE_SHARED
486 #define CEPH_STAT_CAP_MTIME CEPH_CAP_FILE_SHARED
487 #define CEPH_STAT_CAP_SIZE CEPH_CAP_FILE_SHARED
488 #define CEPH_STAT_CAP_ATIME CEPH_CAP_FILE_SHARED /* fixme */
489 #define CEPH_STAT_CAP_XATTR CEPH_CAP_XATTR_SHARED
490 #define CEPH_STAT_CAP_INODE_ALL (CEPH_CAP_PIN | \
491 CEPH_CAP_AUTH_SHARED | \
492 CEPH_CAP_LINK_SHARED | \
493 CEPH_CAP_FILE_SHARED | \
494 CEPH_CAP_XATTR_SHARED)
496 #define CEPH_CAP_ANY_SHARED (CEPH_CAP_AUTH_SHARED | \
497 CEPH_CAP_LINK_SHARED | \
498 CEPH_CAP_XATTR_SHARED | \
499 CEPH_CAP_FILE_SHARED)
500 #define CEPH_CAP_ANY_RD (CEPH_CAP_ANY_SHARED | CEPH_CAP_FILE_RD | \
501 CEPH_CAP_FILE_CACHE)
503 #define CEPH_CAP_ANY_EXCL (CEPH_CAP_AUTH_EXCL | \
504 CEPH_CAP_LINK_EXCL | \
505 CEPH_CAP_XATTR_EXCL | \
506 CEPH_CAP_FILE_EXCL)
507 #define CEPH_CAP_ANY_FILE_WR (CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER | \
508 CEPH_CAP_FILE_EXCL)
509 #define CEPH_CAP_ANY_WR (CEPH_CAP_ANY_EXCL | CEPH_CAP_ANY_FILE_WR)
510 #define CEPH_CAP_ANY (CEPH_CAP_ANY_RD | CEPH_CAP_ANY_EXCL | \
511 CEPH_CAP_ANY_FILE_WR | CEPH_CAP_PIN)
513 #define CEPH_CAP_LOCKS (CEPH_LOCK_IFILE | CEPH_LOCK_IAUTH | CEPH_LOCK_ILINK | \
514 CEPH_LOCK_IXATTR)
516 int ceph_caps_for_mode(int mode);
518 enum {
519 CEPH_CAP_OP_GRANT, /* mds->client grant */
520 CEPH_CAP_OP_REVOKE, /* mds->client revoke */
521 CEPH_CAP_OP_TRUNC, /* mds->client trunc notify */
522 CEPH_CAP_OP_EXPORT, /* mds has exported the cap */
523 CEPH_CAP_OP_IMPORT, /* mds has imported the cap */
524 CEPH_CAP_OP_UPDATE, /* client->mds update */
525 CEPH_CAP_OP_DROP, /* client->mds drop cap bits */
526 CEPH_CAP_OP_FLUSH, /* client->mds cap writeback */
527 CEPH_CAP_OP_FLUSH_ACK, /* mds->client flushed */
528 CEPH_CAP_OP_FLUSHSNAP, /* client->mds flush snapped metadata */
529 CEPH_CAP_OP_FLUSHSNAP_ACK, /* mds->client flushed snapped metadata */
530 CEPH_CAP_OP_RELEASE, /* client->mds release (clean) cap */
531 CEPH_CAP_OP_RENEW, /* client->mds renewal request */
534 extern const char *ceph_cap_op_name(int op);
537 * caps message, used for capability callbacks, acks, requests, etc.
539 struct ceph_mds_caps {
540 __le32 op; /* CEPH_CAP_OP_* */
541 __le64 ino, realm;
542 __le64 cap_id;
543 __le32 seq, issue_seq;
544 __le32 caps, wanted, dirty; /* latest issued/wanted/dirty */
545 __le32 migrate_seq;
546 __le64 snap_follows;
547 __le32 snap_trace_len;
549 /* authlock */
550 __le32 uid, gid, mode;
552 /* linklock */
553 __le32 nlink;
555 /* xattrlock */
556 __le32 xattr_len;
557 __le64 xattr_version;
559 /* filelock */
560 __le64 size, max_size, truncate_size;
561 __le32 truncate_seq;
562 struct ceph_timespec mtime, atime, ctime;
563 struct ceph_file_layout layout;
564 __le32 time_warp_seq;
565 } __attribute__ ((packed));
567 /* cap release msg head */
568 struct ceph_mds_cap_release {
569 __le32 num; /* number of cap_items that follow */
570 } __attribute__ ((packed));
572 struct ceph_mds_cap_item {
573 __le64 ino;
574 __le64 cap_id;
575 __le32 migrate_seq, seq;
576 } __attribute__ ((packed));
578 #define CEPH_MDS_LEASE_REVOKE 1 /* mds -> client */
579 #define CEPH_MDS_LEASE_RELEASE 2 /* client -> mds */
580 #define CEPH_MDS_LEASE_RENEW 3 /* client <-> mds */
581 #define CEPH_MDS_LEASE_REVOKE_ACK 4 /* client -> mds */
583 extern const char *ceph_lease_op_name(int o);
585 /* lease msg header */
586 struct ceph_mds_lease {
587 __u8 action; /* CEPH_MDS_LEASE_* */
588 __le16 mask; /* which lease */
589 __le64 ino;
590 __le64 first, last; /* snap range */
591 __le32 seq;
592 __le32 duration_ms; /* duration of renewal */
593 } __attribute__ ((packed));
594 /* followed by a __le32+string for dname */
596 /* client reconnect */
597 struct ceph_mds_cap_reconnect {
598 __le64 cap_id;
599 __le32 wanted;
600 __le32 issued;
601 __le64 size;
602 struct ceph_timespec mtime, atime;
603 __le64 snaprealm;
604 __le64 pathbase; /* base ino for our path to this ino */
605 } __attribute__ ((packed));
606 /* followed by encoded string */
608 struct ceph_mds_snaprealm_reconnect {
609 __le64 ino; /* snap realm base */
610 __le64 seq; /* snap seq for this snap realm */
611 __le64 parent; /* parent realm */
612 } __attribute__ ((packed));
615 * snaps
617 enum {
618 CEPH_SNAP_OP_UPDATE, /* CREATE or DESTROY */
619 CEPH_SNAP_OP_CREATE,
620 CEPH_SNAP_OP_DESTROY,
621 CEPH_SNAP_OP_SPLIT,
624 extern const char *ceph_snap_op_name(int o);
626 /* snap msg header */
627 struct ceph_mds_snap_head {
628 __le32 op; /* CEPH_SNAP_OP_* */
629 __le64 split; /* ino to split off, if any */
630 __le32 num_split_inos; /* # inos belonging to new child realm */
631 __le32 num_split_realms; /* # child realms udner new child realm */
632 __le32 trace_len; /* size of snap trace blob */
633 } __attribute__ ((packed));
634 /* followed by split ino list, then split realms, then the trace blob */
637 * encode info about a snaprealm, as viewed by a client
639 struct ceph_mds_snap_realm {
640 __le64 ino; /* ino */
641 __le64 created; /* snap: when created */
642 __le64 parent; /* ino: parent realm */
643 __le64 parent_since; /* snap: same parent since */
644 __le64 seq; /* snap: version */
645 __le32 num_snaps;
646 __le32 num_prior_parent_snaps;
647 } __attribute__ ((packed));
648 /* followed by my snap list, then prior parent snap list */
650 #endif