Skip to content

Commit

Permalink
Merge pull request #12447 from ifed01/wip-bluestore-fix-reshard2
Browse files Browse the repository at this point in the history
os/bluestore: avoid resharding if the last shard size fall below shar…

Reviewed-by: xie xingguo <xie.xingguo@zte.com.cn>
Reviewed-by: Somnath Roy <somnath.roy@sandisk.com>
Reviewed-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Dec 13, 2016
2 parents 0be3f5f + 3530606 commit c6198c3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -1608,23 +1608,28 @@ bool BlueStore::ExtentMap::update(Onode *o, KeyValueDB::Transaction t,
endoff = n->offset;
}
bufferlist bl;
unsigned n;
if (encode_some(p->offset, endoff - p->offset, bl, &n)) {
unsigned nn;
if (encode_some(p->offset, endoff - p->offset, bl, &nn)) {
return true;
}
size_t len = bl.length();
dout(20) << __func__ << " shard 0x" << std::hex
<< p->offset << std::dec << " is " << len
<< " bytes (was " << p->shard_info->bytes << ") from " << n
<< " bytes (was " << p->shard_info->bytes << ") from " << nn
<< " extents" << dendl;

//indicate need for reshard if force mode selected, len > shard_max size OR
//non-last shard size is below the min threshold. The last check is to avoid potential
//unneeded reshardings since this might happen permanently.
if (!force &&
(len > g_conf->bluestore_extent_map_shard_max_size ||
len < g_conf->bluestore_extent_map_shard_min_size)) {
(n != shards.end() && len < g_conf->bluestore_extent_map_shard_min_size)
)) {
return true;
}
assert(p->shard_info->offset == p->offset);
p->shard_info->bytes = len;
p->shard_info->extents = n;
p->shard_info->extents = nn;
t->set(PREFIX_OBJ, p->key, bl);
p->dirty = false;
}
Expand Down

0 comments on commit c6198c3

Please sign in to comment.