diff --git a/src/os/bluestore/bluestore_types.cc b/src/os/bluestore/bluestore_types.cc index 1d9212623e7f4..18669678a8e4f 100644 --- a/src/os/bluestore/bluestore_types.cc +++ b/src/os/bluestore/bluestore_types.cc @@ -147,7 +147,7 @@ void bluestore_extent_ref_map_t::_check() const } } -void bluestore_extent_ref_map_t::_maybe_merge_left(map::iterator& p) +void bluestore_extent_ref_map_t::_maybe_merge_left(map::iterator& p) { if (p == ref_map.begin()) return; @@ -161,9 +161,9 @@ void bluestore_extent_ref_map_t::_maybe_merge_left(map::itera } } -void bluestore_extent_ref_map_t::get(uint64_t offset, uint32_t length) +void bluestore_extent_ref_map_t::get(uint32_t offset, uint32_t length) { - map::iterator p = ref_map.lower_bound(offset); + map::iterator p = ref_map.lower_bound(offset); if (p != ref_map.begin()) { --p; if (p->first + p->second.length <= offset) { @@ -179,9 +179,9 @@ void bluestore_extent_ref_map_t::get(uint64_t offset, uint32_t length) } if (p->first > offset) { // gap - uint64_t newlen = MIN(p->first - offset, length); + uint32_t newlen = MIN(p->first - offset, length); p = ref_map.insert( - map::value_type(offset, + map::value_type(offset, record_t(newlen, 1))).first; offset += newlen; length -= newlen; @@ -192,9 +192,9 @@ void bluestore_extent_ref_map_t::get(uint64_t offset, uint32_t length) if (p->first < offset) { // split off the portion before offset assert(p->first + p->second.length > offset); - uint64_t left = p->first + p->second.length - offset; + uint32_t left = p->first + p->second.length - offset; p->second.length = offset - p->first; - p = ref_map.insert(map::value_type( + p = ref_map.insert(map::value_type( offset, record_t(left, p->second.refs))).first; // continue below } @@ -219,10 +219,10 @@ void bluestore_extent_ref_map_t::get(uint64_t offset, uint32_t length) } void bluestore_extent_ref_map_t::put( - uint64_t offset, uint32_t length, + uint32_t offset, uint32_t length, vector *release) { - map::iterator p = ref_map.lower_bound(offset); + map::iterator p = ref_map.lower_bound(offset); if (p == ref_map.end() || p->first > offset) { if (p == ref_map.begin()) { assert(0 == "put on missing extent (nothing before)"); @@ -233,9 +233,9 @@ void bluestore_extent_ref_map_t::put( } } if (p->first < offset) { - uint64_t left = p->first + p->second.length - offset; + uint32_t left = p->first + p->second.length - offset; p->second.length = offset - p->first; - p = ref_map.insert(map::value_type( + p = ref_map.insert(map::value_type( offset, record_t(left, p->second.refs))).first; } while (length > 0) { @@ -272,9 +272,9 @@ void bluestore_extent_ref_map_t::put( _check(); } -bool bluestore_extent_ref_map_t::contains(uint64_t offset, uint32_t length) const +bool bluestore_extent_ref_map_t::contains(uint32_t offset, uint32_t length) const { - map::const_iterator p = ref_map.lower_bound(offset); + map::const_iterator p = ref_map.lower_bound(offset); if (p == ref_map.end() || p->first > offset) { if (p == ref_map.begin()) { return false; // nothing before @@ -291,7 +291,7 @@ bool bluestore_extent_ref_map_t::contains(uint64_t offset, uint32_t length) cons return false; if (p->first + p->second.length >= offset + length) return true; - uint64_t overlap = p->first + p->second.length - offset; + uint32_t overlap = p->first + p->second.length - offset; offset += overlap; length -= overlap; ++p; @@ -300,10 +300,10 @@ bool bluestore_extent_ref_map_t::contains(uint64_t offset, uint32_t length) cons } bool bluestore_extent_ref_map_t::intersects( - uint64_t offset, + uint32_t offset, uint32_t length) const { - map::const_iterator p = ref_map.lower_bound(offset); + map::const_iterator p = ref_map.lower_bound(offset); if (p != ref_map.begin()) { --p; if (p->first + p->second.length <= offset) { diff --git a/src/os/bluestore/bluestore_types.h b/src/os/bluestore/bluestore_types.h index fd4eff8fee93b..66ef4697be1fe 100644 --- a/src/os/bluestore/bluestore_types.h +++ b/src/os/bluestore/bluestore_types.h @@ -150,10 +150,10 @@ struct bluestore_extent_ref_map_t { }; WRITE_CLASS_ENCODER(record_t) - map ref_map; + map ref_map; void _check() const; - void _maybe_merge_left(map::iterator& p); + void _maybe_merge_left(map::iterator& p); void clear() { ref_map.clear(); @@ -162,11 +162,11 @@ struct bluestore_extent_ref_map_t { return ref_map.empty(); } - void get(uint64_t offset, uint32_t len); - void put(uint64_t offset, uint32_t len, vector *release); + void get(uint32_t offset, uint32_t len); + void put(uint32_t offset, uint32_t len, vector *release); - bool contains(uint64_t offset, uint32_t len) const; - bool intersects(uint64_t offset, uint32_t len) const; + bool contains(uint32_t offset, uint32_t len) const; + bool intersects(uint32_t offset, uint32_t len) const; void encode(bufferlist& bl) const; void decode(bufferlist::iterator& p);