]>
git.proxmox.com Git - ceph.git/blob - ceph/src/librbd/io/ImageDispatchSpec.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #include "librbd/io/ImageDispatchSpec.h"
5 #include "librbd/ImageCtx.h"
6 #include "librbd/io/AioCompletion.h"
7 #include "librbd/io/ImageRequest.h"
8 #include "librbd/io/ImageDispatcherInterface.h"
9 #include <boost/variant.hpp>
14 void ImageDispatchSpec::C_Dispatcher::complete(int r
) {
15 switch (image_dispatch_spec
->dispatch_result
) {
16 case DISPATCH_RESULT_RESTART
:
17 ceph_assert(image_dispatch_spec
->dispatch_layer
!= 0);
18 image_dispatch_spec
->dispatch_layer
= static_cast<ImageDispatchLayer
>(
19 image_dispatch_spec
->dispatch_layer
- 1);
21 case DISPATCH_RESULT_CONTINUE
:
23 // bubble dispatch failure through AioCompletion
24 image_dispatch_spec
->dispatch_result
= DISPATCH_RESULT_COMPLETE
;
25 image_dispatch_spec
->fail(r
);
29 image_dispatch_spec
->send();
31 case DISPATCH_RESULT_COMPLETE
:
34 case DISPATCH_RESULT_INVALID
:
40 void ImageDispatchSpec::C_Dispatcher::finish(int r
) {
41 delete image_dispatch_spec
;
44 void ImageDispatchSpec::send() {
45 image_dispatcher
->send(this);
48 void ImageDispatchSpec::fail(int r
) {
49 dispatch_result
= DISPATCH_RESULT_COMPLETE
;