From: Joshua Blanch Date: Tue, 6 Jan 2026 18:55:45 +0000 (+0000) Subject: os/bluestore: update bluefs volume selector X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2fc6f819411957d09614d5ca44a71c9773d3aca4;p=ceph.git os/bluestore: update bluefs volume selector Signed-off-by: Joshua Blanch --- diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index b17bf7720933..3144538fd306 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -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); diff --git a/src/os/bluestore/BlueFS.h b/src/os/bluestore/BlueFS.h index 30542966fb6f..094f5e8dcf33 100644 --- a/src/os/bluestore/BlueFS.h +++ b/src/os/bluestore/BlueFS.h @@ -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; + } + } }; /**