From: Igor Fedotov Date: Thu, 2 Apr 2026 10:49:39 +0000 (+0300) Subject: blk,os/bluestore: do not call extblkdev::detect_device on every X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cf0a466c226ae6fef41bbbaf7ad7d3db52263b1b;p=ceph.git blk,os/bluestore: do not call extblkdev::detect_device on every 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 --- diff --git a/src/blk/BlockDevice.h b/src/blk/BlockDevice.h index ee7bccb6e13f..0ea7804088e9 100644 --- a/src/blk/BlockDevice.h +++ b/src/blk/BlockDevice.h @@ -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; } diff --git a/src/blk/kernel/KernelDevice.cc b/src/blk/kernel/KernelDevice.cc index 444cf6b47dbc..b34ad11dd7cd 100644 --- a/src/blk/kernel/KernelDevice.cc +++ b/src/blk/kernel/KernelDevice.cc @@ -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); } diff --git a/src/blk/kernel/KernelDevice.h b/src/blk/kernel/KernelDevice.h index d95bffdbe7bd..fb206f6ba2de 100644 --- a/src/blk/kernel/KernelDevice.h +++ b/src/blk/kernel/KernelDevice.h @@ -148,7 +148,7 @@ public: int get_devices(std::set *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, diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 6844e8319e15..f58778aaae08 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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);