From: Adam Kupczyk Date: Thu, 1 Aug 2024 11:54:21 +0000 (+0000) Subject: os/bluestore: Write_v2 changes X-Git-Tag: testing/wip-vshankar-testing-20240814.051758-debug~10^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=1b24c7cb53fb82d49d086d06e8ffd902ee0c6e40;p=ceph-ci.git os/bluestore: Write_v2 changes 1) moved stats and blobs update to Writer::do_write 2) preallocate space in Writer:_split_data 3) fixed Writer::_write_expand_l that could check one extent too much Signed-off-by: Adam Kupczyk --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index d35a59a4639..f3710349cea 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -17379,14 +17379,6 @@ int BlueStore::_do_write_v2( o->extent_map.fault_range(db, offset, length); BlueStore::Writer wr(this, txc, &wctx, o); wr.do_write(offset, bl); - // equivalent of wctx_finish - // do_write updates allocations itself - // update statfs - txc->statfs_delta += wr.statfs_delta; - // update shared blobs - for (auto b: wr.shared_changed) { - txc->write_shared_blob(b); - } o->extent_map.compress_extent_map(offset, length); o->extent_map.dirty_range(offset, length); o->extent_map.maybe_reshard(offset, offset + length); diff --git a/src/os/bluestore/Writer.cc b/src/os/bluestore/Writer.cc index 4b9733470b1..725f1526213 100644 --- a/src/os/bluestore/Writer.cc +++ b/src/os/bluestore/Writer.cc @@ -1101,11 +1101,12 @@ std::pair BlueStore::Writer::_write_expand_l( bool new_data_pad = true; // unless otherwise stated, we pad exmp_it it = onode->extent_map.seek_lextent(logical_offset); // it can be extent in which we are interested in - if (it == onode->extent_map.extent_map.end()) { + if (it == onode->extent_map.extent_map.end() || + it->logical_offset >= logical_offset) { if (it == onode->extent_map.extent_map.begin()) { goto done; } - --it; //step back to first element + --it; //step back to the first extent to consider } do { if (it->logical_end() < off_stop) { @@ -1247,6 +1248,8 @@ void BlueStore::Writer::_split_data( bufferlist& data, blob_vec& bd) { + ceph_assert(bd.empty()); + bd.reserve(data.length() / wctx->target_blob_size + 2); auto lof = location; uint32_t end_offset = location + data.length(); while (lof < end_offset) { @@ -1371,6 +1374,12 @@ void BlueStore::Writer::do_write( if (onode->onode.size < ref_end) onode->onode.size = ref_end; _collect_released_allocated(); + // update statfs + txc->statfs_delta += statfs_delta; + // update shared blobs + for (auto b: shared_changed) { + txc->write_shared_blob(b); + } dout(25) << "result: " << std::endl << onode->print(pp_mode) << dendl; }