]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/bluestore_types: blob_t convenience methods
authorSage Weil <sage@redhat.com>
Sat, 14 May 2016 12:29:42 +0000 (08:29 -0400)
committerSage Weil <sage@redhat.com>
Wed, 1 Jun 2016 15:38:46 +0000 (11:38 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/bluestore_types.h

index e2d2cb3132ef4d3996a6aaebb91d0655fcd755b7..e934569c587b16289c80982dc2f4e68d5d3c81ec 100644 (file)
@@ -287,6 +287,13 @@ struct bluestore_blob_t {
     return get_flags_string(flags);
   }
 
+  bool is_mutable() const {
+    return has_flag(FLAG_MUTABLE);
+  }
+  bool is_compressed() const {
+    return has_flag(FLAG_COMPRESSED);
+  }
+
   uint64_t calc_offset(uint64_t x_off, uint64_t *plen) const {
     auto p = extents.begin();
     assert(p != extents.end());
@@ -344,6 +351,13 @@ struct bluestore_blob_t {
     }
   }
 
+  uint64_t get_max_length() const {
+    if (has_flag(FLAG_COMPRESSED)) {
+      return length;
+    } else {
+      return get_ondisk_length();
+    }
+  }
   uint32_t get_ondisk_length() const {
     uint32_t len = 0;
     for (auto &p : extents) {