]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: use configured device type to select segment manager 68358/head
authorRonen Friedman <rfriedma@redhat.com>
Mon, 13 Apr 2026 15:17:26 +0000 (15:17 +0000)
committerRonen Friedman <rfriedma@redhat.com>
Sat, 16 May 2026 07:32:49 +0000 (07:32 +0000)
In get_segment_manager(), trust the user-specified device type rather
than probing the device for ZNS zones. This simplifies the
device type selection. More important:  the change avoids opening a block
file which was not yet created by the mkfs (we start() seastore then
call mkfs. but starting seastore requires creating the right segment
manager. And, currently, we probe the not-yet-created block file in mkfs()
when trying to create it.)

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
Co-authored-by: Kefu Chai <k.chai@proxmox.com>
src/crimson/os/seastore/segment_manager.cc

index 0672b84a1374e445394c8f19521fba5395487757..501137a5835a8fae5d9a53c008bea646743255f3 100644 (file)
@@ -30,23 +30,18 @@ std::ostream& operator<<(std::ostream &out, Segment::segment_state_t s)
 
 seastar::future<crimson::os::seastore::SegmentManagerRef>
 SegmentManager::get_segment_manager(
-  const std::string &device, device_type_t dtype)
+    const std::string& device,
+    device_type_t dtype)
 {
+  const std::string device_block = device + "/block";
 #ifdef HAVE_ZNS
   LOG_PREFIX(SegmentManager::get_segment_manager);
-  auto file = co_await seastar::open_file_dma(
-       device + "/block",
-       seastar::open_flags::rw);
-  ceph_assert(file);
-  uint32_t nr_zones = 0;
-  auto ret = co_await file.ioctl(BLKGETNRZONES, &nr_zones);
-  ceph_assert(ret == 0);
-  INFO("Found {} zones.", nr_zones);
-  if (nr_zones != 0) {
-    co_return std::make_unique<segment_manager::zbd::ZBDSegmentManager>(device + "/block");
+  if (dtype == device_type_t::ZBD) {
+    co_return std::make_unique<segment_manager::zbd::ZBDSegmentManager>(
+        device_block);
   }
 #endif
-  co_return std::make_unique<segment_manager::block::BlockSegmentManager>(device + "/block", dtype);
+  co_return std::make_unique<segment_manager::block::BlockSegmentManager>(
+      device_block, dtype);
 }
-
 } // namespace crimson::os::seastore