]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: Added new write path with BlueStore
authorAdam Kupczyk <akupczyk@ibm.com>
Tue, 16 Jan 2024 10:37:07 +0000 (10:37 +0000)
committerAdam Kupczyk <akupczyk@ibm.com>
Wed, 7 Aug 2024 10:55:46 +0000 (10:55 +0000)
Added _do_write_v2 function to BlueStore.
Function is not integrated yet.

Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 03d66222e0e5617669a67577926cc07975326be7..d01ce24fa15042477c3eb2e3d0286e2e41c0f604 100644 (file)
@@ -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,
index acba359902e6071d852dae76522ecbde0e3cd6b5..4aac566c61cab0a30283c0e19e4724c4df265118 100644 (file)
@@ -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,