From: xie xingguo Date: Thu, 10 Nov 2016 11:11:25 +0000 (+0800) Subject: os/bluestore: improve the readability of Extent::blob_escapes_range() X-Git-Tag: v11.1.0~344^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0590a32d614d4f17748519a5ec12d05c288502b6;p=ceph-ci.git os/bluestore: improve the readability of Extent::blob_escapes_range() Signed-off-by: xie xingguo --- diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 89139beb328..2faa5527dfb 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -542,7 +542,7 @@ public: uint32_t blob_offset = 0; ///< blob offset uint32_t length = 0; ///< length uint8_t blob_depth = 0; ///< blob overlapping count - BlobRef blob; ///< the blob with our data + BlobRef blob; ///< the blob with our data /// ctor for lookup only explicit Extent(uint32_t lo) : logical_offset(lo) { } @@ -577,19 +577,22 @@ public: return a.logical_offset == b.logical_offset; } + uint32_t blob_start() { + return logical_offset - blob_offset; + } + uint32_t blob_end() { - return logical_offset + blob->get_blob().get_logical_length() - - blob_offset; + return blob_start() + blob->get_blob().get_logical_length(); } uint32_t end() const { return logical_offset + length; } + // return true if any piece of the blob is out of + // the given range [o, o + l]. bool blob_escapes_range(uint32_t o, uint32_t l) { - uint32_t bstart = logical_offset - blob_offset; - return (bstart < o || - bstart + blob->get_blob().get_logical_length() > o + l); + return blob_start() < o || blob_end() > o + l; } }; typedef boost::intrusive::set extent_map_t;