]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: AioRequest::send no longer returns a result
authorJason Dillaman <dillaman@redhat.com>
Thu, 9 Apr 2015 17:33:09 +0000 (13:33 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 26 May 2015 18:25:19 +0000 (14:25 -0400)
The librados calls used by AioRequest::send should always return
zero unless there is a bug.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/AioRequest.cc
src/librbd/AioRequest.h
src/librbd/AsyncFlattenRequest.cc
src/librbd/AsyncTrimRequest.cc
src/librbd/internal.cc

index c7240c9ffd45f84d4280d1d87cf4087df7f6d5e6..00e34aa127b6fc041d96fa5734396745e04b2936 100644 (file)
@@ -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() {
index ecfb08f9c219b99937803d24cf783dd374672298..9eb7a636c91bef2d60d2c020a72f6aff61515a30 100644 (file)
@@ -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:
     /**
index 79a96d57c264a8b7ff81ce906121dbffdea1c8a2..de90dc13765d7eaf5a6c4f8a83dd565bc2fd93a5 100644 (file)
@@ -49,8 +49,7 @@ public:
       return 1;
     }
 
-    int r = req->send();
-    assert(r == 0);
+    req->send();
     return 0;
   }
 
index 971846a96163f1090df365b57e48c7afbf0f9c5a..1a712bcfd0728ff88483e5f24563e6623e0403cc 100644 (file)
@@ -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();
       }
     }
 
index 27b300e78ac56797bc0dfbbe4b88c857e37b0cf3..a0b590f4413ba093d1d2644b10fcae1523106b7c 100644 (file)
@@ -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();
        }
       }
     }