From: Sage Weil Date: Thu, 26 May 2016 15:11:55 +0000 (-0400) Subject: os/bluestore: use WriteContext and do_alloc_write for _do_write_small X-Git-Tag: v11.0.0~359^2~17 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=326bb0f865c8092727949f6492bb20449de6f7c2;p=ceph.git os/bluestore: use WriteContext and do_alloc_write for _do_write_small Kill some mostly-duplicated code Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 229990917360..91ec3f67ff93 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5477,37 +5477,10 @@ void BlueStore::_do_write_small( bluestore_lextent_t& lex = o->onode.extent_map[offset] = bluestore_lextent_t(blob, offset % min_alloc_size, length); b->ref_map.get(lex.offset, lex.length); - // it's little; don't bother compressing - b->set_flag(bluestore_blob_t::FLAG_MUTABLE); - if (csum_type) { - // it's little; csum at block granularity. - b->init_csum(csum_type, block_size_order, min_alloc_size); - b->calc_csum(b_off, bl); - } - - // allocate and write - int r = alloc->reserve(min_alloc_size); - if (r < 0) { - derr << __func__ << " failed to reserve 0x" << std::hex << min_alloc_size - << std::dec << dendl; - assert(0 == "enospc"); - } - bluestore_pextent_t e; - uint32_t l; - r = alloc->allocate(min_alloc_size, min_alloc_size, 0 /* fixme hint */, - &e.offset, &l); - assert(r == 0); - e.length = l; - txc->allocated.insert(e.offset, e.length); - b->extents.push_back(e); - b->map_bl( - b_off, bl, - [&](uint64_t offset, uint64_t length, bufferlist& t) { - bdev->aio_write(offset, t, &txc->ioc, wctx->buffered); - }); dout(20) << __func__ << " lex 0x" << std::hex << offset << std::dec << ": " << lex << dendl; dout(20) << __func__ << " new " << blob << ": " << *b << dendl; + wctx->write(b, b_off, bl); return; }