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