#include "common/errno.h"
#include "common/Mutex.h"
#include "common/RWLock.h"
+#include "common/WorkQueue.h"
#include "librbd/AioObjectRequest.h"
#include "librbd/AioCompletion.h"
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
- bool non_existent = false;
{
RWLock::RLocker snap_locker(m_ictx->snap_lock);
- non_existent = (m_ictx->object_map != nullptr &&
- !m_ictx->object_map->object_may_exist(m_object_no));
- }
- if (non_existent) {
- complete(-ENOENT);
- return;
+
+ // send read request to parent if the object doesn't exist locally
+ if (m_ictx->object_map != nullptr &&
+ !m_ictx->object_map->object_may_exist(m_object_no)) {
+ m_ictx->op_work_queue->queue(util::create_context_callback<
+ AioObjectRequest>(this), -ENOENT);
+ return;
+ }
}
librados::ObjectReadOperation op;
#include "common/ceph_context.h"
#include "common/dout.h"
-#include "common/Finisher.h"
#include "common/Mutex.h"
+#include "common/WorkQueue.h"
#include "include/Context.h"
#include "include/rados/librados.hpp"
#include "include/rbd/librbd.hpp"
};
LibrbdWriteback::LibrbdWriteback(ImageCtx *ictx, Mutex& lock)
- : m_finisher(new Finisher(ictx->cct)), m_tid(0), m_lock(lock), m_ictx(ictx)
- {
- m_finisher->start();
- }
-
- LibrbdWriteback::~LibrbdWriteback() {
- m_finisher->stop();
- delete m_finisher;
+ : m_tid(0), m_lock(lock), m_ictx(ictx) {
}
void LibrbdWriteback::read(const object_t& oid, uint64_t object_no,
RWLock::RLocker snap_locker(m_ictx->snap_lock);
if (m_ictx->object_map != nullptr &&
!m_ictx->object_map->object_may_exist(object_no)) {
- m_finisher->queue(req, -ENOENT);
+ m_ictx->op_work_queue->queue(req, -ENOENT);
return;
}
}
#include "osd/osd_types.h"
#include "osdc/WritebackHandler.h"
-class Finisher;
class Mutex;
namespace librbd {
class LibrbdWriteback : public WritebackHandler {
public:
LibrbdWriteback(ImageCtx *ictx, Mutex& lock);
- virtual ~LibrbdWriteback();
// Note that oloc, trunc_size, and trunc_seq are ignored
virtual void read(const object_t& oid, uint64_t object_no,
private:
void complete_writes(const std::string& oid);
- Finisher *m_finisher;
ceph_tid_t m_tid;
Mutex& m_lock;
librbd::ImageCtx *m_ictx;