]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: extract OSD::_write_superblock() out
authorKefu Chai <kchai@redhat.com>
Wed, 2 Jun 2021 12:47:03 +0000 (20:47 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 2 Jun 2021 13:00:13 +0000 (21:00 +0800)
prepare for the change to verify existing meta collection and superblock
stored in it.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/osd.cc
src/crimson/osd/osd.h

index 28f79d2fd3042febfd226c9618e12a00e4848a12..f49446447593f2371d35796efef4b84e018bfe32 100644 (file)
@@ -154,19 +154,7 @@ seastar::future<> OSD::mkfs(uuid_d osd_uuid, uuid_d cluster_fsid)
     superblock.osd_fsid = store->get_fsid();
     superblock.whoami = whoami;
     superblock.compat_features = get_osd_initial_compat_set();
-
-    logger().info(
-      "{} writing superblock cluster_fsid {} osd_fsid {}",
-      __func__,
-      cluster_fsid,
-      superblock.osd_fsid);
-    return store->create_new_collection(coll_t::meta());
-  }).then([this] (auto ch) {
-    meta_coll = make_unique<OSDMeta>(ch , store.get());
-    ceph::os::Transaction t;
-    meta_coll->create(t);
-    meta_coll->store_superblock(t, superblock);
-    return store->do_transaction(meta_coll->collection(), std::move(t));
+    return _write_superblock();
   }).then([cluster_fsid, this] {
     return when_all_succeed(
       store->write_meta("ceph_fsid", cluster_fsid.to_string()),
@@ -179,6 +167,22 @@ seastar::future<> OSD::mkfs(uuid_d osd_uuid, uuid_d cluster_fsid)
   });
 }
 
+seastar::future<> OSD::_write_superblock()
+{
+  logger().info(
+    "{} writing superblock cluster_fsid {} osd_fsid {}",
+    __func__,
+    superblock.cluster_fsid,
+    superblock.osd_fsid);
+  return store->create_new_collection(coll_t::meta()).then([this] (auto ch) {
+    meta_coll = make_unique<OSDMeta>(ch , store.get());
+    ceph::os::Transaction t;
+    meta_coll->create(t);
+    meta_coll->store_superblock(t, superblock);
+    return store->do_transaction(meta_coll->collection(), std::move(t));
+  });
+}
+
 namespace {
   entity_addrvec_t pick_addresses(int what) {
     entity_addrvec_t addrs;
index 889960ced8d9681aa533b0d189bf097eb18c5a46..ebce16bf8ccf691b18446740ea462399bf44d0bb 100644 (file)
@@ -143,6 +143,7 @@ public:
   uint64_t send_pg_stats();
 
 private:
+  seastar::future<> _write_superblock();
   seastar::future<> start_boot();
   seastar::future<> _preboot(version_t oldest_osdmap, version_t newest_osdmap);
   seastar::future<> _send_boot();