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