]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/os/seastore/rbm: fix rbm get_shard_nums wip-liucm-osd-shard-rbm-crimson-only
authorChunmei Liu <chunmei.liu@ibm.com>
Tue, 30 Sep 2025 17:14:49 +0000 (17:14 +0000)
committerChunmei Liu <chunmei.liu@ibm.com>
Tue, 30 Sep 2025 17:14:49 +0000 (17:14 +0000)
Signed-off-by: Chunmei Liu <chunmei.liu@ibm.com>
src/crimson/os/seastore/random_block_manager/rbm_device.cc

index 330ba18a253edceb72936d364823cc147426d635..4d18ae9f7aa134a2ff822a2438cd67e53ff3107e 100644 (file)
@@ -200,9 +200,18 @@ read_ertr::future<unsigned int> RBMDevice::get_shard_nums()
   return open(get_device_path(),
     seastar::open_flags::rw | seastar::open_flags::dsync
   ).safe_then([this] {
-    return read_rbm_superblock(RBM_START_ADDRESS
-    ).safe_then([this](auto sb) {
-      return read_ertr::make_ready_future<unsigned int>(sb.shard_num);
+    return stat_device(
+    ).handle_error(
+      mount_ertr::pass_further{},
+      crimson::ct_error::assert_all{
+      "Invalid error stat_device in RBMDevice::get_shard_nums"}
+    ).safe_then([this](auto st) {
+      assert(st.block_size > 0);
+      super.block_size = st.block_size;
+      return read_rbm_superblock(RBM_START_ADDRESS
+      ).safe_then([this](auto sb) {
+        return read_ertr::make_ready_future<unsigned int>(sb.shard_num);
+      });
     });
   }).handle_error(
     crimson::ct_error::assert_all{