]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/os/seastore/cached_extent: add has_pin and is_logical helpers
authorSamuel Just <sjust@redhat.com>
Wed, 15 Jul 2020 23:43:49 +0000 (16:43 -0700)
committerSamuel Just <sjust@redhat.com>
Thu, 16 Jul 2020 23:16:42 +0000 (16:16 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/os/seastore/cached_extent.h

index 66d8e46858cb4309b6037b69849ddfc3bae9f394..77a298b75347e2b92d0423e05fc5cc97ceea2bd0 100644 (file)
@@ -108,6 +108,10 @@ public:
    */
   virtual extent_types_t get_type() const = 0;
 
+  virtual bool is_logical() const {
+    return false;
+  }
+
   friend std::ostream &operator<<(std::ostream &, extent_state_t);
   virtual std::ostream &print_detail(std::ostream &out) const { return out; }
   std::ostream &print(std::ostream &out) const {
@@ -526,7 +530,14 @@ public:
   template <typename... T>
   LogicalCachedExtent(T&&... t) : CachedExtent(std::forward<T>(t)...) {}
 
-  void set_pin(LBAPinRef &&pin) { this->pin = std::move(pin); }
+  void set_pin(LBAPinRef &&npin) {
+    assert(!pin);
+    pin = std::move(npin);
+  }
+
+  bool has_pin() const {
+    return !!pin;
+  }
 
   LBAPin &get_pin() {
     assert(pin);
@@ -543,6 +554,10 @@ public:
     apply_delta(bl);
     set_last_committed_crc(get_crc32c());
   }
+
+  bool is_logical() const final {
+    return true;
+  }
 protected:
   virtual void apply_delta(const ceph::bufferlist &bl) = 0;