]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: limit read-amp on overwrite 9828/head
authorSage Weil <sage@redhat.com>
Mon, 20 Jun 2016 19:22:51 +0000 (15:22 -0400)
committerSage Weil <sage@redhat.com>
Mon, 20 Jun 2016 19:57:29 +0000 (15:57 -0400)
If we are doing a small overwrite over a blob with a large chunk size
(say, due to a large csum order), we are better off writing into a new
allocation than doing a large read/modify/write.  If the read amp will be
more than min_alloc_size, skip the read entirely and write into a new
blob.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc

index 10ea00ba37bde215420ba6d1219954fcd90cfd85..c42cc85666af6fb08cab05463b6145fea8970fe1 100644 (file)
@@ -5419,7 +5419,8 @@ void BlueStore::_do_write_small(
     uint64_t tail_read =
       ROUND_UP_TO(b_off + b_len, chunk_size) - (b_off + b_len);
     if ((head_read || tail_read) &&
-       (b->blob.get_ondisk_length() >= b_off + b_len + tail_read)) {
+       (b->blob.get_ondisk_length() >= b_off + b_len + tail_read) &&
+       head_read + tail_read < min_alloc_size) {
       dout(20) << __func__ << "  reading head 0x" << std::hex << head_read
               << " and tail 0x" << tail_read << std::dec << dendl;
       if (head_read) {