]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: ExtentMap: factor old shard key removal into reshard()
authorSage Weil <sage@redhat.com>
Fri, 27 Jan 2017 17:00:15 +0000 (12:00 -0500)
committerSage Weil <sage@redhat.com>
Thu, 2 Feb 2017 15:12:08 +0000 (10:12 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index a22230cd7206e953a06663a43d49d8141e2e8092..88b24fa9b5e216bc7f0c6a59cf1a1e667928bf7f 100644 (file)
@@ -1854,13 +1854,28 @@ void BlueStore::ExtentMap::update(KeyValueDB::Transaction t,
   }
 }
 
-void BlueStore::ExtentMap::reshard()
+void BlueStore::ExtentMap::reshard(
+  KeyValueDB *db,
+  KeyValueDB::Transaction t)
 {
   auto cct = onode->c->store->cct; // used by dout
 
   dout(10) << __func__ << " 0x[" << std::hex << needs_reshard_begin << ","
           << needs_reshard_end << ")" << std::dec << dendl;
 
+  fault_range(db, 0, OBJECT_MAX_SIZE);
+
+  // remove old keys
+  string key;
+  for (auto &s : shards) {
+    generate_extent_shard_key_and_apply(
+      onode->key, s.offset, &key,
+      [&](const string& final_key) {
+       t->rmkey(PREFIX_OBJ, final_key);
+      }
+      );
+  }
+
   // un-span all blobs
   auto p = spanning_blob_map.begin();
   while (p != spanning_blob_map.end()) {
@@ -6872,20 +6887,7 @@ void BlueStore::_txc_write_nodes(TransContext *txc, KeyValueDB::Transaction t)
       o->extent_map.update(t, false);
     }
     if (o->extent_map.needs_reshard()) {
-      dout(20) << __func__ << "  resharding extents for " << o->oid
-              << " over 0x[" << std::hex << o->extent_map.needs_reshard_begin
-              << "," << o->extent_map.needs_reshard_end << ")" << std::dec
-              << dendl;
-      string key;
-      for (auto &s : o->extent_map.shards) {
-       generate_extent_shard_key_and_apply(o->key, s.offset, &key,
-          [&](const string& final_key) {
-            t->rmkey(PREFIX_OBJ, final_key);
-          }
-        );
-      }
-      o->extent_map.fault_range(db, 0, o->onode.size);
-      o->extent_map.reshard();
+      o->extent_map.reshard(db, t);
       o->extent_map.update(t, true);
       if (o->extent_map.needs_reshard()) {
        dout(20) << __func__ << " warning: still wants reshard, check options?"
index 2c0af85a999f7c9f81da9a385402db66944a3140..6136d4b561e32d25510188cd599da6fa7e40ffbf 100644 (file)
@@ -721,7 +721,9 @@ public:
     }
 
     void update(KeyValueDB::Transaction t, bool force);
-    void reshard();
+    void reshard(
+      KeyValueDB *db,
+      KeyValueDB::Transaction t);
 
     /// initialize Shards from the onode
     void init_shards(bool loaded, bool dirty);