When call rados_getxattr, pass user buff to libardos to avoid memcopy.
This operation like rados_read.
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
::ObjectOperation rd;
prepare_assert_ops(&rd);
rd.getxattr(name, &bl, NULL);
- int r = operate_read(oid, &rd, NULL);
+ int r = operate_read(oid, &rd, &bl);
if (r < 0)
return r;
int ret;
object_t oid(o);
bufferlist bl;
+ bl.push_back(buffer::create_static(len, buf));
ret = ctx->getxattr(oid, name, bl);
if (ret >= 0) {
if (bl.length() > len) {
tracepoint(librados, rados_getxattr_exit, -ERANGE, buf, 0);
return -ERANGE;
}
- bl.copy(0, bl.length(), buf);
+ if (bl.c_str() != buf)
+ bl.copy(0, bl.length(), buf);
ret = bl.length();
}