]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: update bluefs volume selector
authorJoshua Blanch <joshua.blanch@clyso.com>
Tue, 6 Jan 2026 18:55:45 +0000 (18:55 +0000)
committerJoshua Blanch <joshua.blanch@clyso.com>
Thu, 23 Apr 2026 15:05:55 +0000 (15:05 +0000)
Signed-off-by: Joshua Blanch <joshua.blanch@clyso.com>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h

index b17bf7720933afa8da40b5617d736dcb5a18c4ea..3144538fd306d14f5221460f71abd1d507151a1a 100644 (file)
@@ -938,6 +938,11 @@ void BlueFS::expand_device(unsigned devid, uint64_t new_size, uint64_t old_size)
   auto aligned_size = p2align(new_size, alloc_size[devid]);
   alloc[devid]->init_add_free(old_size, aligned_size - old_size);
 
+  if (vselector) {
+    vselector->expand_device(devid, aligned_size);
+    vselector->update_from_config(cct);
+  }
+
   uint64_t total = get_block_device_size(devid);
   uint64_t free = get_free(devid);
   ceph_assert(total > total - free);
index 30542966fb6fdc20718a1f449c9cf8850fae3178..094f5e8dcf33785f6cf05a54b580359da8f29ca0 100644 (file)
@@ -211,6 +211,15 @@ public:
   /* used for sanity checking of vselector */
   virtual BlueFSVolumeSelector* clone_empty() const { return nullptr; }
   virtual bool compare(BlueFSVolumeSelector* other) { return true; };
+
+  /**
+  *  Update device total size after online expansion
+  *  Parameters:
+  *    dev_id: BlueFS device id (BDEV_WAL, BDEV_DB, BDEV_SLOW)
+  *    new_size: new total size of the device
+  *
+  */
+  virtual void expand_device(uint8_t dev_id, uint64_t new_size) = 0;
 };
 
 struct bluefs_shared_alloc_context_t {
@@ -1010,6 +1019,22 @@ public:
     // do nothing
     return;
   }
+
+  void expand_device(uint8_t dev_id, uint64_t new_size) override {
+    switch (dev_id) {
+    case BlueFS::BDEV_WAL:
+      wal_total = new_size;
+      break;
+    case BlueFS::BDEV_DB:
+      db_total = new_size;
+      break;
+    case BlueFS::BDEV_SLOW:
+      slow_total = new_size;
+      break;
+    default:
+      break;
+    }
+  }
 };
 
 class FitToFastVolumeSelector : public OriginalVolumeSelector {
@@ -1259,6 +1284,22 @@ public:
   void dump(std::ostream& sout) override;
   BlueFSVolumeSelector* clone_empty() const override;
   bool compare(BlueFSVolumeSelector* other) override;
+
+  void expand_device(uint8_t dev_id, uint64_t new_size) override {
+    switch (dev_id) {
+    case BlueFS::BDEV_WAL:
+      l_totals[LEVEL_WAL - LEVEL_FIRST] = new_size;
+      break;
+    case BlueFS::BDEV_DB:
+      l_totals[LEVEL_DB - LEVEL_FIRST] = new_size;
+      break;
+    case BlueFS::BDEV_SLOW:
+      l_totals[LEVEL_SLOW - LEVEL_FIRST] = new_size;
+      break;
+    default:
+      break;
+    }
+  }
 };
 
 /**