From: Adam Kupczyk Date: Tue, 16 Jan 2024 10:37:07 +0000 (+0000) Subject: os/bluestore: Added new write path with BlueStore X-Git-Tag: v20.0.0~1280^2~21 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f0c82b3720133d7919a04580b583b2023d4a0ff2;p=ceph.git os/bluestore: Added new write path with BlueStore Added _do_write_v2 function to BlueStore. Function is not integrated yet. Signed-off-by: Adam Kupczyk --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 03d66222e0e56..d01ce24fa1504 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -54,6 +54,7 @@ #include "common/pretty_binary.h" #include "common/WorkQueue.h" #include "kv/KeyValueHistogram.h" +#include "Writer.h" #if defined(WITH_LTTNG) #define TRACEPOINT_DEFINE @@ -17334,6 +17335,55 @@ int BlueStore::_do_write( return r; } +int BlueStore::_do_write_v2( + TransContext *txc, + CollectionRef& c, + OnodeRef& o, + uint64_t offset, + uint64_t length, + bufferlist& bl, + uint32_t fadvise_flags) +{ + int r = 0; + + dout(20) << __func__ + << " " << o->oid + << " 0x" << std::hex << offset << "~" << length + << " - have 0x" << o->onode.size + << " (" << std::dec << o->onode.size << ")" + << " bytes" << std::hex + << " fadvise_flags 0x" << fadvise_flags + << " alloc_hint 0x" << o->onode.alloc_hint_flags + << " expected_object_size " << o->onode.expected_object_size + << " expected_write_size " << o->onode.expected_write_size + << std::dec + << dendl; + _dump_onode<30>(cct, *o); + if (length == 0) { + return 0; + } + if (bl.length() != length) { + bl.splice(length, bl.length() - length); + } + WriteContext wctx; + _choose_write_options(c, o, fadvise_flags, &wctx); + 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); + return r; +} + int BlueStore::_write(TransContext *txc, CollectionRef& c, OnodeRef& o, diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index acba359902e60..4aac566c61cab 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -3822,6 +3822,13 @@ private: uint64_t length, ceph::buffer::list& bl, WriteContext *wctx); + int _do_write_v2( + TransContext *txc, + CollectionRef &c, + OnodeRef& o, + uint64_t offset, uint64_t length, + ceph::buffer::list& bl, + uint32_t fadvise_flags); int _touch(TransContext *txc, CollectionRef& c,