]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: avoid resharding if the last shard size fall below shard min size 12447/head
authorIgor Fedotov <ifedotov@mirantis.com>
Mon, 12 Dec 2016 17:36:35 +0000 (17:36 +0000)
committerIgor Fedotov <ifedotov@mirantis.com>
Tue, 13 Dec 2016 13:41:41 +0000 (13:41 +0000)
Signed-off-by: Igor Fedotov <ifedotov@mirantis.com>
src/os/bluestore/BlueStore.cc

index f96eb7bd25f0ea3ae1799961f0213da1444b4886..b27021a890281f4ccf0a4f8befdf35f99ba426d6 100644 (file)
@@ -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;
       }