]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: do not substract 'reserved' from bluefs bdev sizes
authorIgor Fedotov <igor.fedotov@croit.io>
Fri, 28 Feb 2025 08:35:01 +0000 (11:35 +0300)
committerIgor Fedotov <igor.fedotov@croit.io>
Tue, 29 Apr 2025 09:01:50 +0000 (12:01 +0300)
Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
(cherry picked from commit 33b43af750fa2c62bf153b87124ee947460dac64)

src/os/bluestore/BlueFS.cc
src/test/objectstore/test_bluefs.cc

index e22f5df40cc4ab0c60e730d5184c5f928614e194..b7cfe352c887298b60ab9a634c5aaefb12fa21f4 100644 (file)
@@ -600,8 +600,7 @@ uint64_t BlueFS::get_used(unsigned id)
 uint64_t BlueFS::_get_total(unsigned id) const
 {
   ceph_assert(id < bdev.size());
-  ceph_assert(id < block_reserved.size());
-  return get_block_device_size(id) - block_reserved[id];
+  return get_block_device_size(id);
 }
 
 uint64_t BlueFS::get_total(unsigned id)
@@ -788,9 +787,8 @@ void BlueFS::_init_alloc()
                                    bdev[id]->get_size(),
                                    alloc_size[id],
                                    name);
-      alloc[id]->init_add_free(
-        block_reserved[id],
-        _get_total(id));
+      auto reserved = block_reserved[id];
+      alloc[id]->init_add_free(reserved, _get_total(id) - reserved);
     }
   }
 }
index 1fe2f985f8b9d02c6e099d5c1647912162055477..a00fe8b7f3c87c71e8ab2664a558b53673134ca6 100644 (file)
@@ -107,8 +107,8 @@ TEST(BlueFS, mkfs_mount) {
   ASSERT_EQ(0, fs.mkfs(fsid, { BlueFS::BDEV_DB, false, false }));
   ASSERT_EQ(0, fs.mount());
   ASSERT_EQ(0, fs.maybe_verify_layout({ BlueFS::BDEV_DB, false, false }));
-  ASSERT_EQ(fs.get_total(BlueFS::BDEV_DB), size - SUPER_RESERVED);
-  ASSERT_LT(fs.get_free(BlueFS::BDEV_DB), size - SUPER_RESERVED);
+  ASSERT_EQ(fs.get_total(BlueFS::BDEV_DB), size);
+  ASSERT_LT(fs.get_free(BlueFS::BDEV_DB), size);
   fs.umount();
 }