From: Vu Pham Date: Fri, 8 Apr 2016 20:23:07 +0000 (-0700) Subject: librados: copy out data to users' buffer for xio X-Git-Tag: v10.2.11~192^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ef9b498b17f127ed58689a384d827acf68f47850;p=ceph.git librados: copy out data to users' buffer for xio rados_aio_read(buf) call objecter->read(). Upon receiving reply from osd, message->claim_data() is called which enforces *deep* copy (both bufferlist and data buffers) because Accelio's registered buffers is NON_SHAREABLE. Received data is on new bufferlist and buffers but not in original buffer provided by rados_aio_read() caller. Another copy to users' buffer is needed Signed-off-by: Vu Pham (cherry picked from commit 64bca33ae76646879e6801c45e6d91852e488f8b) --- diff --git a/src/librados/AioCompletionImpl.h b/src/librados/AioCompletionImpl.h index aaadc1add0f5..982f2bd7eee1 100644 --- a/src/librados/AioCompletionImpl.h +++ b/src/librados/AioCompletionImpl.h @@ -42,6 +42,7 @@ struct librados::AioCompletionImpl { bool is_read; bufferlist bl; bufferlist *blp; + char *out_buf; IoCtxImpl *io; ceph_tid_t aio_write_seq; @@ -55,7 +56,7 @@ struct librados::AioCompletionImpl { callback_safe(0), callback_complete_arg(0), callback_safe_arg(0), - is_read(false), blp(NULL), + is_read(false), blp(nullptr), out_buf(nullptr), io(NULL), aio_write_seq(0), aio_write_list_item(this) { } int set_complete_callback(void *cb_arg, rados_callback_t cb) { diff --git a/src/librados/IoCtxImpl.cc b/src/librados/IoCtxImpl.cc index ce1a220d4e59..950d4c6110ed 100644 --- a/src/librados/IoCtxImpl.cc +++ b/src/librados/IoCtxImpl.cc @@ -808,6 +808,7 @@ int librados::IoCtxImpl::aio_read(const object_t oid, AioCompletionImpl *c, c->bl.clear(); c->bl.push_back(buffer::create_static(len, buf)); c->blp = &c->bl; + c->out_buf = buf; Objecter::Op *o = objecter->prepare_read_op( oid, oloc, @@ -1630,6 +1631,8 @@ void librados::IoCtxImpl::C_aio_Ack::finish(int r) c->cond.Signal(); if (r == 0 && c->blp && c->blp->length() > 0) { + if (c->out_buf && !c->blp->is_provided_buffer(c->out_buf)) + c->blp->copy(0, c->blp->length(), c->out_buf); c->rval = c->blp->length(); }