Skip to content

Commit d6a2d37

Browse files
committed
os/bluestore: rename BlueFS::get_total -> get_block_device_size()
Signed-off-by: Igor Fedotov <[email protected]>
1 parent 2e3578b commit d6a2d37

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

src/os/bluestore/BlueFS.cc

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class BlueFS::SocketHook : public AdminSocketHook {
134134
f->open_object_section("dev");
135135
f->dump_string("device", bluefs->get_device_name(dev));
136136
ceph_assert(bluefs->alloc[dev]);
137-
auto total = bluefs->get_total(dev);
137+
auto total = bluefs->get_block_device_size(dev);
138138
auto free = bluefs->get_free(dev);
139139
auto used = bluefs->get_used(dev);
140140

@@ -480,15 +480,15 @@ void BlueFS::_shutdown_logger()
480480
void BlueFS::_update_logger_stats()
481481
{
482482
if (alloc[BDEV_WAL]) {
483-
logger->set(l_bluefs_wal_total_bytes, _get_total(BDEV_WAL));
483+
logger->set(l_bluefs_wal_total_bytes, _get_block_device_size(BDEV_WAL));
484484
logger->set(l_bluefs_wal_used_bytes, _get_used(BDEV_WAL));
485485
}
486486
if (alloc[BDEV_DB]) {
487-
logger->set(l_bluefs_db_total_bytes, _get_total(BDEV_DB));
487+
logger->set(l_bluefs_db_total_bytes, _get_block_device_size(BDEV_DB));
488488
logger->set(l_bluefs_db_used_bytes, _get_used(BDEV_DB));
489489
}
490490
if (alloc[BDEV_SLOW]) {
491-
logger->set(l_bluefs_slow_total_bytes, _get_total(BDEV_SLOW));
491+
logger->set(l_bluefs_slow_total_bytes, _get_block_device_size(BDEV_SLOW));
492492
logger->set(l_bluefs_slow_used_bytes, _get_used(BDEV_SLOW));
493493
}
494494
}
@@ -587,7 +587,7 @@ uint64_t BlueFS::_get_used(unsigned id) const
587587
if (is_shared_alloc(id)) {
588588
used = shared_alloc->bluefs_used;
589589
} else {
590-
used = _get_total(id) - alloc[id]->get_free();
590+
used = _get_block_device_size(id) - alloc[id]->get_free();
591591
}
592592
return used;
593593
}
@@ -599,15 +599,15 @@ uint64_t BlueFS::get_used(unsigned id)
599599
return _get_used(id);
600600
}
601601

602-
uint64_t BlueFS::_get_total(unsigned id) const
602+
uint64_t BlueFS::_get_block_device_size(unsigned id) const
603603
{
604604
ceph_assert(id < bdev.size());
605605
return bdev[id] ? bdev[id]->get_size() : 0;
606606
}
607607

608-
uint64_t BlueFS::get_total(unsigned id)
608+
uint64_t BlueFS::get_block_device_size(unsigned id)
609609
{
610-
return _get_total(id);
610+
return _get_block_device_size(id);
611611
}
612612

613613
uint64_t BlueFS::get_free(unsigned id)
@@ -658,7 +658,7 @@ void BlueFS::dump_block_extents(ostream& out)
658658
if (!bdev[i] || !alloc[i]) {
659659
continue;
660660
}
661-
auto total = get_total(i);
661+
auto total = get_block_device_size(i);
662662
auto free = get_free(i);
663663

664664
out << i << " : device size 0x" << std::hex << total
@@ -695,9 +695,9 @@ int BlueFS::mkfs(uuid_d osd_uuid, const bluefs_layout_t& layout)
695695
if (vselector == nullptr) {
696696
vselector.reset(
697697
new OriginalVolumeSelector(
698-
_get_total(BlueFS::BDEV_WAL) * 95 / 100,
699-
_get_total(BlueFS::BDEV_DB) * 95 / 100,
700-
_get_total(BlueFS::BDEV_SLOW) * 95 / 100));
698+
_get_block_device_size(BlueFS::BDEV_WAL) * 95 / 100,
699+
_get_block_device_size(BlueFS::BDEV_DB) * 95 / 100,
700+
_get_block_device_size(BlueFS::BDEV_SLOW) * 95 / 100));
701701
}
702702

