]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: account for alignment with max_blob_size when splitting
authorIgor Fedotov <ifedotov@suse.com>
Mon, 9 Aug 2021 15:18:35 +0000 (18:18 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Tue, 10 Aug 2021 11:34:17 +0000 (14:34 +0300)
write I/O into chunks.

Without the fix the following write seq:
0~4M
4096~4M

produces tons of deferred writes at the second stage.

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/os/bluestore/BlueStore.cc

index b6809e8464bc469258abe8e04d7c852331a57917..fbc448e32256f63e1b0208045859f20934584a67 100644 (file)
@@ -13849,12 +13849,16 @@ void BlueStore::_do_write_big(
   uint64_t prefer_deferred_size_snapshot = prefer_deferred_size.load();
   while (length > 0) {
     bool new_blob = false;
-    uint32_t l = std::min(max_bsize, length);
     BlobRef b;
     uint32_t b_off = 0;
+    uint32_t l = 0;
 
     //attempting to reuse existing blob
     if (!wctx->compress) {
+      // enforce target blob alignment with max_bsize
+      l = max_bsize - p2phase(offset, max_bsize);
+      l = std::min(uint64_t(l), length);
+
       auto end = o->extent_map.extent_map.end();
 
       dout(20) << __func__ << " may be defer: 0x" << std::hex
@@ -14003,6 +14007,8 @@ void BlueStore::_do_write_big(
        }
       } while (b == nullptr && any_change);
     } else {
+      // trying to utilize as longer chunk as permitted in case of compression.
+      l = std::min(max_bsize, length);
       o->extent_map.punch_hole(c, offset, l, &wctx->old_extents);
     } // if (!wctx->compress)