From: Sage Weil Date: Sat, 14 May 2016 12:29:42 +0000 (-0400) Subject: os/bluestore/bluestore_types: blob_t convenience methods X-Git-Tag: v11.0.0~359^2~102 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=14289319c990ec6378903dc99ce16f1772681455;p=ceph.git os/bluestore/bluestore_types: blob_t convenience methods Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/bluestore_types.h b/src/os/bluestore/bluestore_types.h index e2d2cb3132e..e934569c587 100644 --- a/src/os/bluestore/bluestore_types.h +++ b/src/os/bluestore/bluestore_types.h @@ -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) {