703703
_init_logger();
@@ -816,7 +816,7 @@ void BlueFS::_init_alloc()
816816
// isn't aligned with recommended alloc unit.
817817
// Final decision whether locked tail to be maintained is made after
818818
// BlueFS replay depending on existing allocations.
819-
uint64_t size0 = _get_total(id);
819+
uint64_t size0 = _get_block_device_size(id);
820820
uint64_t size = size0 - reserved;
821821
size = p2align(size, alloc_size[id]) + reserved;
822822
if (size < size0) {
@@ -839,7 +839,7 @@ void BlueFS::_init_alloc()
839839
bdev[id]->get_size(),
840840
bdev[id]->get_block_size(),
841841
name);
842-
uint64_t free_len = locked_offs ? locked_offs : _get_total(id) - reserved;
842+
uint64_t free_len = locked_offs ? locked_offs : _get_block_device_size(id) - reserved;
843843
alloc[id]->init_add_free(reserved, free_len);
844844
}
845845
}
@@ -1050,9 +1050,9 @@ int BlueFS::mount()
10501050
if (vselector == nullptr) {
10511051
vselector.reset(
10521052
new OriginalVolumeSelector(
1053-
_get_total(BlueFS::BDEV_WAL) * 95 / 100,
1054-
_get_total(BlueFS::BDEV_DB) * 95 / 100,
1055-
_get_total(BlueFS::BDEV_SLOW) * 95 / 100));
1053+
_get_block_device_size(BlueFS::BDEV_WAL) * 95 / 100,
1054+
_get_block_device_size(BlueFS::BDEV_DB) * 95 / 100,
1055+
_get_block_device_size(BlueFS::BDEV_SLOW) * 95 / 100));
10561056
}
10571057

10581058
_init_alloc();

src/os/bluestore/BlueFS.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ class BlueFS {
556556
void _pad_bl(ceph::buffer::list& bl, uint64_t pad_size = 0);
557557

558558
uint64_t _get_used(unsigned id) const;
559-
uint64_t _get_total(unsigned id) const;
559+
uint64_t _get_block_device_size(unsigned id) const;
560560
uint64_t _get_minimal_reserved(unsigned id) const;
561561

562562
FileRef _get_file(uint64_t ino);
@@ -708,7 +708,7 @@ class BlueFS {
708708
const bluefs_layout_t& layout);
709709

710710
uint64_t get_used();
711-
uint64_t get_total(unsigned id);
711+
uint64_t get_block_device_size(unsigned id);
712712
uint64_t get_free(unsigned id);
713713
uint64_t get_used(unsigned id);
714714
uint64_t get_full_reserved(unsigned id);

src/os/bluestore/BlueStore.cc

Lines changed: 8 additions & 8 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_total(BlueFS::BDEV_WAL) * 95 / 100,
7702-
bluefs->get_total(BlueFS::BDEV_DB) * 95 / 100,
7703-
bluefs->get_total(BlueFS::BDEV_SLOW) * 95 / 100);
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);
77047704
} else {
77057705
double reserved_factor = cct->_conf->bluestore_volume_selection_reserved_factor;
77067706
vselector =
77077707
new RocksDBBlueFSVolumeSelector(
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,
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,
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,
@@ -12120,7 +12120,7 @@ void BlueStore::_get_statfs_overall(struct store_statfs_t *buf)
1212012120
buf->internally_reserved = 0;
1212112121
// include dedicated db, too, if that isn't the shared device.
1212212122
if (bluefs_layout.shared_bdev != BlueFS::BDEV_DB) {
12123-
buf->total += bluefs->get_total(BlueFS::BDEV_DB);
12123+
buf->total += bluefs->get_block_device_size(BlueFS::BDEV_DB);
1212412124
}
1212512125
// call any non-omap bluefs space "internal metadata"
1212612126
buf->internal_metadata =
@@ -19138,7 +19138,7 @@ void BlueStore::_log_alerts(osd_alert_list_t& alerts)
1913819138
bluefs->get_used(BlueFS::BDEV_SLOW) : 0;
1913919139
if (used > 0) {
1914019140
auto db_used = bluefs->get_used(BlueFS::BDEV_DB);
19141-
auto db_total = bluefs->get_total(BlueFS::BDEV_DB);
19141+
auto db_total = bluefs->get_block_device_size(BlueFS::BDEV_DB);
1914219142
ostringstream ss;
1914319143
ss << "spilled over " << byte_u_t(used)
1914419144
<< " metadata from 'db' device (" << byte_u_t(db_used)

src/test/objectstore/test_bluefs.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ TEST(BlueFS, mkfs_mount) {
112112
ASSERT_EQ(0, fs.mkfs(fsid, { BlueFS::BDEV_DB, false, false }));
113113
ASSERT_EQ(0, fs.mount());
114114
ASSERT_EQ(0, fs.maybe_verify_layout({ BlueFS::BDEV_DB, false, false }));
115-
ASSERT_EQ(fs.get_total(BlueFS::BDEV_DB), size);
115+
ASSERT_EQ(fs.get_block_device_size(BlueFS::BDEV_DB), size);
116116
ASSERT_LT(fs.get_free(BlueFS::BDEV_DB), size);
117117
fs.umount();
118118
}

0 commit comments

Comments
 (0)