+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)
{
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;
}
- 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.