1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2014 Adam Crume <adamcrume@gmail.com>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #include "PendingIO.hpp"
16 #include "rbd_replay_debug.hpp"
18 #define dout_context g_ceph_context
21 using namespace rbd_replay;
24 void rbd_replay_pending_io_callback(librbd::completion_t cb, void *arg) {
25 PendingIO *io = static_cast<PendingIO*>(arg);
29 PendingIO::PendingIO(action_id_t id,
32 m_completion(new librbd::RBD::AioCompletion(this, rbd_replay_pending_io_callback)),
36 PendingIO::~PendingIO() {
37 m_completion->release();
40 void PendingIO::completed(librbd::completion_t cb) {
41 dout(ACTION_LEVEL) << "Completed pending IO #" << m_id << dendl;
42 ssize_t r = m_completion->get_return_value();
43 assertf(r >= 0, "id = %d, r = %d", m_id, r);
44 m_worker.remove_pending(shared_from_this());