]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
blk,os/bluestore: do not call extblkdev::detect_device on every 68177/head
authorIgor Fedotov <ifedotov@croit.io>
Thu, 2 Apr 2026 10:49:39 +0000 (13:49 +0300)
committerIgor Fedotov <ifedotov@croit.io>
Thu, 2 Apr 2026 10:49:39 +0000 (13:49 +0300)
KernelDevice::open()

Instead we can do that once during mkfs and once again during Bluestore
mounting if relevant label is attached.

Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
src/blk/BlockDevice.h
src/blk/kernel/KernelDevice.cc
src/blk/kernel/KernelDevice.h
src/os/bluestore/BlueStore.cc

index ee7bccb6e13f9c6fee11e1256febdf695c6922d3..0ea7804088e9209038267677275c1819d940a230 100644 (file)
@@ -249,7 +249,7 @@ public:
   virtual int get_ebd_state(ExtBlkDevState &state) const {
     return -ENOENT;
   }
-  virtual int get_ebd_id(std::string& id) const {
+  virtual int detect_ebd(std::string& id) {
     return -ENOENT;
   }
 
index 444cf6b47dbcb28ac2a21a97d68136eb00deb031..b34ad11dd7cd82be71ca2687e80ceb721b972046 100644 (file)
@@ -294,12 +294,6 @@ int KernelDevice::open(const string& p)
       support_discard = blkdev_buffered.support_discard();
       optimal_io_size = blkdev_buffered.get_optimal_io_size();
       this->devname = devname;
-      // check if any extended block device plugin recognizes this device
-      // detect_vdo has moved into the VDO plugin
-      int rc = extblkdev::detect_device(cct, devname, ebd_impl);
-      if (rc != 0) {
-       dout(20) << __func__ << " no plugin volume maps to " << devname << dendl;
-      }
     }
   }
 
@@ -477,7 +471,16 @@ int KernelDevice::get_ebd_state(ExtBlkDevState &state) const
   return -ENOENT;
 }
 
-int KernelDevice::get_ebd_id(std::string& id) const {
+int KernelDevice::detect_ebd(std::string& id)
+{
+  // check if any extended block device plugin recognizes this device
+  // detect_vdo has moved into the VDO plugin
+  if (!ebd_impl) {
+    int rc = extblkdev::detect_device(cct, devname, ebd_impl);
+    if (rc != 0) {
+      dout(20) << __func__ << " no plugin volume maps to " << devname << dendl;
+    }
+  }
   if (ebd_impl) {
     return ebd_impl->get_plugin_id(id);
   }
index d95bffdbe7bdb19dbc7d95e05fc03b128b1317ad..fb206f6ba2dedcf48cb19c68c93cc81007740830 100644 (file)
@@ -148,7 +148,7 @@ public:
   int get_devices(std::set<std::string> *ls) const override;
 
   int get_ebd_state(ExtBlkDevState &state) const override;
-  int get_ebd_id(std::string& id) const override;
+  int detect_ebd(std::string& id) override;
 
   int read(uint64_t off, uint64_t len, ceph::buffer::list *pbl,
           IOContext *ioc,
index 6844e8319e15836015c98973dc8a4ba422654835..f58778aaae0863bad5f0341283a79f5d92be9a0b 100644 (file)
@@ -7186,7 +7186,7 @@ int BlueStore::_open_bdev(bool create)
         derr << "Failed preloading extblkdev plugins, error code: " << plugin_preload_r << dendl;
       }
       string bdev_plugin_id;
-      r = bdev->get_ebd_id(bdev_plugin_id);
+      r = bdev->detect_ebd(bdev_plugin_id);
       bool is_osd = cct->get_module_type() & CEPH_ENTITY_TYPE_OSD;
       if (r != 0) {
         derr << __func__ << " plugin " << meta_plugin_id << " not loaded" << dendl;
@@ -8667,7 +8667,7 @@ int BlueStore::mkfs()
   if (cct->_conf->bluestore_use_ebd) {
     // check if EBD plugin is enabled
     string plugin_id;
-    r = bdev->get_ebd_id(plugin_id);
+    r = bdev->detect_ebd(plugin_id);
     if (r == 0) {
       // retrieved name, save plugin into bdev metadata
       r = write_meta("extblkdev", plugin_id);