Skip to content

Commit

Permalink
tools/rados: reduce rados put memory usage by op_size
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Piotr Dałek committed Mar 7, 2016
1 parent 7e95acb commit 5810eb0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tools/rados/rados.cc
Expand Up @@ -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);
Expand Down

0 comments on commit 5810eb0

Please sign in to comment.