]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Restore zero-copy buffers in OSD fast path.
authorMatt Benjamin <matt@cohortfs.com>
Wed, 24 Sep 2014 16:06:05 +0000 (11:06 -0500)
committerMatt Benjamin <matt@cohortfs.com>
Thu, 11 Dec 2014 00:12:55 +0000 (19:12 -0500)
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 <matt@cohortfs.com>
src/msg/Message.h
src/os/FileJournal.cc
src/os/FileJournal.h

index 87671dc10fbdda26b96474664546970904f0b815..9df503ab5a1c0b252a640e4910c4fe715e2a8019 100644 (file)
@@ -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());
   }
index 388190f18800c7f576967550c158fb30070684d6..221c037747db5a4e01e638e46c4437542221cdba 100644 (file)
@@ -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);
index 878b9094b6687f6083ab9cd59649a8bd3a360f04..2c51da0fc01a86214d58e0f7852b079fc31beb56 100644 (file)
@@ -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) {}
   };