]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/include/ceph_fs.h
import ceph 15.2.14
[ceph.git] / ceph / src / include / ceph_fs.h
index 1c73ff377bc08c0666c65142267d48551e138aab..6f8a80e56f03f1d4214e2bd89506075f7843597b 100644 (file)
@@ -6,7 +6,7 @@
  * primarily intended to describe data structures that pass over the
  * wire or that are stored on disk.
  *
- * LGPL2.1
+ * LGPL-2.1 or LGPL-3.0
  */
 
 #ifndef CEPH_FS_H
 #define CEPH_MONC_PROTOCOL   15 /* server/client */
 
 
-#define CEPH_INO_ROOT   1
-#define CEPH_INO_CEPH   2       /* hidden .ceph dir */
-#define CEPH_INO_LOST_AND_FOUND 4      /* reserved ino for use in recovery */
+#define CEPH_INO_ROOT             1
+/*
+ * hidden .ceph dir, which is no longer created but
+ * recognised in existing filesystems so that we
+ * don't try to fragment it.
+ */
+#define CEPH_INO_CEPH             2
+#define CEPH_INO_GLOBAL_SNAPREALM 3
+#define CEPH_INO_LOST_AND_FOUND   4 /* reserved ino for use in recovery */
 
 /* arbitrary limit on max # of monitors (cluster of 3 is typical) */
 #define CEPH_MAX_MON   31
@@ -318,19 +324,21 @@ extern const char *ceph_mds_state_name(int s);
  *  - they also define the lock ordering by the MDS
  *  - a few of these are internal to the mds
  */
