From: Sage Weil Date: Thu, 19 May 2016 12:47:44 +0000 (-0400) Subject: os/bluestore: only direct write into unused blob space X-Git-Tag: v11.0.0~359^2~56 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=499d7f6da0374c6f90c1174569ca55d6de2b9085;p=ceph.git os/bluestore: only direct write into unused blob space We can only do a direct write into an already-allocated blob once, if that range hasn't yet been used. Once it has been used, it is much to complex to keep track of when all references to it have committed to disk before reusing it, so we don't try to handle that case at all. Since the range has never been used, we can assert that there are no references to it. Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index b246156178d..382d3c4dcaf 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5427,14 +5427,14 @@ void BlueStore::_do_write_small( uint64_t b_off = offset - head_pad - bstart; uint64_t b_len = length + head_pad + tail_pad; if (b->get_ondisk_length() >= b_off + b_len && - b->is_unreferenced(b_off, b_len) && + b->is_unused(b_off, b_len) && (!b->has_csum_data() || (b_off % b->get_csum_block_size() == 0 && b_len % b->get_csum_block_size() == 0))) { -#warning this is currently racy; we may be pipelined with an op that derefs this range. once we have a buffer cache the problem will go away. - dout(20) << __func__ << " write to unreferenced 0x" << std::hex + dout(20) << __func__ << " write to unused 0x" << std::hex << b_off << "~0x" << b_len << " pad 0x" << head_pad << " + 0x" << tail_pad << std::dec << " of mutable " << blob << ": " << b << dendl; + assert(b->is_unreferenced(b_off, b_len)); b->map_bl(b_off, padded, [&](uint64_t offset, uint64_t length, bufferlist& t) { bdev->aio_write(offset, t,