]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/rbm: In mkfs, add open() before write_rbm_header()
authormyoungwon oh <ohmyoungwon@gmail.com>
Mon, 13 Feb 2023 01:54:41 +0000 (10:54 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Sat, 25 Feb 2023 03:09:45 +0000 (12:09 +0900)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/crimson/os/seastore/random_block_manager/nvme_block_device.cc
src/crimson/os/seastore/random_block_manager/nvme_block_device.h
src/crimson/os/seastore/random_block_manager/rbm_device.h

index 48896ccdf5e3269465860dcf96a8e8138cd04954..7598b8d6456113fff015ee2237beb2bdccd91bf2 100644 (file)
@@ -40,13 +40,21 @@ RBMDevice::mkfs_ret RBMDevice::do_mkfs(device_config_t config) {
     assert(super.size >= super.journal_size);
     DEBUG("super {} ", super);
     // write super block
-    return write_rbm_header(
-    ).safe_then([] {
-      return mkfs_ertr::now();
-    }).handle_error(
+    return open(get_device_path(),
+      seastar::open_flags::rw | seastar::open_flags::dsync
+    ).handle_error(
       mkfs_ertr::pass_further{},
       crimson::ct_error::assert_all{
-      "Invalid error write_rbm_header in RBMDevice::mkfs"
+      "Invalid error open in RBMDevice::mkfs"}
+    ).safe_then([this] {
+      return write_rbm_header(
+      ).safe_then([this] {
+       return close();
+      }).handle_error(
+       mkfs_ertr::pass_further{},
+       crimson::ct_error::assert_all{
+       "Invalid error write_rbm_header in RBMDevice::mkfs"
+      });
     });
   });
 }
index 689893105d357faa7672c8e25f54cc04817254cf..03db41d8fb047f39e4cfc9ec4ba176e68142c4ef 100644 (file)
@@ -245,6 +245,10 @@ public:
     });
   }
 
+  std::string get_device_path() const final {
+    return device_path;
+  }
+
   uint64_t get_preffered_write_granularity() const { return write_granularity; }
   uint64_t get_preffered_write_alignment() const { return write_alignment; }
   uint64_t get_atomic_write_unit() const { return atomic_write_unit; }
index e7efac0600ea5989e76fe037cfed4fd2ca881454..d58af939b7a5126af794f98931e0d1f501b6285e 100644 (file)
@@ -160,6 +160,8 @@ public:
     read_ertr::future<seastar::stat_data>;
   virtual stat_device_ret stat_device() = 0;
 
+  virtual std::string get_device_path() const = 0;
+
   uint64_t get_journal_size() const {
     return super.journal_size;
   }
@@ -247,6 +249,11 @@ public:
       stat
     );
   }
+
+  std::string get_device_path() const final {
+    return "";
+  }
+
   char *buf;
 };
 using EphemeralRBMDeviceRef = std::unique_ptr<EphemeralRBMDevice>;