]> 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>
Fri, 21 Mar 2025 17:25:20 +0000 (20:25 +0300)
Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
src/os/bluestore/BlueFS.cc
src/test/objectstore/test_bluefs.cc

index ad1327ebb8d850fafee38fab216da97456997e20..131983860dafc21eaefba85bbd955311953946cc 100644 (file)
@@ -614,8 +614,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)
@@ -642,7 +641,7 @@ void BlueFS::dump_block_extents(ostream& out)
     if (!bdev[i] || !alloc[i]) {
       continue;
     }
-    auto total = get_total(i) + block_reserved[i];
+    auto total = get_total(i);
     auto free = get_free(i);
 
     out << i << " : device size 0x" << std::hex << total
@@ -841,9 +840,8 @@ void BlueFS::_init_alloc()
                                    bdev[id]->get_size(),
                                    super.bluefs_max_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 ebf47158e0c596b14a0a44a2b3948b63cb47f38d..f77774cde787405c32bf4473c1d58e547ec49ded 100644 (file)
@@ -112,8 +112,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();
 }