From: Jason Dillaman Date: Thu, 9 Apr 2015 17:33:09 +0000 (-0400) Subject: librbd: AioRequest::send no longer returns a result X-Git-Tag: v0.80.11~58^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4e7cf6115798dd339efe41a528aac148be640b29;p=ceph.git librbd: AioRequest::send no longer returns a result The librados calls used by AioRequest::send should always return zero unless there is a bug. Signed-off-by: Jason Dillaman (cherry picked from commit c77bce3311ab62892eb8c1d883263ba7ed663b20) Conflicts: src/librbd/AioRequest.cc: trivial resolution src/librbd/AioRequest.h: trivial resolution src/librbd/internal.cc: trivial resolution --- diff --git a/src/librbd/AioRequest.cc b/src/librbd/AioRequest.cc index 5cf9a11d3b5..dee6eba12f6 100644 --- a/src/librbd/AioRequest.cc +++ b/src/librbd/AioRequest.cc @@ -85,8 +85,9 @@ namespace librbd { return true; } - 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; librados::AioCompletion *rados_completion = librados::Rados::aio_create_completion(this, rados_req_cb, NULL); @@ -99,10 +100,11 @@ namespace librbd { } else { op.read(m_object_off, m_object_len, &m_read_data, NULL); } + r = m_ioctx->aio_operate(m_oid, rados_completion, &op, flags, NULL); + assert(r == 0); rados_completion->release(); - return r; } /** write **/ @@ -224,16 +226,17 @@ namespace librbd { return finished; } - int AbstractWrite::send() { - ldout(m_ictx->cct, 20) << "send " << this << " " << m_oid << " " << m_object_off << "~" << m_object_len << dendl; + void AbstractWrite::send() { + ldout(m_ictx->cct, 20) << "send " << this << " " << m_oid << " " + << m_object_off << "~" << m_object_len << dendl; librados::AioCompletion *rados_completion = librados::Rados::aio_create_completion(this, NULL, rados_req_cb); int r; assert(m_write.size()); r = m_ioctx->aio_operate(m_oid, rados_completion, &m_write, m_snap_seq, m_snaps); + assert(r == 0); rados_completion->release(); - return r; } void AbstractWrite::send_copyup() { diff --git a/src/librbd/AioRequest.h b/src/librbd/AioRequest.h index d6103f9a195..882b5359c82 100644 --- a/src/librbd/AioRequest.h +++ b/src/librbd/AioRequest.h @@ -43,7 +43,7 @@ namespace librbd { } virtual bool should_complete(int r) = 0; - virtual int send() = 0; + virtual void send() = 0; protected: void read_from_parent(vector >& image_extents); @@ -73,7 +73,7 @@ namespace librbd { } virtual ~AioRead() {} virtual bool should_complete(int r); - virtual int send(); + virtual void send(); ceph::bufferlist &data() { return m_read_data; @@ -100,7 +100,7 @@ namespace librbd { bool hide_enoent); virtual ~AbstractWrite() {} virtual bool should_complete(int r); - virtual int send(); + virtual void send(); void guard_write(); bool has_parent() const { diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 69ebbea25a2..7ae02bd5e62 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -2214,6 +2214,10 @@ reprotect_and_return_err: SimpleThrottle throttle(cct->_conf->rbd_concurrent_management_ops, false); for (uint64_t ono = 0; ono < overlap_objects; ono++) { + if (throttle.pending_error()) { + return throttle.wait_for_ret(); + } + { RWLock::RLocker l(ictx->parent_lock); // stop early if the parent went away - it just means @@ -2237,12 +2241,7 @@ reprotect_and_return_err: Context *comp = new C_SimpleThrottle(&throttle); AioWrite *req = new AioWrite(ictx, oid, ono, 0, objectx, object_overlap, bl, snapc, CEPH_NOSNAP, comp); - r = req->send(); - if (r < 0) { - lderr(cct) << "failed to flatten object " << oid << dendl; - goto err; - } - + req->send(); prog_ctx.update_progress(ono, overlap_objects); } @@ -2987,8 +2986,7 @@ reprotect_and_return_err: objectx, object_overlap, bl, snapc, snap_id, req_comp); c->add_request(); - r = req->send(); - assert(r == 0); + req->send(); } } @@ -3070,10 +3068,10 @@ reprotect_and_return_err: snapc, snap_id, req_comp); } - r = req->send(); - assert(r == 0); + req->send(); } + r = 0; if (ictx->object_cacher) { Mutex::Locker l(ictx->cache_lock); ictx->object_cacher->discard_set(ictx->object_set, extents); @@ -3164,13 +3162,12 @@ reprotect_and_return_err: q->length, q->offset, cache_comp); } else { - r = req->send(); - assert(r == 0); + req->send(); } } } - c->finish_adding_requests(cct); + c->finish_adding_requests(ictx->cct); c->put(); ictx->perfcounter->inc(l_librbd_aio_rd);