From: Sage Weil Date: Mon, 20 Jun 2016 19:22:51 +0000 (-0400) Subject: os/bluestore: limit read-amp on overwrite X-Git-Tag: v11.0.0~98^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=93c164a5d4a8bdd961a6ce9eb5f94eeaca752ca2;p=ceph-ci.git os/bluestore: limit read-amp on overwrite 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 --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 10ea00ba37b..c42cc85666a 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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) {