Skip to content

Commit acdd0e3

Browse files
committed
os/bluestore: get rid off BlueFS::get_block_device_size
Signed-off-by: Igor Fedotov <[email protected]>
1 parent e9d3ea8 commit acdd0e3

File tree

3 files changed

+13
-21
lines changed

3 files changed

+13
-21
lines changed

src/os/bluestore/BlueFS.cc

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -552,13 +552,6 @@ bool BlueFS::bdev_support_label(unsigned id)
552552
return bdev[id]->supported_bdev_label();
553553
}
554554

555-
uint64_t BlueFS::get_block_device_size(unsigned id) const
556-
{
557-
if (id < bdev.size() && bdev[id])
558-
return bdev[id]->get_size();
559-
return 0;
560-
}
561-
562555
BlockDevice* BlueFS::get_block_device(unsigned id) const
563556
{
564557
if (id < bdev.size() && bdev[id])
@@ -609,7 +602,7 @@ uint64_t BlueFS::get_used(unsigned id)
609602
uint64_t BlueFS::_get_total(unsigned id) const
610603
{
611604
ceph_assert(id < bdev.size());
612-
return get_block_device_size(id);
605+
return bdev[id] ? bdev[id]->get_size() : 0;
613606
}
614607

615608
uint64_t BlueFS::get_total(unsigned id)
@@ -702,9 +695,9 @@ int BlueFS::mkfs(uuid_d osd_uuid, const bluefs_layout_t& layout)
702695
if (vselector == nullptr) {
703696
vselector.reset(
704697
new OriginalVolumeSelector(
705-
get_block_device_size(BlueFS::BDEV_WAL) * 95 / 100,
706-
get_block_device_size(BlueFS::BDEV_DB) * 95 / 100,
707-
get_block_device_size(BlueFS::BDEV_SLOW) * 95 / 100));
698+
_get_total(BlueFS::BDEV_WAL) * 95 / 100,
699+
_get_total(BlueFS::BDEV_DB) * 95 / 100,
700+
_get_total(BlueFS::BDEV_SLOW) * 95 / 100));
708701
}
709702

710703
_init_logger();
@@ -1057,9 +1050,9 @@ int BlueFS::mount()
10571050
if (vselector == nullptr) {
10581051
vselector.reset(
10591052
new OriginalVolumeSelector(
1060-
get_block_device_size(BlueFS::BDEV_WAL) * 95 / 100,
1061-
get_block_device_size(BlueFS::BDEV_DB) * 95 / 100,
1062-
get_block_device_size(BlueFS::BDEV_SLOW) * 95 / 100));
1053+
_get_total(BlueFS::BDEV_WAL) * 95 / 100,
1054+
_get_total(BlueFS::BDEV_DB) * 95 / 100,
1055+
_get_total(BlueFS::BDEV_SLOW) * 95 / 100));
10631056
}
10641057

10651058
_init_alloc();

src/os/bluestore/BlueFS.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,6 @@ class BlueFS {
773773
int add_block_device(unsigned bdev, const std::string& path, bool trim,
774774
bluefs_shared_alloc_context_t* _shared_alloc = nullptr);
775775
bool bdev_support_label(unsigned id);
776-
uint64_t get_block_device_size(unsigned bdev) const;
777776
BlockDevice* get_block_device(unsigned bdev) const;
778777

779778
// handler for discard event

src/os/bluestore/BlueStore.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7698,16 +7698,16 @@ int BlueStore::_open_bluefs(bool create, bool read_only)
76987698
}
76997699
if (cct->_conf->bluestore_volume_selection_policy == "fit_to_fast") {
77007700
vselector = new FitToFastVolumeSelector(
7701-
bluefs->get_block_device_size(BlueFS::BDEV_WAL) * 95 / 100,
7702-
bluefs->get_block_device_size(BlueFS::BDEV_DB) * 95 / 100,
7703-
bluefs->get_block_device_size(BlueFS::BDEV_SLOW) * 95 / 100);
7701+
bluefs->get_total(BlueFS::BDEV_WAL) * 95 / 100,
7702+
bluefs->get_total(BlueFS::BDEV_DB) * 95 / 100,
7703+
bluefs->get_total(BlueFS::BDEV_SLOW) * 95 / 100);
77047704
} else {
77057705
double reserved_factor = cct->_conf->bluestore_volume_selection_reserved_factor;
77067706
vselector =
77077707
new RocksDBBlueFSVolumeSelector(
7708-
bluefs->get_block_device_size(BlueFS::BDEV_WAL) * 95 / 100,
7709-
bluefs->get_block_device_size(BlueFS::BDEV_DB) * 95 / 100,
7710-
bluefs->get_block_device_size(BlueFS::BDEV_SLOW) * 95 / 100,
7708+
bluefs->get_total(BlueFS::BDEV_WAL) * 95 / 100,
7709+
bluefs->get_total(BlueFS::BDEV_DB) * 95 / 100,
7710+
bluefs->get_total(BlueFS::BDEV_SLOW) * 95 / 100,
77117711
rocks_opts.write_buffer_size * rocks_opts.max_write_buffer_number,
77127712
rocks_opts.max_bytes_for_level_base,
77137713
rocks_opts.max_bytes_for_level_multiplier,

0 commit comments

Comments
 (0)