void ImageSync<I>::cancel() {
Mutex::Locker locker(m_lock);
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
m_canceled = true;
return;
}
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
Context *ctx = create_context_callback<
ImageSync<I>, &ImageSync<I>::handle_prune_catch_up_sync_point>(this);
template <typename I>
void ImageSync<I>::handle_prune_catch_up_sync_point(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to prune catch-up sync point: "
- << cpp_strerror(r) << dendl;
+ derr << ": failed to prune catch-up sync point: "
+ << cpp_strerror(r) << dendl;
finish(r);
return;
}
return;
}
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
Context *ctx = create_context_callback<
ImageSync<I>, &ImageSync<I>::handle_create_sync_point>(this);
template <typename I>
void ImageSync<I>::handle_create_sync_point(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to create sync point: " << cpp_strerror(r)
- << dendl;
+ derr << ": failed to create sync point: " << cpp_strerror(r)
+ << dendl;
finish(r);
return;
}
return;
}
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
Context *ctx = create_context_callback<
ImageSync<I>, &ImageSync<I>::handle_copy_snapshots>(this);
template <typename I>
void ImageSync<I>::handle_copy_snapshots(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
{
Mutex::Locker locker(m_lock);
}
if (r == -ECANCELED) {
- ldout(cct, 10) << ": snapshot copy canceled" << dendl;
+ dout(10) << ": snapshot copy canceled" << dendl;
finish(r);
return;
} else if (r < 0) {
- lderr(cct) << ": failed to copy snapshot metadata: "
- << cpp_strerror(r) << dendl;
+ derr << ": failed to copy snapshot metadata: " << cpp_strerror(r) << dendl;
finish(r);
return;
}
return;
}
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
Context *ctx = create_context_callback<
ImageSync<I>, &ImageSync<I>::handle_copy_image>(this);
template <typename I>
void ImageSync<I>::handle_copy_image(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
{
Mutex::Locker locker(m_lock);
}
if (r == -ECANCELED) {
- ldout(cct, 10) << ": image copy canceled" << dendl;
+ dout(10) << ": image copy canceled" << dendl;
finish(r);
return;
} else if (r < 0) {
- lderr(cct) << ": failed to copy image: " << cpp_strerror(r) << dendl;
+ derr << ": failed to copy image: " << cpp_strerror(r) << dendl;
finish(r);
return;
}
assert(snap_id_it != m_local_image_ctx->snap_ids.end());
librados::snap_t snap_id = snap_id_it->second;
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": snap_id=" << snap_id << ", "
- << "snap_name=" << sync_point.snap_name << dendl;
+ dout(20) << ": snap_id=" << snap_id << ", "
+ << "snap_name=" << sync_point.snap_name << dendl;
// rollback the object map (copy snapshot object map to HEAD)
RWLock::WLocker object_map_locker(m_local_image_ctx->object_map_lock);
template <typename I>
void ImageSync<I>::handle_copy_object_map(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
assert(r == 0);
send_refresh_object_map();
template <typename I>
void ImageSync<I>::send_refresh_object_map() {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
update_progress("REFRESH_OBJECT_MAP");
template <typename I>
void ImageSync<I>::handle_refresh_object_map(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
assert(r == 0);
{
template <typename I>
void ImageSync<I>::send_prune_sync_points() {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
update_progress("PRUNE_SYNC_POINTS");
template <typename I>
void ImageSync<I>::handle_prune_sync_points(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to prune sync point: "
- << cpp_strerror(r) << dendl;
+ derr << ": failed to prune sync point: "
+ << cpp_strerror(r) << dendl;
finish(r);
return;
}
void ImageCopyRequest<I>::cancel() {
Mutex::Locker locker(m_lock);
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
m_canceled = true;
}
update_progress("UPDATE_MAX_OBJECT_COUNT");
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": sync_object_count=" << max_objects << dendl;
+ dout(20) << ": sync_object_count=" << max_objects << dendl;
m_client_meta_copy = *m_client_meta;
m_client_meta_copy.sync_object_count = max_objects;
template <typename I>
void ImageCopyRequest<I>::handle_update_max_object_count(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r == 0) {
Mutex::Locker locker(m_lock);
if (m_canceled) {
- ldout(cct, 10) << ": image copy canceled" << dendl;
+ dout(10) << ": image copy canceled" << dendl;
r = -ECANCELED;
}
}
if (r < 0) {
if (r != -ECANCELED) {
- lderr(cct) << ": failed to update client data: " << cpp_strerror(r)
- << dendl;
+ derr << ": failed to update client data: " << cpp_strerror(r) << dendl;
}
finish(r);
return;
template <typename I>
void ImageCopyRequest<I>::send_next_object_copy() {
assert(m_lock.is_locked());
- CephContext *cct = m_local_image_ctx->cct;
if (m_canceled && m_ret_val == 0) {
- ldout(cct, 10) << ": image copy canceled" << dendl;
+ dout(10) << ": image copy canceled" << dendl;
m_ret_val = -ECANCELED;
}
uint64_t ono = m_object_no++;
- ldout(cct, 20) << ": object_num=" << ono << dendl;
+ dout(20) << ": object_num=" << ono << dendl;
++m_current_ops;
template <typename I>
void ImageCopyRequest<I>::handle_object_copy(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
int percent;
bool complete;
percent = 100 * m_object_no / m_end_object_no;
if (r < 0) {
- lderr(cct) << ": object copy failed: " << cpp_strerror(r) << dendl;
+ derr << ": object copy failed: " << cpp_strerror(r) << dendl;
if (m_ret_val == 0) {
m_ret_val = r;
}
m_sync_point->object_number = boost::none;
}
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": sync_point=" << *m_sync_point << dendl;
+ dout(20) << ": sync_point=" << *m_sync_point << dendl;
bufferlist client_data_bl;
librbd::journal::ClientData client_data(m_client_meta_copy);
template <typename I>
void ImageCopyRequest<I>::handle_flush_sync_point(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
*m_client_meta = m_client_meta_copy;
- lderr(cct) << ": failed to update client data: " << cpp_strerror(r)
- << dendl;
+ derr << ": failed to update client data: " << cpp_strerror(r)
+ << dendl;
finish(r);
return;
}
template <typename I>
int ImageCopyRequest<I>::compute_snap_map() {
- CephContext *cct = m_local_image_ctx->cct;
librados::snap_t snap_id_start = 0;
librados::snap_t snap_id_end;
RWLock::RLocker snap_locker(m_remote_image_ctx->snap_lock);
snap_id_end = m_remote_image_ctx->get_snap_id(m_sync_point->snap_name);
if (snap_id_end == CEPH_NOSNAP) {
- lderr(cct) << ": failed to locate snapshot: "
- << m_sync_point->snap_name << dendl;
+ derr << ": failed to locate snapshot: "
+ << m_sync_point->snap_name << dendl;
return -ENOENT;
}
snap_id_start = m_remote_image_ctx->get_snap_id(
m_sync_point->from_snap_name);
if (snap_id_start == CEPH_NOSNAP) {
- lderr(cct) << ": failed to locate from snapshot: "
- << m_sync_point->from_snap_name << dendl;
+ derr << ": failed to locate from snapshot: "
+ << m_sync_point->from_snap_name << dendl;
return -ENOENT;
}
}
}
if (m_snap_map.empty()) {
- lderr(cct) << ": failed to map snapshots within boundary" << dendl;
+ derr << ": failed to map snapshots within boundary" << dendl;
return -EINVAL;
}
m_remote_io_ctx.dup(m_remote_image_ctx->data_ctx);
m_remote_oid = m_remote_image_ctx->get_object_name(object_number);
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": "
- << "remote_oid=" << m_remote_oid << ", "
- << "local_oid=" << m_local_oid << dendl;
+ dout(20) << ": "
+ << "remote_oid=" << m_remote_oid << ", "
+ << "local_oid=" << m_local_oid << dendl;
}
template <typename I>
template <typename I>
void ObjectCopyRequest<I>::send_list_snaps() {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
librados::AioCompletion *rados_completion = create_rados_ack_callback<
ObjectCopyRequest<I>, &ObjectCopyRequest<I>::handle_list_snaps>(this);
r = m_snap_ret;
}
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r == -ENOENT) {
finish(0);
return;
}
if (r < 0) {
- lderr(cct) << ": failed to list snaps: " << cpp_strerror(r) << dendl;
+ derr << ": failed to list snaps: " << cpp_strerror(r) << dendl;
finish(r);
return;
}
template <typename I>
void ObjectCopyRequest<I>::send_read_object() {
- CephContext *cct = m_local_image_ctx->cct;
if (m_snap_sync_ops.empty()) {
// no more snapshot diffs to read from remote
finish(0);
switch (std::get<0>(sync_op)) {
case SYNC_OP_TYPE_WRITE:
if (!read_required) {
- ldout(cct, 20) << ": remote_snap_seq=" << remote_snap_seq << dendl;
+ dout(20) << ": remote_snap_seq=" << remote_snap_seq << dendl;
read_required = true;
}
- ldout(cct, 20) << ": read op: " << std::get<1>(sync_op) << "~"
- << std::get<2>(sync_op) << dendl;
+ dout(20) << ": read op: " << std::get<1>(sync_op) << "~"
+ << std::get<2>(sync_op) << dendl;
op.read(std::get<1>(sync_op), std::get<2>(sync_op),
&std::get<3>(sync_op), nullptr);
break;
template <typename I>
void ObjectCopyRequest<I>::handle_read_object(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to read from remote object: " << cpp_strerror(r)
- << dendl;
+ derr << ": failed to read from remote object: " << cpp_strerror(r)
+ << dendl;
finish(r);
return;
}
}
}
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": "
- << "local_snap_seq=" << local_snap_seq << ", "
- << "local_snaps=" << local_snap_ids << dendl;
+ dout(20) << ": "
+ << "local_snap_seq=" << local_snap_seq << ", "
+ << "local_snaps=" << local_snap_ids << dendl;
auto &sync_ops = m_snap_sync_ops.begin()->second;
assert(!sync_ops.empty());
for (auto &sync_op : sync_ops) {
switch (std::get<0>(sync_op)) {
case SYNC_OP_TYPE_WRITE:
- ldout(cct, 20) << ": write op: " << std::get<1>(sync_op) << "~"
- << std::get<3>(sync_op).length() << dendl;
+ dout(20) << ": write op: " << std::get<1>(sync_op) << "~"
+ << std::get<3>(sync_op).length() << dendl;
op.write(std::get<1>(sync_op), std::get<3>(sync_op));
break;
case SYNC_OP_TYPE_TRUNC:
- ldout(cct, 20) << ": trunc op: " << std::get<1>(sync_op) << dendl;
+ dout(20) << ": trunc op: " << std::get<1>(sync_op) << dendl;
op.truncate(std::get<1>(sync_op));
break;
case SYNC_OP_TYPE_REMOVE:
- ldout(cct, 20) << ": remove op" << dendl;
+ dout(20) << ": remove op" << dendl;
op.remove();
break;
default:
template <typename I>
void ObjectCopyRequest<I>::handle_write_object(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r == -ENOENT) {
r = 0;
}
if (r < 0) {
- lderr(cct) << ": failed to write to local object: " << cpp_strerror(r)
- << dendl;
+ derr << ": failed to write to local object: " << cpp_strerror(r)
+ << dendl;
finish(r);
return;
}
auto snap_object_state = *m_snap_object_states.begin();
m_snap_object_states.erase(m_snap_object_states.begin());
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": "
- << "local_snap_id=" << snap_object_state.first << ", "
- << "object_state=" << static_cast<uint32_t>(
- snap_object_state.second)
- << dendl;
+ dout(20) << ": "
+ << "local_snap_id=" << snap_object_state.first << ", "
+ << "object_state=" << static_cast<uint32_t>(snap_object_state.second)
+ << dendl;
RWLock::WLocker object_map_locker(m_local_image_ctx->object_map_lock);
Context *ctx = create_context_callback<
template <typename I>
void ObjectCopyRequest<I>::handle_update_object_map(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
assert(r == 0);
if (!m_snap_object_states.empty()) {
calc_snap_set_diff(cct, m_snap_set, start_remote_snap_id,
end_remote_snap_id, &diff, &end_size, &exists);
- ldout(cct, 20) << ": "
- << "start_remote_snap=" << start_remote_snap_id << ", "
- << "end_remote_snap_id=" << end_remote_snap_id << ", "
- << "end_local_snap_id=" << end_local_snap_id << ", "
- << "diff=" << diff << ", "
- << "end_size=" << end_size << ", "
- << "exists=" << exists << dendl;
+ dout(20) << ": "
+ << "start_remote_snap=" << start_remote_snap_id << ", "
+ << "end_remote_snap_id=" << end_remote_snap_id << ", "
+ << "end_local_snap_id=" << end_local_snap_id << ", "
+ << "diff=" << diff << ", "
+ << "end_size=" << end_size << ", "
+ << "exists=" << exists << dendl;
if (exists) {
// clip diff to size of object (in case it was truncated)
trunc.insert(end_size, prev_end_size);
trunc.intersection_of(diff);
diff.subtract(trunc);
- ldout(cct, 20) << ": clearing truncate diff: " << trunc << dendl;
+ dout(20) << ": clearing truncate diff: " << trunc << dendl;
}
// prepare the object map state
// object write/zero, or truncate
for (auto it = diff.begin(); it != diff.end(); ++it) {
- ldout(cct, 20) << ": read/write op: " << it.get_start() << "~"
- << it.get_len() << dendl;
+ dout(20) << ": read/write op: " << it.get_start() << "~"
+ << it.get_len() << dendl;
m_snap_sync_ops[end_remote_snap_id].emplace_back(SYNC_OP_TYPE_WRITE,
it.get_start(),
it.get_len(),
bufferlist());
}
if (end_size < prev_end_size) {
- ldout(cct, 20) << ": trunc op: " << end_size << dendl;
+ dout(20) << ": trunc op: " << end_size << dendl;
m_snap_sync_ops[end_remote_snap_id].emplace_back(SYNC_OP_TYPE_TRUNC,
end_size, 0U,
bufferlist());
} else {
if (prev_exists) {
// object remove
- ldout(cct, 20) << ": remove op" << dendl;
+ dout(20) << ": remove op" << dendl;
m_snap_sync_ops[end_remote_snap_id].emplace_back(SYNC_OP_TYPE_REMOVE,
0U, 0U, bufferlist());
}
template <typename I>
void ObjectCopyRequest<I>::finish(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
m_on_finish->complete(r);
delete this;
void SnapshotCopyRequest<I>::cancel() {
Mutex::Locker locker(m_lock);
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
m_canceled = true;
}
template <typename I>
void SnapshotCopyRequest<I>::send_snap_unprotect() {
- CephContext *cct = m_local_image_ctx->cct;
SnapIdSet::iterator snap_id_it = m_local_snap_ids.begin();
if (m_prev_snap_id != CEPH_NOSNAP) {
int r = m_local_image_ctx->is_snap_unprotected(local_snap_id,
&local_unprotected);
if (r < 0) {
- lderr(cct) << "failed to retrieve local snap unprotect status: "
- << cpp_strerror(r) << dendl;
+ derr << "failed to retrieve local snap unprotect status: "
+ << cpp_strerror(r) << dendl;
m_local_image_ctx->snap_lock.put_read();
finish(r);
return;
r = m_remote_image_ctx->is_snap_unprotected(snap_seq_it->first,
&remote_unprotected);
if (r < 0) {
- lderr(cct) << "failed to retrieve remote snap unprotect status: "
- << cpp_strerror(r) << dendl;
+ derr << "failed to retrieve remote snap unprotect status: "
+ << cpp_strerror(r) << dendl;
m_remote_image_ctx->snap_lock.put_read();
finish(r);
return;
m_prev_snap_id = *snap_id_it;
m_snap_name = get_snapshot_name(m_local_image_ctx, m_prev_snap_id);
- ldout(cct, 20) << ": "
- << "snap_name=" << m_snap_name << ", "
- << "snap_id=" << m_prev_snap_id << dendl;
+ dout(20) << ": "
+ << "snap_name=" << m_snap_name << ", "
+ << "snap_id=" << m_prev_snap_id << dendl;
Context *ctx = create_context_callback<
SnapshotCopyRequest<I>, &SnapshotCopyRequest<I>::handle_snap_unprotect>(
template <typename I>
void SnapshotCopyRequest<I>::handle_snap_unprotect(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to unprotect snapshot '" << m_snap_name << "': "
- << cpp_strerror(r) << dendl;
+ derr << ": failed to unprotect snapshot '" << m_snap_name << "': "
+ << cpp_strerror(r) << dendl;
finish(r);
return;
}
template <typename I>
void SnapshotCopyRequest<I>::send_snap_remove() {
- CephContext *cct = m_local_image_ctx->cct;
-
SnapIdSet::iterator snap_id_it = m_local_snap_ids.begin();
if (m_prev_snap_id != CEPH_NOSNAP) {
snap_id_it = m_local_snap_ids.upper_bound(m_prev_snap_id);
m_prev_snap_id = *snap_id_it;
m_snap_name = get_snapshot_name(m_local_image_ctx, m_prev_snap_id);
- ldout(cct, 20) << ": "
- << "snap_name=" << m_snap_name << ", "
- << "snap_id=" << m_prev_snap_id << dendl;
+ dout(20) << ": "
+ << "snap_name=" << m_snap_name << ", "
+ << "snap_id=" << m_prev_snap_id << dendl;
Context *ctx = create_context_callback<
SnapshotCopyRequest<I>, &SnapshotCopyRequest<I>::handle_snap_remove>(
template <typename I>
void SnapshotCopyRequest<I>::handle_snap_remove(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to remove snapshot '" << m_snap_name << "': "
- << cpp_strerror(r) << dendl;
+ derr << ": failed to remove snapshot '" << m_snap_name << "': "
+ << cpp_strerror(r) << dendl;
finish(r);
return;
}
template <typename I>
void SnapshotCopyRequest<I>::send_snap_create() {
- CephContext *cct = m_local_image_ctx->cct;
-
SnapIdSet::iterator snap_id_it = m_remote_snap_ids.begin();
if (m_prev_snap_id != CEPH_NOSNAP) {
snap_id_it = m_remote_snap_ids.upper_bound(m_prev_snap_id);
auto snap_info_it = m_remote_image_ctx->snap_info.find(m_prev_snap_id);
if (snap_info_it == m_remote_image_ctx->snap_info.end()) {
m_remote_image_ctx->snap_lock.put_read();
- lderr(cct) << "failed to retrieve remote snap info: " << m_snap_name
- << dendl;
+ derr << "failed to retrieve remote snap info: " << m_snap_name
+ << dendl;
finish(-ENOENT);
return;
}
m_remote_image_ctx->snap_lock.put_read();
- ldout(cct, 20) << ": "
- << "snap_name=" << m_snap_name << ", "
- << "snap_id=" << m_prev_snap_id << ", "
- << "size=" << size << ", "
- << "parent_info=["
- << "pool_id=" << parent_spec.pool_id << ", "
- << "image_id=" << parent_spec.image_id << ", "
- << "snap_id=" << parent_spec.snap_id << ", "
- << "overlap=" << parent_overlap << "]" << dendl;
+ dout(20) << ": "
+ << "snap_name=" << m_snap_name << ", "
+ << "snap_id=" << m_prev_snap_id << ", "
+ << "size=" << size << ", "
+ << "parent_info=["
+ << "pool_id=" << parent_spec.pool_id << ", "
+ << "image_id=" << parent_spec.image_id << ", "
+ << "snap_id=" << parent_spec.snap_id << ", "
+ << "overlap=" << parent_overlap << "]" << dendl;
Context *ctx = create_context_callback<
SnapshotCopyRequest<I>, &SnapshotCopyRequest<I>::handle_snap_create>(
template <typename I>
void SnapshotCopyRequest<I>::handle_snap_create(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to create snapshot '" << m_snap_name << "': "
- << cpp_strerror(r) << dendl;
+ derr << ": failed to create snapshot '" << m_snap_name << "': "
+ << cpp_strerror(r) << dendl;
finish(r);
return;
}
assert(snap_it != m_local_image_ctx->snap_ids.end());
librados::snap_t local_snap_id = snap_it->second;
- ldout(cct, 20) << ": mapping remote snap id " << m_prev_snap_id << " to "
- << local_snap_id << dendl;
+ dout(20) << ": mapping remote snap id " << m_prev_snap_id << " to "
+ << local_snap_id << dendl;
m_snap_seqs[m_prev_snap_id] = local_snap_id;
send_snap_create();
template <typename I>
void SnapshotCopyRequest<I>::send_snap_protect() {
- CephContext *cct = m_local_image_ctx->cct;
-
SnapIdSet::iterator snap_id_it = m_remote_snap_ids.begin();
if (m_prev_snap_id != CEPH_NOSNAP) {
snap_id_it = m_remote_snap_ids.upper_bound(m_prev_snap_id);
int r = m_remote_image_ctx->is_snap_protected(remote_snap_id,
&remote_protected);
if (r < 0) {
- lderr(cct) << "failed to retrieve remote snap protect status: "
- << cpp_strerror(r) << dendl;
+ derr << "failed to retrieve remote snap protect status: "
+ << cpp_strerror(r) << dendl;
m_remote_image_ctx->snap_lock.put_read();
finish(r);
return;
r = m_local_image_ctx->is_snap_protected(snap_seq_it->second,
&local_protected);
if (r < 0) {
- lderr(cct) << "failed to retrieve local snap protect status: "
- << cpp_strerror(r) << dendl;
+ derr << "failed to retrieve local snap protect status: "
+ << cpp_strerror(r) << dendl;
m_local_image_ctx->snap_lock.put_read();
finish(r);
return;
m_prev_snap_id = *snap_id_it;
m_snap_name = get_snapshot_name(m_remote_image_ctx, m_prev_snap_id);
- ldout(cct, 20) << ": "
- << "snap_name=" << m_snap_name << ", "
- << "snap_id=" << m_prev_snap_id << dendl;
+ dout(20) << ": "
+ << "snap_name=" << m_snap_name << ", "
+ << "snap_id=" << m_prev_snap_id << dendl;
Context *ctx = create_context_callback<
SnapshotCopyRequest<I>, &SnapshotCopyRequest<I>::handle_snap_protect>(
template <typename I>
void SnapshotCopyRequest<I>::handle_snap_protect(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to protect snapshot '" << m_snap_name << "': "
- << cpp_strerror(r) << dendl;
+ derr << ": failed to protect snapshot '" << m_snap_name << "': "
+ << cpp_strerror(r) << dendl;
finish(r);
return;
}
template <typename I>
void SnapshotCopyRequest<I>::send_update_client() {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
compute_snap_map();
template <typename I>
void SnapshotCopyRequest<I>::handle_update_client(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to update client data: " << cpp_strerror(r)
- << dendl;
+ derr << ": failed to update client data: " << cpp_strerror(r)
+ << dendl;
finish(r);
return;
}
return false;
}
}
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 10) << ": snapshot copy canceled" << dendl;
+ dout(10) << ": snapshot copy canceled" << dendl;
finish(-ECANCELED);
return true;
}
}
m_local_image_ctx->snap_lock.put_read();
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
// Change the image size on disk so that the snapshot picks up
// the expected size. We can do this because the last snapshot
template <typename I>
void SnapshotCreateRequest<I>::handle_set_size(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to update image size '" << m_snap_name << "': "
- << cpp_strerror(r) << dendl;
+ derr << ": failed to update image size '" << m_snap_name << "': "
+ << cpp_strerror(r) << dendl;
finish(r);
return;
}
}
m_local_image_ctx->parent_lock.put_read();
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
librados::ObjectWriteOperation op;
librbd::cls_client::remove_parent(&op);
template <typename I>
void SnapshotCreateRequest<I>::handle_remove_parent(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to remove parent '" << m_snap_name << "': "
- << cpp_strerror(r) << dendl;
+ derr << ": failed to remove parent '" << m_snap_name << "': "
+ << cpp_strerror(r) << dendl;
finish(r);
return;
}
}
m_local_image_ctx->parent_lock.put_read();
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
librados::ObjectWriteOperation op;
librbd::cls_client::set_parent(&op, m_parent_spec, m_parent_overlap);
template <typename I>
void SnapshotCreateRequest<I>::handle_set_parent(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to set parent '" << m_snap_name << "': "
- << cpp_strerror(r) << dendl;
+ derr << ": failed to set parent '" << m_snap_name << "': "
+ << cpp_strerror(r) << dendl;
finish(r);
return;
}
template <typename I>
void SnapshotCreateRequest<I>::send_snap_create() {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": snap_name=" << m_snap_name << dendl;
+ dout(20) << ": snap_name=" << m_snap_name << dendl;
Context *ctx = create_context_callback<
SnapshotCreateRequest<I>, &SnapshotCreateRequest<I>::handle_snap_create>(
template <typename I>
void SnapshotCreateRequest<I>::handle_snap_create(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to create snapshot '" << m_snap_name << "': "
- << cpp_strerror(r) << dendl;
+ derr << ": failed to create snapshot '" << m_snap_name << "': "
+ << cpp_strerror(r) << dendl;
finish(r);
return;
}
}
template <typename I>
void SnapshotCreateRequest<I>::send_create_object_map() {
- CephContext *cct = m_local_image_ctx->cct;
if (!m_local_image_ctx->test_features(RBD_FEATURE_OBJECT_MAP)) {
finish(0);
m_local_image_ctx->snap_lock.get_read();
auto snap_it = m_local_image_ctx->snap_ids.find(m_snap_name);
if (snap_it == m_local_image_ctx->snap_ids.end()) {
- lderr(cct) << "failed to locate snap: " << m_snap_name << dendl;
+ derr << "failed to locate snap: " << m_snap_name << dendl;
m_local_image_ctx->snap_lock.put_read();
finish(-ENOENT);
return;
m_local_image_ctx->id, local_snap_id));
uint64_t object_count = Striper::get_num_objects(m_local_image_ctx->layout,
m_size);
- ldout(cct, 20) << ": "
- << "object_map_oid=" << object_map_oid << ", "
- << "object_count=" << object_count << dendl;
+ dout(20) << ": "
+ << "object_map_oid=" << object_map_oid << ", "
+ << "object_count=" << object_count << dendl;
// initialize an empty object map of the correct size (object sync
// will populate the object map)
template <typename I>
void SnapshotCreateRequest<I>::handle_create_object_map(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to create object map: " << cpp_strerror(r)
- << dendl;
+ derr << ": failed to create object map: " << cpp_strerror(r)
+ << dendl;
finish(r);
return;
}
template <typename I>
void SnapshotCreateRequest<I>::finish(int r) {
- CephContext *cct = m_local_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
m_on_finish->complete(r);
delete this;
sync_point.snap_name = SNAP_NAME_PREFIX + "." + m_mirror_uuid + "." +
uuid_gen.to_string();
- CephContext *cct = m_remote_image_ctx->cct;
- ldout(cct, 20) << ": sync_point=" << sync_point << dendl;
+ dout(20) << ": sync_point=" << sync_point << dendl;
bufferlist client_data_bl;
librbd::journal::ClientData client_data(m_client_meta_copy);
template <typename I>
void SyncPointCreateRequest<I>::handle_update_client(int r) {
- CephContext *cct = m_remote_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to update client data: " << cpp_strerror(r)
- << dendl;
+ derr << ": failed to update client data: " << cpp_strerror(r)
+ << dendl;
finish(r);
return;
}
template <typename I>
void SyncPointCreateRequest<I>::send_refresh_image() {
- CephContext *cct = m_remote_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
Context *ctx = create_context_callback<
SyncPointCreateRequest<I>, &SyncPointCreateRequest<I>::handle_refresh_image>(
template <typename I>
void SyncPointCreateRequest<I>::handle_refresh_image(int r) {
- CephContext *cct = m_remote_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": remote image refresh failed: " << cpp_strerror(r) << dendl;
+ derr << ": remote image refresh failed: " << cpp_strerror(r) << dendl;
finish(r);
return;
}
template <typename I>
void SyncPointCreateRequest<I>::send_create_snap() {
- CephContext *cct = m_remote_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
MirrorPeerSyncPoint &sync_point = m_client_meta_copy.sync_points.back();
template <typename I>
void SyncPointCreateRequest<I>::handle_create_snap(int r) {
- CephContext *cct = m_remote_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r == -EEXIST) {
send_update_client();
return;
} else if (r < 0) {
- lderr(cct) << ": failed to create snapshot: " << cpp_strerror(r) << dendl;
+ derr << ": failed to create snapshot: " << cpp_strerror(r) << dendl;
finish(r);
return;
}
template <typename I>
void SyncPointCreateRequest<I>::finish(int r) {
- CephContext *cct = m_remote_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
m_on_finish->complete(r);
delete this;
const std::string &snap_name = m_snap_names.front();
- CephContext *cct = m_remote_image_ctx->cct;
- ldout(cct, 20) << ": snap_name=" << snap_name << dendl;
+ dout(20) << ": snap_name=" << snap_name << dendl;
Context *ctx = create_context_callback<
SyncPointPruneRequest<I>, &SyncPointPruneRequest<I>::handle_remove_snap>(
template <typename I>
void SyncPointPruneRequest<I>::handle_remove_snap(int r) {
- CephContext *cct = m_remote_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
assert(!m_snap_names.empty());
std::string snap_name = m_snap_names.front();
r = 0;
}
if (r < 0) {
- lderr(cct) << ": failed to remove snapshot '" << snap_name << "': "
- << cpp_strerror(r) << dendl;
+ derr << ": failed to remove snapshot '" << snap_name << "': "
+ << cpp_strerror(r) << dendl;
finish(r);
return;
}
template <typename I>
void SyncPointPruneRequest<I>::send_refresh_image() {
- CephContext *cct = m_remote_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
Context *ctx = create_context_callback<
SyncPointPruneRequest<I>, &SyncPointPruneRequest<I>::handle_refresh_image>(
template <typename I>
void SyncPointPruneRequest<I>::handle_refresh_image(int r) {
- CephContext *cct = m_remote_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": remote image refresh failed: " << cpp_strerror(r) << dendl;
+ derr << ": remote image refresh failed: " << cpp_strerror(r) << dendl;
finish(r);
return;
}
template <typename I>
void SyncPointPruneRequest<I>::send_update_client() {
- CephContext *cct = m_remote_image_ctx->cct;
- ldout(cct, 20) << dendl;
+ dout(20) << dendl;
if (m_sync_complete) {
m_client_meta_copy.sync_points.pop_front();
template <typename I>
void SyncPointPruneRequest<I>::handle_update_client(int r) {
- CephContext *cct = m_remote_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
if (r < 0) {
- lderr(cct) << ": failed to update client data: " << cpp_strerror(r)
- << dendl;
+ derr << ": failed to update client data: " << cpp_strerror(r)
+ << dendl;
finish(r);
return;
}
template <typename I>
void SyncPointPruneRequest<I>::finish(int r) {
- CephContext *cct = m_remote_image_ctx->cct;
- ldout(cct, 20) << ": r=" << r << dendl;
+ dout(20) << ": r=" << r << dendl;
m_on_finish->complete(r);
delete this;