@@ -39,8 +39,7 @@ struct librados::AioCompletionImpl {
// for read
bool is_read;
- bufferlist bl, *pbl;
- char *buf;
+ bufferlist bl;
unsigned maxlen;
IoCtxImpl *io;
@@ -54,7 +53,7 @@ struct librados::AioCompletionImpl {
callback_safe(0),
callback_complete_arg(0),
callback_safe_arg(0),
- is_read(false), pbl(0), buf(0), maxlen(0),
+ is_read(false), maxlen(0),
io(NULL), aio_write_seq(0), aio_write_list_item(this) { }
int set_complete_callback(void *cb_arg, rados_callback_t cb) {
@@ -570,7 +570,6 @@ int librados::IoCtxImpl::aio_operate_rea
c->is_read = true;
c->io = this;
- c->pbl = pbl;
Mutex::Locker l(*lock);
objecter->read(oid, oloc,
@@ -612,11 +611,10 @@ int librados::IoCtxImpl::aio_read(const
c->is_read = true;
c->io = this;
- c->pbl = pbl;
Mutex::Locker l(*lock);
objecter->read(oid, oloc,
- off, len, snapid, &c->bl, 0,
+ off, len, snapid, pbl, 0,
onack, &c->objver);
return 0;
}
@@ -632,8 +630,9 @@ int librados::IoCtxImpl::aio_read(const
c->is_read = true;
c->io = this;
- c->buf = buf;
c->maxlen = len;
+ c->bl.clear();
+ c->bl.push_back( buffer::create_static( len, buf ) );
Mutex::Locker l(*lock);
objecter->read(oid, oloc,
@@ -668,7 +667,6 @@ int librados::IoCtxImpl::aio_sparse_read
c->is_read = true;
c->io = this;
- c->pbl = NULL;
onack->m_ops.sparse_read(off, len, m, data_bl, NULL);
@@ -1179,14 +1177,9 @@ void librados::IoCtxImpl::C_aio_Ack::fin
c->safe = true;
c->cond.Signal();
- if (c->buf && c->bl.length() > 0) {
- unsigned l = MIN(c->bl.length(), c->maxlen);
- c->bl.copy(0, l, c->buf);
+ if (c->bl.length() > 0) {
c->rval = c->bl.length();
}
- if (c->pbl) {
- *c->pbl = c->bl;
- }
if (c->callback_complete) {
c->io->client->finisher.queue(new C_AioComplete(c));