mirror of
https://github.com/ceph/ceph
synced 2025-01-20 01:51:34 +00:00
Merge pull request #3203 from majianpeng/fix1
avoid memcopy from librados to caller buffer Reviewed-by: Sage Weil <sage@redhat.com> Reviewed-by: Samuel Just <sjust@redhat.com>
This commit is contained in:
commit
4ecea7e54e
@ -983,7 +983,7 @@ int librados::IoCtxImpl::getxattr(const object_t& oid,
|
||||
::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;
|
||||
|
||||
|
@ -3220,13 +3220,15 @@ extern "C" int rados_getxattr(rados_ioctx_t io, const char *o, const char *name,
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -2977,6 +2977,14 @@ void Objecter::handle_osd_op_reply(MOSDOpReply *m)
|
||||
if (op->data_offset)
|
||||
*op->data_offset = m->get_header().data_off;
|
||||
|
||||
// got data?
|
||||
if (op->outbl) {
|
||||
if (op->con)
|
||||
op->con->revoke_rx_buffer(op->tid);
|
||||
m->claim_data(*op->outbl);
|
||||
op->outbl = 0;
|
||||
}
|
||||
|
||||
// per-op result demuxing
|
||||
vector<OSDOp> out_ops;
|
||||
m->claim_ops(out_ops);
|
||||
@ -3027,14 +3035,6 @@ void Objecter::handle_osd_op_reply(MOSDOpReply *m)
|
||||
logger->inc(l_osdc_op_commit);
|
||||
}
|
||||
|
||||
// got data?
|
||||
if (op->outbl) {
|
||||
if (op->con)
|
||||
op->con->revoke_rx_buffer(op->tid);
|
||||
m->claim_data(*op->outbl);
|
||||
op->outbl = 0;
|
||||
}
|
||||
|
||||
/* get it before we call _finish_op() */
|
||||
Mutex *completion_lock = (op->target.base_oid.name.size() ? s->get_lock(op->target.base_oid) : NULL);
|
||||
|
||||
|
@ -2037,6 +2037,8 @@ public:
|
||||
o->priority = op.priority;
|
||||
o->snapid = snapid;
|
||||
o->outbl = pbl;
|
||||
if (!o->outbl && op.size() == 1 && op.out_bl[0]->length())
|
||||
o->outbl = op.out_bl[0];
|
||||
o->out_bl.swap(op.out_bl);
|
||||
o->out_handler.swap(op.out_handler);
|
||||
o->out_rval.swap(op.out_rval);
|
||||
|
Loading…
Reference in New Issue
Block a user