]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: add `inconsistent_snapset_t` type
authorKefu Chai <kchai@redhat.com>
Sat, 30 Jan 2016 07:09:43 +0000 (15:09 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 25 Feb 2016 04:41:55 +0000 (12:41 +0800)
for presenting the inconsistent snapsets found in scrub

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/include/rados/rados_types.hpp

index 3eab5e7d0b97a4171a4e553fe3358fd4862c0346..2e3477bef1d46bb0a6390839d3108083b93782b9 100644 (file)
@@ -118,6 +118,48 @@ struct inconsistent_obj_t : err_t {
   std::map<int32_t, shard_info_t> shards;
 };
 
+struct inconsistent_snapset_t {
+  inconsistent_snapset_t() = default;
+  inconsistent_snapset_t(const object_id_t& head)
+    : object{head}
+  {}
+  enum {
+    ATTR_MISSING   = 1 << 0,
+    ATTR_CORRUPTED = 1 << 1,
+    CLONE_MISSING  = 1 << 2,
+    SNAP_MISMATCH  = 1 << 3,
+    HEAD_MISMATCH  = 1 << 4,
+    HEADLESS_CLONE = 1 << 5,
+    SIZE_MISMATCH  = 1 << 6,
+  };
+  uint64_t errors = 0;
+  object_id_t object;
+  std::vector<snap_t> clones;
+  std::vector<snap_t> missing;
+
+  bool ss_attr_missing() const {
+    return errors & ATTR_MISSING;
+  }
+  bool ss_attr_corrupted() const {
+    return errors & ATTR_CORRUPTED;
+  }
+  bool clone_missing() const  {
+    return errors & CLONE_MISSING;
+  }
+  bool snapset_mismatch() const {
+    return errors & SNAP_MISMATCH;
+  }
+  bool head_mismatch() const {
+    return errors & HEAD_MISMATCH;
+  }
+  bool headless() const {
+    return errors & HEADLESS_CLONE;
+  }
+  bool size_mismatch() const {
+    return errors & SIZE_MISMATCH;
+  }
+};
+
 /**
  * @var all_nspaces
  * Pass as nspace argument to IoCtx::set_namespace()