Skip to content

Commit 33b43af

Browse files
committed
os/bluestore: do not substract 'reserved' from bluefs bdev sizes
Signed-off-by: Igor Fedotov <[email protected]>
1 parent 1aae3b6 commit 33b43af

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/os/bluestore/BlueFS.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,7 @@ uint64_t BlueFS::get_used(unsigned id)
614614
uint64_t BlueFS::_get_total(unsigned id) const
615615
{
616616
ceph_assert(id < bdev.size());
617-
ceph_assert(id < block_reserved.size());
618-
return get_block_device_size(id) - block_reserved[id];
617+
return get_block_device_size(id);
619618
}
620619

621620
uint64_t BlueFS::get_total(unsigned id)
@@ -642,7 +641,7 @@ void BlueFS::dump_block_extents(ostream& out)
642641
if (!bdev[i] || !alloc[i]) {
643642
continue;
644643
}
645-
auto total = get_total(i) + block_reserved[i];
644+
auto total = get_total(i);
646645
auto free = get_free(i);
647646

648647
out << i << " : device size 0x" << std::hex << total
@@ -841,9 +840,8 @@ void BlueFS::_init_alloc()
841840
bdev[id]->get_size(),
842841
super.bluefs_max_alloc_size[id],
843842
name);
844-
alloc[id]->init_add_free(
845-
block_reserved[id],
846-
_get_total(id));
843+
auto reserved = block_reserved[id];
844+
alloc[id]->init_add_free(reserved, _get_total(id) - reserved);
847845
}
848846
}
849847
}

src/test/objectstore/test_bluefs.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ 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 - SUPER_RESERVED);
116-
ASSERT_LT(fs.get_free(BlueFS::BDEV_DB), size - SUPER_RESERVED);
115+
ASSERT_EQ(fs.get_total(BlueFS::BDEV_DB), size);
116+
ASSERT_LT(fs.get_free(BlueFS::BDEV_DB), size);
117117
fs.umount();
118118
}
119119

0 commit comments

Comments
 (0)