From: Matt Benjamin Date: Wed, 24 Sep 2014 16:06:05 +0000 (-0500) Subject: Restore zero-copy buffers in OSD fast path. X-Git-Tag: v0.91~39^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=28725eb2e4e97f7cf06ffae9445c96df388a6a2e;p=ceph.git Restore zero-copy buffers in OSD fast path. This change restores volatile sharing semantics in the Message decode path, and also in the OSD write path for FileStore/FileJournal. This can be verified with a breakpoint set at the clone/COW case in buffer::ptr::make_shareable(currently buffer.cc:690). Signed-off-by: Matt Benjamin --- diff --git a/src/msg/Message.h b/src/msg/Message.h index 87671dc10fbd..9df503ab5a1c 100644 --- a/src/msg/Message.h +++ b/src/msg/Message.h @@ -314,7 +314,7 @@ public: void set_payload(bufferlist& bl) { if (byte_throttler) byte_throttler->put(payload.length()); - payload.claim(bl); + payload.claim(bl, buffer::list::CLAIM_ALLOW_NONSHAREABLE); if (byte_throttler) byte_throttler->take(payload.length()); } @@ -322,16 +322,16 @@ public: void set_middle(bufferlist& bl) { if (byte_throttler) byte_throttler->put(payload.length()); - middle.claim(bl); + middle.claim(bl, buffer::list::CLAIM_ALLOW_NONSHAREABLE); if (byte_throttler) byte_throttler->take(payload.length()); } bufferlist& get_middle() { return middle; } - void set_data(const bufferlist &d) { + void set_data(const bufferlist &bl) { if (byte_throttler) byte_throttler->put(data.length()); - data = d; + data.share(bl); if (byte_throttler) byte_throttler->take(data.length()); } diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index 388190f18800..221c037747db 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -913,7 +913,7 @@ int FileJournal::prepare_single_write(bufferlist& bl, off64_t& queue_pos, uint64 bufferptr bp = buffer::create_static(pre_pad, zero_buf); bl.push_back(bp); } - bl.claim_append(ebl); + bl.claim_append(ebl, buffer::list::CLAIM_ALLOW_NONSHAREABLE); // potential zero-copy if (h.post_pad) { bufferptr bp = buffer::create_static(post_pad, zero_buf); diff --git a/src/os/FileJournal.h b/src/os/FileJournal.h index 878b9094b668..2c51da0fc01a 100644 --- a/src/os/FileJournal.h +++ b/src/os/FileJournal.h @@ -54,7 +54,7 @@ public: TrackedOpRef tracked_op; write_item(uint64_t s, bufferlist& b, int al, TrackedOpRef opref) : seq(s), alignment(al), tracked_op(opref) { - bl.claim(b); + bl.claim(b, buffer::list::CLAIM_ALLOW_NONSHAREABLE); // potential zero-copy } write_item() : seq(0), alignment(0) {} };