#define rbd_howmany(x, y) (((x) + (y) - 1) / (y))
+using std::istringstream;
using std::map;
using std::pair;
using std::set;
return -EINVAL;
}
+ // ensure previous writes are visible to dest
+ C_SaferCond flush_ctx;
+ {
+ auto aio_comp = io::AioCompletion::create_and_start(&flush_ctx, src,
+ io::AIO_TYPE_FLUSH);
+ auto req = io::ImageDispatchSpec::create_flush(
+ *src, io::IMAGE_DISPATCH_LAYER_INTERNAL_START,
+ aio_comp, io::FLUSH_SOURCE_INTERNAL, {});
+ req->send();
+ }
+ int r = flush_ctx.wait();
+ if (r < 0) {
+ return r;
+ }
+
C_SaferCond ctx;
auto req = deep_copy::MetadataCopyRequest<>::create(
src, dest, &ctx);
req->send();
- int r = ctx.wait();
+ r = ctx.wait();
if (r < 0) {
lderr(cct) << "failed to copy metadata: " << cpp_strerror(r) << dendl;
return r;
}
}
- uint64_t len = min(period, src_size - offset);
+ uint64_t len = std::min(period, src_size - offset);
bufferlist *bl = new bufferlist();
auto ctx = new C_CopyRead(&throttle, dest, offset, bl, sparse_size);
auto comp = io::AioCompletion::create_and_start<Context>(
start_time = coarse_mono_clock::now();
while (left > 0) {
uint64_t period_off = off - (off % period);
- uint64_t read_len = min(period_off + period - off, left);
+ uint64_t read_len = std::min(period_off + period - off, left);
bufferlist bl;