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);
/* 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 {
// 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 {
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;
+ }
+ }
};
/**