]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/block: fix the device size calculation.
authorAravind Ramesh <Aravind.Ramesh@wdc.com>
Tue, 30 Aug 2022 11:33:27 +0000 (17:03 +0530)
committerAravind <aravind.ramesh@wdc.com>
Fri, 2 Sep 2022 05:07:05 +0000 (10:37 +0530)
In BlockSegmentManager, super block is updated with device size.
But a small amount of device capacity is reserved to store the
super block information and other tracking information.
Number of segments is calculated after discounting super block
size and tracking information size. This creates a mismatch
with the actual available size versus actual number of segments.

Update the available size after considering the reserved device
capacity and the number of segments and segment size.

Signed-off-by: Aravind Ramesh <aravind.ramesh@wdc.com>
src/crimson/os/seastore/segment_manager/block.cc

index 7b4b004dd95e70171b4d77684ea5069ff8c40ddf..36be358bde68448399aa67e4b5da3c68516b4841 100644 (file)
@@ -219,11 +219,13 @@ block_sm_superblock_t make_superblock(
   size_t tracker_off = data.block_size;
   size_t first_seg_off = tracker_size + tracker_off;
   size_t segments = (size - first_seg_off) / config_segment_size;
+  size_t available_size = segments * config_segment_size;
 
-  INFO("{} disk_size={}, segment_size={}, segments={}, block_size={}, "
-       "tracker_off={}, first_seg_off={}",
+  INFO("{} disk_size={}, available_size={}, segment_size={}, segments={}, "
+       "block_size={}, tracker_off={}, first_seg_off={}",
        device_id_printer_t{device_id},
        size,
+       available_size,
        config_segment_size,
        segments,
        data.block_size,
@@ -231,7 +233,7 @@ block_sm_superblock_t make_superblock(
        first_seg_off);
 
   return block_sm_superblock_t{
-    size,
+    available_size,
     config_segment_size,
     data.block_size,
     segments,