scrub_finalize_wq(osd->scrub_finalize_wq),
rep_scrub_wq(osd->rep_scrub_wq),
push_wq("push_wq", cct->_conf->osd_recovery_thread_timeout, &osd->recovery_tp),
+ gen_wq("gen_wq", cct->_conf->osd_recovery_thread_timeout, &osd->recovery_tp),
class_handler(osd->class_handler),
publish_lock("OSDService::publish_lock"),
pre_publish_lock("OSDService::pre_publish_lock"),
ThreadPool::WorkQueue<PG> &scrub_finalize_wq;
ThreadPool::WorkQueue<MOSDRepScrub> &rep_scrub_wq;
GenContextWQ push_wq;
+ GenContextWQ gen_wq;
ClassHandler *&class_handler;
void dequeue_pg(PG *pg, list<OpRequestRef> *dequeued);
virtual int objects_get_attrs(
const hobject_t &hoid,
map<string, bufferlist> *out) = 0;
+
+ virtual int objects_read_sync(
+ const hobject_t &hoid,
+ uint64_t off,
+ uint64_t len,
+ bufferlist *bl) = 0;
+
+ virtual void objects_read_async(
+ const hobject_t &hoid,
+ uint64_t off,
+ uint64_t len,
+ bufferlist *bl,
+ Context *on_complete) = 0;
};
#endif
*out);
}
+int ReplicatedBackend::objects_read_sync(
+ const hobject_t &hoid,
+ uint64_t off,
+ uint64_t len,
+ bufferlist *bl)
+{
+ return osd->store->read(coll, hoid, off, len, *bl);
+}
+
+struct AsyncReadCallback : public GenContext<ThreadPool::TPHandle&> {
+ int r;
+ Context *c;
+ AsyncReadCallback(int r, Context *c) : r(r), c(c) {}
+ void finish(ThreadPool::TPHandle&) {
+ c->complete(r);
+ c = NULL;
+ }
+ ~AsyncReadCallback() {
+ delete c;
+ }
+};
+void ReplicatedBackend::objects_read_async(
+ const hobject_t &hoid,
+ uint64_t off,
+ uint64_t len,
+ bufferlist *bl,
+ Context *on_complete)
+{
+ int r = osd->store->read(coll, hoid, off, len, *bl);
+ osd->gen_wq.queue(
+ get_parent()->bless_gencontext(
+ new AsyncReadCallback(r, on_complete)));
+}
+
+
class RPGTransaction : public PGBackend::PGTransaction {
coll_t coll;
coll_t temp_coll;
const hobject_t &hoid,
map<string, bufferlist> *out);
+ int objects_read_sync(
+ const hobject_t &hoid,
+ uint64_t off,
+ uint64_t len,
+ bufferlist *bl);
+
+ void objects_read_async(
+ const hobject_t &hoid,
+ uint64_t off,
+ uint64_t len,
+ bufferlist *bl,
+ Context *on_complete);
+
private:
// push
struct PushInfo {