]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/rados: reduce rados put memory usage by op_size 7928/head
authorPiotr Dałek <piotr.dalek@ts.fujitsu.com>
Fri, 4 Mar 2016 13:43:09 +0000 (14:43 +0100)
committerPiotr Dałek <piotr.dalek@ts.fujitsu.com>
Mon, 7 Mar 2016 07:26:37 +0000 (08:26 +0100)
indata.append(char*, len) causes buffer "buf" to be physically copied
to new memory block. Make static buffer pointing to buf so we don't need
any intermediate copies. This reduces memory usage by op_size, and also
cpu usage by a bit (no memmove necessary).

Signed-off-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
src/tools/rados/rados.cc

index d46f3a153c4c7117000fecdb48a735e7d32b40ac..d3b37abaf5dd45e3ae7f4b2371e06f4ce29b9bf1 100644 (file)
@@ -429,7 +429,7 @@ static int do_put(IoCtx& io_ctx, RadosStriper& striper,
       }
       continue;
     }
-    indata.append(buf, count);
+    indata.append(buffer::ptr(buffer::create_static(count, buf)));
     if (use_striper) {
       if (offset == 0)
        ret = striper.write_full(oid, indata);