]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: Writer, improved calculation of need_size
authorAdam Kupczyk <akupczyk@ibm.com>
Mon, 15 Jul 2024 14:33:24 +0000 (14:33 +0000)
committerAdam Kupczyk <akupczyk@ibm.com>
Wed, 7 Aug 2024 10:55:46 +0000 (10:55 +0000)
More diligent calcualtion algorithm of need_size.
Takes into account front and back alignment.

Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
src/os/bluestore/Writer.cc

index 0cf7e5c337803757644dfd2a7d7deb43d5790312..1ff84ecdeab7b3f60dbd4e8bcc83709397a74add 100644 (file)
@@ -1344,8 +1344,15 @@ void BlueStore::Writer::do_write(
     _try_put_data_on_allocated(location, data_end, ref_end, bd, after_punch_it);
   }
   if (location != data_end) {
-    uint32_t need_size = p2roundup(data_end, au_size) - p2align(location, au_size);
     // make a deferred decision
+    uint32_t need_size = 0;
+    uint32_t location_tmp = location;
+    for (auto& i : bd) {
+      uint32_t location_end = location_tmp + i.real_length;
+      need_size += p2roundup(location_end, au_size) - p2align(location_tmp, au_size);
+      location_tmp = location_end;
+    }
+
     _defer_or_allocate(need_size);
     _do_put_blobs(location, data_end, ref_end, bd, after_punch_it);
   } else {