From: xie xingguo Date: Mon, 12 Jun 2017 12:48:25 +0000 (+0800) Subject: os/bluestore: narrow shard combination condition X-Git-Tag: v12.1.0~135^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1593c8715835869f1696e04d996eed5c4f7e3b8e;p=ceph.git os/bluestore: narrow shard combination condition We have confirmed that we are not the last shard! Signed-off-by: xie xingguo --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 479857664a5..da82a3ba6d4 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -1976,20 +1976,13 @@ void BlueStore::ExtentMap::update(KeyValueDB::Transaction t, // avoid resharding the trailing shard, even if it is small else if (n != shards.end() && len < g_conf->bluestore_extent_map_shard_min_size) { - // we are small; combine with a neighbor - if (p == shards.begin() && endoff == OBJECT_MAX_SIZE) { - // we are an only shard - request_reshard(0, OBJECT_MAX_SIZE); - return; - } else if (p == shards.begin()) { - // combine with next shard + assert(endoff != OBJECT_MAX_SIZE); + if (p == shards.begin()) { + // we are the first shard, combine with next shard request_reshard(p->shard_info->offset, endoff + 1); - } else if (endoff == OBJECT_MAX_SIZE) { - // combine with previous shard - request_reshard(prev_p->shard_info->offset, endoff); - return; } else { - // combine with the smaller of the two + // combine either with the previous shard or the next, + // whichever is smaller if (prev_p->shard_info->bytes > n->shard_info->bytes) { request_reshard(p->shard_info->offset, endoff + 1); } else {