]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: narrow shard combination condition
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 12 Jun 2017 12:48:25 +0000 (20:48 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 12 Jun 2017 12:48:25 +0000 (20:48 +0800)
We have confirmed that we are not the last shard!

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueStore.cc

index 479857664a5e73a0c074ae0b03d5d02cef3afda3..da82a3ba6d43a79022f7aa1432ad9b6a5b411638 100644 (file)
@@ -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 {