-#define CEPH_LOCK_DVERSION    1
-#define CEPH_LOCK_DN          2
-#define CEPH_LOCK_IVERSION    16    /* mds internal */
-#define CEPH_LOCK_ISNAP       32
-#define CEPH_LOCK_IFILE       64
-#define CEPH_LOCK_IAUTH       128
-#define CEPH_LOCK_ILINK       256
-#define CEPH_LOCK_IDFT        512   /* dir frag tree */
-#define CEPH_LOCK_INEST       1024  /* mds internal */
-#define CEPH_LOCK_IXATTR      2048
-#define CEPH_LOCK_IFLOCK      4096  /* advisory file locks */
-#define CEPH_LOCK_INO         8192  /* immutable inode bits; not a lock */
-#define CEPH_LOCK_IPOLICY     16384 /* policy lock on dirs. MDS internal */
+#define CEPH_LOCK_DN          (1 << 0)
+#define CEPH_LOCK_DVERSION    (1 << 1)
+#define CEPH_LOCK_ISNAP       (1 << 4)  /* snapshot lock. MDS internal */
+#define CEPH_LOCK_IPOLICY     (1 << 5)  /* policy lock on dirs. MDS internal */
+#define CEPH_LOCK_IFILE       (1 << 6)
+#define CEPH_LOCK_INEST       (1 << 7)  /* mds internal */
+#define CEPH_LOCK_IDFT        (1 << 8)  /* dir frag tree */
+#define CEPH_LOCK_IAUTH       (1 << 9)
+#define CEPH_LOCK_ILINK       (1 << 10)
+#define CEPH_LOCK_IXATTR      (1 << 11)
+#define CEPH_LOCK_IFLOCK      (1 << 12)  /* advisory file locks */
+#define CEPH_LOCK_IVERSION    (1 << 13)  /* mds internal */
+
+#define CEPH_LOCK_IFIRST      CEPH_LOCK_ISNAP
+
 
 /* client_session ops */
 enum {
@@ -524,6 +532,7 @@ union ceph_mds_request_args_legacy {
 
 #define CEPH_MDS_FLAG_REPLAY        1  /* this is a replayed op */
 #define CEPH_MDS_FLAG_WANT_DENTRY   2  /* want dentry in reply */
+#define CEPH_MDS_FLAG_ASYNC         4  /* request is async */
 
 struct ceph_mds_request_head_legacy {
        __le64 oldest_client_tid;
@@ -637,14 +646,18 @@ static inline void
 copy_from_legacy_head(struct ceph_mds_request_head *head,
                        struct ceph_mds_request_head_legacy *legacy)
 {
-       memcpy(&(head->oldest_client_tid), legacy, sizeof(*legacy));
+       struct ceph_mds_request_head_legacy *embedded_legacy =
+               (struct ceph_mds_request_head_legacy *)&head->oldest_client_tid;
+       *embedded_legacy = *legacy;
 }
 
 static inline void
 copy_to_legacy_head(struct ceph_mds_request_head_legacy *legacy,
                        struct ceph_mds_request_head *head)
 {
-       memcpy(legacy, &(head->oldest_client_tid), sizeof(*legacy));
+       struct ceph_mds_request_head_legacy *embedded_legacy =
+               (struct ceph_mds_request_head_legacy *)&head->oldest_client_tid;
+       *legacy = *embedded_legacy;
 }
 
 /* client reply */
@@ -687,6 +700,9 @@ struct ceph_mds_reply_lease {
        __le32 seq;
 } __attribute__ ((packed));
 
+#define CEPH_LEASE_VALID       (1 | 2) /* old and new bit values */
+#define CEPH_LEASE_PRIMARY_LINK        4       /* primary linkage */
+
 struct ceph_mds_reply_dirfrag {
        __le32 frag;            /* fragment */
        __le32 auth;            /* auth mds, if this is a delegation point */
@@ -757,7 +773,7 @@ int ceph_flags_to_mode(int flags);
 #define CEPH_CAP_LINK_EXCL     (CEPH_CAP_GEXCL     << CEPH_CAP_SLINK)
 #define CEPH_CAP_XATTR_SHARED (CEPH_CAP_GSHARED  << CEPH_CAP_SXATTR)
 #define CEPH_CAP_XATTR_EXCL    (CEPH_CAP_GEXCL     << CEPH_CAP_SXATTR)
-#define CEPH_CAP_FILE(x)    (x << CEPH_CAP_SFILE)
+#define CEPH_CAP_FILE(x)       ((x) << CEPH_CAP_SFILE)
 #define CEPH_CAP_FILE_SHARED   (CEPH_CAP_GSHARED   << CEPH_CAP_SFILE)
 #define CEPH_CAP_FILE_EXCL     (CEPH_CAP_GEXCL     << CEPH_CAP_SFILE)
 #define CEPH_CAP_FILE_CACHE    (CEPH_CAP_GCACHE    << CEPH_CAP_SFILE)
@@ -812,6 +828,13 @@ int ceph_flags_to_mode(int flags);
 #define CEPH_CAP_LOCKS (CEPH_LOCK_IFILE | CEPH_LOCK_IAUTH | CEPH_LOCK_ILINK | \
                        CEPH_LOCK_IXATTR)
 
+/* cap masks async dir operations */
+#define CEPH_CAP_DIR_CREATE    CEPH_CAP_FILE_CACHE
+#define CEPH_CAP_DIR_UNLINK    CEPH_CAP_FILE_RD
+#define CEPH_CAP_ANY_DIR_OPS   (CEPH_CAP_FILE_CACHE | CEPH_CAP_FILE_RD | \
+                               CEPH_CAP_FILE_WREXTEND | CEPH_CAP_FILE_LAZYIO)
+
+
 int ceph_caps_for_mode(int mode);
 
 enum {
@@ -875,10 +898,10 @@ struct ceph_mds_caps_body_legacy {
                        struct ceph_timespec mtime, atime, ctime;
                        struct ceph_file_layout layout;
                        __le32 time_warp_seq;
-               };
+               } __attribute__ ((packed));
                /* export message */
                struct ceph_mds_cap_peer peer;
-       };
+       } __attribute__ ((packed));
 } __attribute__ ((packed));
 
 /* cap release msg head */