Skip to content

Commit

Permalink
librbd: AioRequest::send no longer returns a result
Browse files Browse the repository at this point in the history
The librados calls used by AioRequest::send should always return
zero unless there is a bug.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit c77bce3)

Conflicts:
	src/librbd/AioRequest.cc: trivial resolution
	src/librbd/AsyncFlattenRequest.cc: trivial resolution
  • Loading branch information
Jason Dillaman committed Jun 10, 2015
1 parent 272df2a commit 9ea1edd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 26 deletions.
17 changes: 8 additions & 9 deletions src/librbd/AioRequest.cc
Expand Up @@ -231,13 +231,14 @@ namespace librbd {
return finished;
}

int AioRead::send() {
ldout(m_ictx->cct, 20) << "send " << this << " " << m_oid << " " << m_object_off << "~" << m_object_len << dendl;
void AioRead::send() {
ldout(m_ictx->cct, 20) << "send " << this << " " << m_oid << " "
<< m_object_off << "~" << m_object_len << dendl;

// send read request to parent if the object doesn't exist locally
if (!m_ictx->object_map.object_may_exist(m_object_no)) {
complete(-ENOENT);
return 0;
return;
}

librados::AioCompletion *rados_completion =
Expand All @@ -254,8 +255,9 @@ namespace librbd {
op.set_op_flags2(m_op_flags);

r = m_ictx->data_ctx.aio_operate(m_oid, rados_completion, &op, flags, NULL);
assert(r == 0);

rados_completion->release();
return r;
}

/** write **/
Expand Down Expand Up @@ -434,16 +436,13 @@ namespace librbd {
return finished;
}

int AbstractWrite::send() {
void AbstractWrite::send() {
ldout(m_ictx->cct, 20) << "send " << this << " " << m_oid << " "
<< m_object_off << "~" << m_object_len << dendl;

if (send_pre()) {
return 0;
} else {
if (!send_pre()) {
send_write();
}
return 0;
}

bool AbstractWrite::send_pre() {
Expand Down
6 changes: 3 additions & 3 deletions src/librbd/AioRequest.h
Expand Up @@ -37,7 +37,7 @@ namespace librbd {
void complete(int r);

virtual bool should_complete(int r) = 0;
virtual int send() = 0;
virtual void send() = 0;

protected:
void read_from_parent(vector<pair<uint64_t,uint64_t> >& image_extents,
Expand All @@ -63,7 +63,7 @@ namespace librbd {
Context *completion, int op_flags);
virtual ~AioRead() {}
virtual bool should_complete(int r);
virtual int send();
virtual void send();
void guard_read();

ceph::bufferlist &data() {
Expand Down Expand Up @@ -118,7 +118,7 @@ namespace librbd {
bool hide_enoent);
virtual ~AbstractWrite() {}
virtual bool should_complete(int r);
virtual int send();
virtual void send();

bool has_parent() const {
return !m_object_image_extents.empty();
Expand Down
3 changes: 1 addition & 2 deletions src/librbd/AsyncFlattenRequest.cc
Expand Up @@ -71,8 +71,7 @@ class AsyncFlattenObjectContext : public C_AsyncObjectThrottle {
AioWrite *req = new AioWrite(&m_image_ctx, oid, m_object_no, 0, objectx,
object_overlap, bl, m_snapc, CEPH_NOSNAP,
this);
int r = req->send();
assert(r == 0);
req->send();
return 0;
}

Expand Down
7 changes: 1 addition & 6 deletions src/librbd/AsyncTrimRequest.cc
Expand Up @@ -289,12 +289,7 @@ bool AsyncTrimRequest::send_clean_boundary() {
objectx, object_overlap, snapc, CEPH_NOSNAP,
req_comp);
}
int r = req->send();
if (r < 0) {
req_comp->complete(r);
delete req;
break;
}
req->send();
}
}

Expand Down
9 changes: 3 additions & 6 deletions src/librbd/internal.cc
Expand Up @@ -3371,8 +3371,7 @@ int invoke_async_request(ImageCtx *ictx, const std::string& request_type,
c->add_request();

req->set_op_flags(op_flags);
r = req->send();
assert(r == 0);
req->send();
}
}

Expand Down Expand Up @@ -3472,8 +3471,7 @@ int invoke_async_request(ImageCtx *ictx, const std::string& request_type,
snapc, snap_id, req_comp);
}

r = req->send();
assert(r == 0);
req->send();
}

if (ictx->object_cacher) {
Expand Down Expand Up @@ -3639,8 +3637,7 @@ int invoke_async_request(ImageCtx *ictx, const std::string& request_type,
q->length, q->offset,
cache_comp, op_flags);
} else {
r = req->send();
assert(r == 0);
req->send();
}
}
}
Expand Down

0 comments on commit 9ea1edd

Please sign in to comment.