uint64_t search_bytes = 0;
auto rs_start = range_tree.lower_bound(range_t{*cursor, size}, compare);
for (auto rs = rs_start; rs != range_tree.end(); ++rs) {
- uint64_t offset = p2roundup(rs->start, align);
+ uint64_t offset = rs->start;
*cursor = offset + size;
if (offset + size <= rs->end) {
return offset;
}
// If we reached end, start from beginning till cursor.
for (auto rs = range_tree.begin(); rs != rs_start; ++rs) {
- uint64_t offset = p2roundup(rs->start, align);
+ uint64_t offset = rs->start;
*cursor = offset + size;
if (offset + size <= rs->end) {
return offset;
const auto compare = range_size_tree.key_comp();
auto rs_start = range_size_tree.lower_bound(range_t{0, size}, compare);
for (auto rs = rs_start; rs != range_size_tree.end(); ++rs) {
- uint64_t offset = p2roundup(rs->start, align);
+ uint64_t offset = rs->start;
if (offset + size <= rs->end) {
return offset;
}