From 7e2baa9db0bce1cb859522b1474a1d32bd4862df Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 24 Jun 2008 17:24:39 -0700 Subject: [PATCH] snap: base types --- src/include/ceph_fs.h | 16 +++++++++++----- src/include/types.h | 6 ++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index 04b4eda42f495..0872e40223270 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -53,13 +53,17 @@ static inline int ceph_fsid_equal(const struct ceph_fsid *a, const struct ceph_f */ typedef __le64 ceph_ino_t; +typedef __le64 ceph_snapid_t; +#define CEPH_MAXSNAP 0xffffffffffffffull /* 56 bits; see ceph_pg */ +#define CEPH_NOSNAP ((__u64)(-1)) + struct ceph_object { union { __u8 raw[20]; /* fits a sha1 hash */ struct { __le64 ino; /* inode "file" identifier */ __le32 bno; /* "block" (object) in that "file" */ - __le64 rev; /* revision. normally ctime (as epoch). */ + __le64 snap; /* snapshot id. usually NOSNAP. */ } __attribute__ ((packed)); }; } __attribute__ ((packed)); @@ -159,17 +163,19 @@ struct ceph_file_layout { * placement group. * we encode this into one __le64. */ -#define CEPH_PG_TYPE_REP 1 -#define CEPH_PG_TYPE_RAID4 2 +#define CEPH_PG_TYPE_REP 1 +#define CEPH_PG_TYPE_RAID4 2 +#define CEPH_PG_TYPE_SNAP_LB 3 +#define CEPH_PG_TYPE_SNAP_UB 4 union ceph_pg { __u64 pg64; struct { __s16 preferred; /* preferred primary osd */ __u16 ps; /* placement seed */ + __u8 __pad; + __u8 size; __u8 pool; /* implies crush ruleset */ __u8 type; - __u8 size; - __u8 __pad; } pg; } __attribute__ ((packed)); diff --git a/src/include/types.h b/src/include/types.h index 2186085872f9f..8e7b7d21d70fb 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -139,6 +139,12 @@ typedef __u32 epoch_t; // map epoch (32bits -> 13 epochs/second for 10 ye typedef __u64 coll_t; +// snaps +typedef __u64 snapid_t; +#define MAXSNAP CEPH_MAXSNAP +#define NOSNAP CEPH_NOSNAP + + // -------------------------------------- // inode -- 2.39.5