]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/ObjectCacher: move C_ReadFinish, C_RetryRead 10781/head
authorMichal Jarzabek <stiopa@gmail.com>
Thu, 18 Aug 2016 19:16:29 +0000 (20:16 +0100)
committerMichal Jarzabek <stiopa@gmail.com>
Thu, 18 Aug 2016 19:16:29 +0000 (20:16 +0100)
to .cc file

Signed-off-by: Michal Jarzabek <stiopa@gmail.com>
src/osdc/ObjectCacher.cc
src/osdc/ObjectCacher.h

index 878e390c0ef543498d2f0df9e16df1fafec00dc5..aa2fdd10e049192951b216eda343533436428bab 100644 (file)
@@ -27,6 +27,60 @@ using std::chrono::seconds;
 
 
 
+class ObjectCacher::C_ReadFinish : public Context {
+  ObjectCacher *oc;
+  int64_t poolid;
+  sobject_t oid;
+  loff_t start;
+  uint64_t length;
+  xlist<C_ReadFinish*>::item set_item;
+  bool trust_enoent;
+  ceph_tid_t tid;
+
+public:
+  bufferlist bl;
+  C_ReadFinish(ObjectCacher *c, Object *ob, ceph_tid_t t, loff_t s,
+              uint64_t l) :
+    oc(c), poolid(ob->oloc.pool), oid(ob->get_soid()), start(s), length(l),
+    set_item(this), trust_enoent(true),
+    tid(t) {
+    ob->reads.push_back(&set_item);
+  }
+
+  void finish(int r) {
+    oc->bh_read_finish(poolid, oid, tid, start, length, bl, r, trust_enoent);
+
+    // object destructor clears the list
+    if (set_item.is_on_list())
+      set_item.remove_myself();
+  }
+
+  void distrust_enoent() {
+    trust_enoent = false;
+  }
+};
+
+class ObjectCacher::C_RetryRead : public Context {
+  ObjectCacher *oc;
+  OSDRead *rd;
+  ObjectSet *oset;
+  Context *onfinish;
+public:
+  C_RetryRead(ObjectCacher *_oc, OSDRead *r, ObjectSet *os, Context *c)
+    : oc(_oc), rd(r), oset(os), onfinish(c) {}
+  void finish(int r) {
+    if (r < 0) {
+      if (onfinish)
+        onfinish->complete(r);
+      return;
+    }
+    int ret = oc->_readx(rd, oset, onfinish, false);
+    if (ret != 0 && onfinish) {
+      onfinish->complete(ret);
+    }
+  }
+};
+
 ObjectCacher::BufferHead *ObjectCacher::Object::split(BufferHead *left,
                                                      loff_t off)
 {
index d098a31c651b4b094ae3474981f87223c7e3c974..2d33bccf3f929a6cfe2dd821754987f5215e5779 100644 (file)
@@ -556,40 +556,6 @@ class ObjectCacher {
                       vector<pair<loff_t, uint64_t> >& ranges,
                       ceph_tid_t t, int r);
 
-
-  class C_ReadFinish : public Context {
-    ObjectCacher *oc;
-    int64_t poolid;
-    sobject_t oid;
-    loff_t start;
-    uint64_t length;
-    xlist<C_ReadFinish*>::item set_item;
-    bool trust_enoent;
-    ceph_tid_t tid;
-
-  public:
-    bufferlist bl;
-    C_ReadFinish(ObjectCacher *c, Object *ob, ceph_tid_t t, loff_t s,
-                uint64_t l) :
-      oc(c), poolid(ob->oloc.pool), oid(ob->get_soid()), start(s), length(l),
-      set_item(this), trust_enoent(true),
-      tid(t) {
-      ob->reads.push_back(&set_item);
-    }
-
-    void finish(int r) {
-      oc->bh_read_finish(poolid, oid, tid, start, length, bl, r, trust_enoent);
-
-      // object destructor clears the list
-      if (set_item.is_on_list())
-       set_item.remove_myself();
-    }
-
-    void distrust_enoent() {
-      trust_enoent = false;
-    }
-  };
-
   class C_WriteCommit;
   class C_WaitForWrite;
 
@@ -619,27 +585,7 @@ class ObjectCacher {
   }
 
 
-  class C_RetryRead : public Context {
-    ObjectCacher *oc;
-    OSDRead *rd;
-    ObjectSet *oset;
-    Context *onfinish;
-  public:
-    C_RetryRead(ObjectCacher *_oc, OSDRead *r, ObjectSet *os, Context *c)
-      : oc(_oc), rd(r), oset(os), onfinish(c) {}
-    void finish(int r) {
-      if (r < 0) {
-       if (onfinish)
-         onfinish->complete(r);
-       return;
-      }
-      int ret = oc->_readx(rd, oset, onfinish, false);
-      if (ret != 0 && onfinish) {
-       onfinish->complete(ret);
-      }
-    }
-  };
-
+  class C_RetryRead;
 
 
   // non-blocking.  async.