]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: fix filestore collections' bits
authorSage Weil <sage@redhat.com>
Tue, 28 Mar 2017 22:05:32 +0000 (18:05 -0400)
committerSage Weil <sage@redhat.com>
Wed, 29 Mar 2017 02:23:44 +0000 (22:23 -0400)
Legacy FileStore didn't store the bit width of a
collection, which prevents you from duplicating/
converting the store to something else (BlueStore). Fix
it up on startup.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PG.cc

index 537b5241b5e05c0340c776acf80ce7870ccc3af0..71b3518c22015bf1ded6df39f2961ee426cf4fba 100644 (file)
@@ -5753,6 +5753,21 @@ void PG::update_store_with_options()
   if(r < 0 && r != -EOPNOTSUPP) {
     derr << __func__ << "set_collection_opts returns error:" << r << dendl;
   }
+
+  if (osd->store->get_type() == "filestore") {
+    // legacy filestore didn't store collection bit width; fix.
+    int bits = osd->store->collection_bits(coll);
+    if (bits < 0) {
+      if (coll.is_meta())
+       bits = 0;
+      else
+       bits = info.pgid.get_split_bits(pool.info.get_pg_num());
+      lderr(cct) << __func__ << " setting bit width to " << bits << dendl;
+      ObjectStore::Transaction t;
+      t.collection_set_bits(coll, bits);
+      osd->store->apply_transaction(osr.get(), std::move(t));
+    }
+  }
 }
 
 std::ostream& operator<<(std::ostream& oss,