Skip to content

Commit

Permalink
librbd: internal AIO methods no longer return result
Browse files Browse the repository at this point in the history
All failures should be returned via the AioCompletion.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 9ab42d6)

Conflicts:
	src/librbd/AioRequest.cc: trivial resolution
	src/librbd/internal.cc: trivial resolution
  • Loading branch information
Jason Dillaman committed Jun 10, 2015
1 parent dbd4e29 commit dd2e4c1
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 127 deletions.
11 changes: 2 additions & 9 deletions src/librbd/AioRequest.cc
Expand Up @@ -76,15 +76,8 @@ namespace librbd {
<< " parent completion " << m_parent_completion
<< " extents " << image_extents
<< dendl;
int r = aio_read(m_ictx->parent, image_extents, NULL, &m_read_data,
m_parent_completion, 0);
if (r < 0) {
lderr(m_ictx->cct) << "read_from_parent " << this
<< ": error reading from parent: "
<< cpp_strerror(r) << dendl;
m_parent_completion->release();
complete(r);
}
aio_read(m_ictx->parent, image_extents, NULL, &m_read_data,
m_parent_completion, 0);
}

static inline bool is_copy_on_read(ImageCtx *ictx, librados::snap_t snap_id) {
Expand Down
10 changes: 1 addition & 9 deletions src/librbd/CopyupRequest.cc
Expand Up @@ -91,15 +91,7 @@ namespace librbd {
<< ", oid " << m_oid
<< ", extents " << m_image_extents
<< dendl;
int r = aio_read(m_ictx->parent, m_image_extents, NULL, &m_copyup_data,
comp, 0);
if (r < 0) {
lderr(m_ictx->cct) << __func__ << " " << this
<< ": error reading from parent: "
<< cpp_strerror(r) << dendl;
comp->release();
complete(r);
}
aio_read(m_ictx->parent, m_image_extents, NULL, &m_copyup_data, comp, 0);
}

void CopyupRequest::queue_send()
Expand Down
7 changes: 3 additions & 4 deletions src/librbd/ImageWatcher.cc
Expand Up @@ -178,8 +178,8 @@ int ImageWatcher::try_lock() {
return 0;
}

int ImageWatcher::request_lock(
const boost::function<int(AioCompletion*)>& restart_op, AioCompletion* c) {
void ImageWatcher::request_lock(
const boost::function<void(AioCompletion*)>& restart_op, AioCompletion* c) {
assert(m_image_ctx.owner_lock.is_locked());
assert(m_lock_owner_state == LOCK_OWNER_STATE_NOT_LOCKED);

Expand All @@ -192,7 +192,7 @@ int ImageWatcher::request_lock(
c->get();
m_aio_requests.push_back(std::make_pair(restart_op, c));
if (request_pending) {
return 0;
return;
}
}

Expand All @@ -205,7 +205,6 @@ int ImageWatcher::request_lock(
boost::bind(&ImageWatcher::notify_request_lock, this));
m_task_finisher->queue(TASK_CODE_REQUEST_LOCK, ctx);
}
return 0;
}

bool ImageWatcher::try_request_lock() {
Expand Down
6 changes: 3 additions & 3 deletions src/librbd/ImageWatcher.h
Expand Up @@ -37,8 +37,8 @@ namespace librbd {
int unregister_watch();

int try_lock();
int request_lock(const boost::function<int(AioCompletion*)>& restart_op,
AioCompletion* c);
void request_lock(const boost::function<void(AioCompletion*)>& restart_op,
AioCompletion* c);
void prepare_unlock();
void cancel_unlock();
int unlock();
Expand Down Expand Up @@ -80,7 +80,7 @@ namespace librbd {
};

typedef std::pair<Context *, ProgressContext *> AsyncRequest;
typedef std::pair<boost::function<int(AioCompletion *)>,
typedef std::pair<boost::function<void(AioCompletion *)>,
AioCompletion *> AioRequest;

class Task {
Expand Down

0 comments on commit dd2e4c1

Please sign in to comment.