]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/mds/snap.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / mds / snap.h
index a10f4f86c4c59bbb915b988079e27123cc68a58f..b3c00ddf78ad232e0139c88f27f3eeb0e26b7c87 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef CEPH_MDS_SNAP_H
 #define CEPH_MDS_SNAP_H
 
-#include <boost/utility/string_view.hpp>
+#include <string_view>
 
 #include "mdstypes.h"
 #include "common/snap_types.h"
@@ -29,17 +29,23 @@ struct SnapInfo {
   utime_t stamp;
   string name;
 
-  string long_name; ///< cached _$ino_$name
+  mutable string long_name; ///< cached _$ino_$name
   
   void encode(bufferlist &bl) const;
-  void decode(bufferlist::iterator &bl);
+  void decode(bufferlist::const_iterator &bl);
   void dump(Formatter *f) const;
   static void generate_test_instances(list<SnapInfo*>& ls);
 
-  boost::string_view get_long_name();
+  std::string_view get_long_name() const;
 };
 WRITE_CLASS_ENCODER(SnapInfo)
 
+inline bool operator==(const SnapInfo &l, const SnapInfo &r)
+{
+  return l.snapid == r.snapid && l.ino == r.ino &&
+        l.stamp == r.stamp && l.name == r.name;
+}
+
 ostream& operator<<(ostream& out, const SnapInfo &sn);
 
 
@@ -59,7 +65,7 @@ struct snaplink_t {
   snapid_t first;
 
   void encode(bufferlist &bl) const;
-  void decode(bufferlist::iterator &bl);
+  void decode(bufferlist::const_iterator &bl);
   void dump(Formatter *f) const;
   static void generate_test_instances(list<snaplink_t*>& ls);
 };
@@ -77,15 +83,25 @@ struct sr_t {
   snapid_t current_parent_since;
   map<snapid_t, SnapInfo> snaps;
   map<snapid_t, snaplink_t> past_parents;  // key is "last" (or NOSNAP)
+  set<snapid_t> past_parent_snaps;
+
+  __u32 flags;
+  enum {
+    PARENT_GLOBAL = 1 << 0,
+  };
+
+  void mark_parent_global() { flags |= PARENT_GLOBAL; }
+  void clear_parent_global() { flags &= ~PARENT_GLOBAL; }
+  bool is_parent_global() const { return flags & PARENT_GLOBAL; }
 
   sr_t()
     : seq(0), created(0),
       last_created(0), last_destroyed(0),
-      current_parent_since(1)
+      current_parent_since(1), flags(0)
   {}
 
   void encode(bufferlist &bl) const;
-  void decode(bufferlist::iterator &bl);
+  void decode(bufferlist::const_iterator &bl);
   void dump(Formatter *f) const;
   static void generate_test_instances(list<sr_t*>& ls);
 };