From c77bce3311ab62892eb8c1d883263ba7ed663b20 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Thu, 9 Apr 2015 13:33:09 -0400 Subject: [PATCH] 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 --- src/librbd/AioRequest.cc | 14 ++++++-------- src/librbd/AioRequest.h | 6 +++--- src/librbd/AsyncFlattenRequest.cc | 3 +-- src/librbd/AsyncTrimRequest.cc | 7 +------ src/librbd/internal.cc | 9 +++------ 5 files changed, 14 insertions(+), 25 deletions(-) diff --git a/src/librbd/AioRequest.cc b/src/librbd/AioRequest.cc index c7240c9ffd45f..00e34aa127b6f 100644 --- a/src/librbd/AioRequest.cc +++ b/src/librbd/AioRequest.cc @@ -206,14 +206,14 @@ namespace librbd { return finished; } - int AioRead::send() { + 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 = @@ -230,8 +230,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; } void AioRead::send_copyup() @@ -375,16 +376,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() { diff --git a/src/librbd/AioRequest.h b/src/librbd/AioRequest.h index ecfb08f9c219b..9eb7a636c91be 100644 --- a/src/librbd/AioRequest.h +++ b/src/librbd/AioRequest.h @@ -38,7 +38,7 @@ namespace librbd { void complete(int r); virtual bool should_complete(int r) = 0; - virtual int send() = 0; + virtual void send() = 0; bool has_parent() const { return !m_parent_extents.empty(); @@ -66,7 +66,7 @@ namespace librbd { virtual ~AioRead(); virtual bool should_complete(int r); - virtual int send(); + virtual void send(); void guard_read(); ceph::bufferlist &data() { @@ -126,7 +126,7 @@ namespace librbd { } virtual bool should_complete(int r); - virtual int send(); + virtual void send(); private: /** diff --git a/src/librbd/AsyncFlattenRequest.cc b/src/librbd/AsyncFlattenRequest.cc index 79a96d57c264a..de90dc13765d7 100644 --- a/src/librbd/AsyncFlattenRequest.cc +++ b/src/librbd/AsyncFlattenRequest.cc @@ -49,8 +49,7 @@ public: return 1; } - int r = req->send(); - assert(r == 0); + req->send(); return 0; } diff --git a/src/librbd/AsyncTrimRequest.cc b/src/librbd/AsyncTrimRequest.cc index 971846a96163f..1a712bcfd0728 100644 --- a/src/librbd/AsyncTrimRequest.cc +++ b/src/librbd/AsyncTrimRequest.cc @@ -279,12 +279,7 @@ bool AsyncTrimRequest::send_clean_boundary() { req = new AioTruncate(&m_image_ctx, p->oid.name, p->objectno, p->offset, snapc, req_comp); } - int r = req->send(); - if (r < 0) { - req_comp->complete(r); - delete req; - break; - } + req->send(); } } diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 27b300e78ac56..a0b590f4413ba 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -3803,8 +3803,7 @@ reprotect_and_return_err: c->add_request(); req->set_op_flags(op_flags); - r = req->send(); - assert(r == 0); + req->send(); } } @@ -3943,8 +3942,7 @@ reprotect_and_return_err: snapc, req_comp); } - r = req->send(); - assert(r == 0); + req->send(); } if (ictx->object_cacher) { @@ -4105,8 +4103,7 @@ reprotect_and_return_err: q->length, q->offset, cache_comp, op_flags); } else { - r = req->send(); - assert(r == 0); + req->send(); } } } -- 2.39.5