bool force)
{
auto cct = onode->c->store->cct; //used by dout
- assert(!needs_reshard);
+ assert(!needs_reshard());
if (onode->onode.extent_map_shards.empty()) {
if (inline_bl.length() == 0) {
unsigned n;
void BlueStore::ExtentMap::reshard()
{
- auto cct = onode->c->store->cct; //used by dout
+ auto cct = onode->c->store->cct; // used by dout
- needs_reshard = false;
+ dout(10) << __func__ << " 0x[" << std::hex << needs_reshard_begin << ","
+ << needs_reshard_end << ")" << std::dec << dendl;
// un-span all blobs
auto p = spanning_blob_map.begin();
dout(20) << __func__ << " <= 1 extent, going inline" << dendl;
shards.clear();
onode->onode.extent_map_shards.clear();
+ clear_needs_reshard();
return;
}
}
}
}
+
+ clear_needs_reshard();
}
bool BlueStore::ExtentMap::encode_some(
}
Extent *le = new Extent(logical_offset, blob_offset, length, b);
extent_map.insert(*le);
- if (!needs_reshard && spans_shard(logical_offset, length)) {
- needs_reshard = true;
+ if (spans_shard(logical_offset, length)) {
+ request_reshard(logical_offset, logical_offset + length);
}
return le;
}
// finalize onodes
for (auto o : txc->onodes) {
// finalize extent_map shards
- bool reshard = o->extent_map.needs_reshard;
+ bool reshard = o->extent_map.needs_reshard();
if (!reshard) {
reshard = o->extent_map.update(t, false);
}
bufferlist inline_bl; ///< cached encoded map, if unsharded; empty=>dirty
- bool needs_reshard = false; ///< true if we must reshard
+ uint32_t needs_reshard_begin = 0;
+ uint32_t needs_reshard_end = 0;
+
+ bool needs_reshard() const {
+ return needs_reshard_end > needs_reshard_begin;
+ }
+ void clear_needs_reshard() {
+ needs_reshard_begin = needs_reshard_end = 0;
+ }
+ void request_reshard(uint32_t begin, uint32_t end) {
+ if (begin < needs_reshard_begin) {
+ needs_reshard_begin = begin;
+ }
+ if (end > needs_reshard_end) {
+ needs_reshard_end = end;
+ }
+ }
struct DeleteDisposer {
void operator()(Extent *e) { delete e; }
extent_map.clear_and_dispose(DeleteDisposer());
shards.clear();
inline_bl.clear();
- needs_reshard = false;
+ clear_needs_reshard();
}
bool encode_some(uint32_t offset, uint32_t length, bufferlist& bl,