From 8ed81b033a7a9120a24611c9e193d85e109ad2e5 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 15 Mar 2017 16:33:58 -0400 Subject: [PATCH] librbd: clean up debug messages within image create state machine Signed-off-by: Jason Dillaman (cherry picked from commit d4e27c48aa3f96f650d6cbfe103be5aa980e0f56) --- src/librbd/image/CreateRequest.cc | 92 ++++++++++++++++--------------- 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/src/librbd/image/CreateRequest.cc b/src/librbd/image/CreateRequest.cc index 85c944aad945e..c88e7b099c805 100644 --- a/src/librbd/image/CreateRequest.cc +++ b/src/librbd/image/CreateRequest.cc @@ -18,7 +18,8 @@ #define dout_subsys ceph_subsys_rbd #undef dout_prefix -#define dout_prefix *_dout << "librbd::image::CreateRequest: " +#define dout_prefix *_dout << "librbd::image::CreateRequest: " << __func__ \ + << ": " namespace librbd { namespace image { @@ -113,6 +114,19 @@ int get_image_option(const ImageOptions &image_options, int option, } // anonymous namespace +template +int CreateRequest::validate_order(CephContext *cct, uint8_t order) { + if (order > 25 || order < 12) { + lderr(cct) << "order must be in the range [12, 25]" << dendl; + return -EDOM; + } + return 0; +} + +#undef dout_prefix +#define dout_prefix *_dout << "librbd::image::CreateRequest: " << this << " " \ + << __func__ << ": " + template CreateRequest::CreateRequest(IoCtx &ioctx, const std::string &image_name, const std::string &image_id, uint64_t size, @@ -214,18 +228,9 @@ CreateRequest::CreateRequest(IoCtx &ioctx, const std::string &image_name, << "data_pool=" << m_data_pool << dendl; } -template -int CreateRequest::validate_order(CephContext *cct, uint8_t order) { - if (order > 25 || order < 12) { - lderr(cct) << "order must be in the range [12, 25]" << dendl; - return -EDOM; - } - return 0; -} - template void CreateRequest::send() { - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; int r = validate_features(m_cct, m_features, m_force_non_primary); if (r < 0) { @@ -267,7 +272,7 @@ void CreateRequest::validate_pool() { return; } - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; using klass = CreateRequest; librados::AioCompletion *comp = @@ -283,7 +288,7 @@ void CreateRequest::validate_pool() { template void CreateRequest::handle_validate_pool(int r) { - ldout(m_cct, 20) << __func__ << ": r=" << r << dendl; + ldout(m_cct, 20) << "r=" << r << dendl; if (r == 0) { create_id_object(); @@ -328,7 +333,7 @@ void CreateRequest::handle_validate_pool(int r) { template void CreateRequest::create_id_object() { - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; librados::ObjectWriteOperation op; op.create(true); @@ -344,7 +349,7 @@ void CreateRequest::create_id_object() { template void CreateRequest::handle_create_id_object(int r) { - ldout(m_cct, 20) << __func__ << ": r=" << r << dendl; + ldout(m_cct, 20) << "r=" << r << dendl; if (r < 0) { lderr(m_cct) << "error creating RBD id object: " << cpp_strerror(r) @@ -358,7 +363,7 @@ void CreateRequest::handle_create_id_object(int r) { template void CreateRequest::add_image_to_directory() { - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; librados::ObjectWriteOperation op; cls_client::dir_add_image(&op, m_image_name, m_image_id); @@ -373,7 +378,7 @@ void CreateRequest::add_image_to_directory() { template void CreateRequest::handle_add_image_to_directory(int r) { - ldout(m_cct, 20) << __func__ << ": r=" << r << dendl; + ldout(m_cct, 20) << "r=" << r << dendl; if (r < 0) { lderr(m_cct) << "error adding image to directory: " << cpp_strerror(r) @@ -393,7 +398,7 @@ void CreateRequest::negotiate_features() { return; } - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; librados::ObjectReadOperation op; cls_client::get_all_features_start(&op); @@ -408,7 +413,7 @@ void CreateRequest::negotiate_features() { template void CreateRequest::handle_negotiate_features(int r) { - ldout(m_cct, 20) << __func__ << ": r=" << r << dendl; + ldout(m_cct, 20) << "r=" << r << dendl; uint64_t all_features; if (r >= 0) { @@ -429,7 +434,7 @@ void CreateRequest::handle_negotiate_features(int r) { template void CreateRequest::create_image() { - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; assert(m_data_pool.empty() || m_data_pool_id != -1); ostringstream oss; @@ -454,7 +459,7 @@ void CreateRequest::create_image() { template void CreateRequest::handle_create_image(int r) { - ldout(m_cct, 20) << __func__ << ": r=" << r << dendl; + ldout(m_cct, 20) << "r=" << r << dendl; if (r < 0) { lderr(m_cct) << "error writing header: " << cpp_strerror(r) << dendl; @@ -474,7 +479,7 @@ void CreateRequest::set_stripe_unit_count() { return; } - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; librados::ObjectWriteOperation op; cls_client::set_stripe_unit_count(&op, m_stripe_unit, m_stripe_count); @@ -489,7 +494,7 @@ void CreateRequest::set_stripe_unit_count() { template void CreateRequest::handle_set_stripe_unit_count(int r) { - ldout(m_cct, 20) << __func__ << ": r=" << r << dendl; + ldout(m_cct, 20) << "r=" << r << dendl; if (r < 0) { lderr(m_cct) << "error setting stripe unit/count: " @@ -509,7 +514,7 @@ void CreateRequest::object_map_resize() { return; } - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; librados::ObjectWriteOperation op; cls_client::object_map_resize(&op, Striper::get_num_objects(m_layout, m_size), @@ -525,7 +530,7 @@ void CreateRequest::object_map_resize() { template void CreateRequest::handle_object_map_resize(int r) { - ldout(m_cct, 20) << __func__ << ": r=" << r << dendl; + ldout(m_cct, 20) << "r=" << r << dendl; if (r < 0) { lderr(m_cct) << "error creating initial object map: " @@ -546,7 +551,7 @@ void CreateRequest::fetch_mirror_mode() { return; } - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; librados::ObjectReadOperation op; cls_client::mirror_mode_get_start(&op); @@ -562,7 +567,7 @@ void CreateRequest::fetch_mirror_mode() { template void CreateRequest::handle_fetch_mirror_mode(int r) { - ldout(m_cct, 20) << __func__ << ": r=" << r << dendl; + ldout(m_cct, 20) << "r=" << r << dendl; if ((r < 0) && (r != -ENOENT)) { lderr(m_cct) << "failed to retrieve mirror mode: " << cpp_strerror(r) @@ -595,8 +600,7 @@ void CreateRequest::handle_fetch_mirror_mode(int r) { break; default: lderr(m_cct) << "Unknown mirror mode (" - << static_cast(mirror_mode_internal) << ")" - << dendl; + << static_cast(mirror_mode_internal) << ")" << dendl; r = -EINVAL; remove_object_map(); return; @@ -607,7 +611,7 @@ void CreateRequest::handle_fetch_mirror_mode(int r) { template void CreateRequest::journal_create() { - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; using klass = CreateRequest; Context *ctx = create_context_callback( @@ -627,7 +631,7 @@ void CreateRequest::journal_create() { template void CreateRequest::handle_journal_create(int r) { - ldout(m_cct, 20) << __func__ << ": r=" << r << dendl; + ldout(m_cct, 20) << "r=" << r << dendl; if (r < 0) { lderr(m_cct) << "error creating journal: " << cpp_strerror(r) @@ -649,7 +653,7 @@ void CreateRequest::mirror_image_enable() { return; } - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; auto ctx = create_context_callback< CreateRequest, &CreateRequest::handle_mirror_image_enable>(this); auto req = mirror::EnableRequest::create(m_ioctx, m_image_id, @@ -660,7 +664,7 @@ void CreateRequest::mirror_image_enable() { template void CreateRequest::handle_mirror_image_enable(int r) { - ldout(m_cct, 20) << __func__ << ": r=" << r << dendl; + ldout(m_cct, 20) << "r=" << r << dendl; if (r < 0) { lderr(m_cct) << "cannot enable mirroring: " << cpp_strerror(r) @@ -676,7 +680,7 @@ void CreateRequest::handle_mirror_image_enable(int r) { template void CreateRequest::complete(int r) { - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; if (r == 0) { ldout(m_cct, 20) << "done." << dendl; @@ -694,7 +698,7 @@ void CreateRequest::journal_remove() { return; } - ldout(m_cct, 20) << this << " " <<__func__ << dendl; + ldout(m_cct, 20) << dendl; using klass = CreateRequest; Context *ctx = create_context_callback( @@ -709,7 +713,7 @@ void CreateRequest::journal_remove() { template void CreateRequest::handle_journal_remove(int r) { - ldout(m_cct, 20) << __func__ << ": r=" << r << dendl; + ldout(m_cct, 20) << "r=" << r << dendl; if (r < 0) { lderr(m_cct) << "error cleaning up journal after creation failed: " @@ -726,7 +730,7 @@ void CreateRequest::remove_object_map() { return; } - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; using klass = CreateRequest; librados::AioCompletion *comp = @@ -738,7 +742,7 @@ void CreateRequest::remove_object_map() { template void CreateRequest::handle_remove_object_map(int r) { - ldout(m_cct, 20) << __func__ << ": r=" << r << dendl; + ldout(m_cct, 20) << "r=" << r << dendl; if (r < 0) { lderr(m_cct) << "error cleaning up object map after creation failed: " @@ -750,7 +754,7 @@ void CreateRequest::handle_remove_object_map(int r) { template void CreateRequest::remove_header_object() { - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; using klass = CreateRequest; librados::AioCompletion *comp = @@ -762,7 +766,7 @@ void CreateRequest::remove_header_object() { template void CreateRequest::handle_remove_header_object(int r) { - ldout(m_cct, 20) << __func__ << ": r=" << r << dendl; + ldout(m_cct, 20) << "r=" << r << dendl; if (r < 0) { lderr(m_cct) << "error cleaning up image header after creation failed: " @@ -774,7 +778,7 @@ void CreateRequest::handle_remove_header_object(int r) { template void CreateRequest::remove_from_dir() { - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; librados::ObjectWriteOperation op; cls_client::dir_remove_image(&op, m_image_name, m_image_id); @@ -789,7 +793,7 @@ void CreateRequest::remove_from_dir() { template void CreateRequest::handle_remove_from_dir(int r) { - ldout(m_cct, 20) << __func__ << ": r=" << r << dendl; + ldout(m_cct, 20) << "r=" << r << dendl; if (r < 0) { lderr(m_cct) << "error cleaning up image from rbd_directory object " @@ -801,7 +805,7 @@ void CreateRequest::handle_remove_from_dir(int r) { template void CreateRequest::remove_id_object() { - ldout(m_cct, 20) << this << " " << __func__ << dendl; + ldout(m_cct, 20) << dendl; using klass = CreateRequest; librados::AioCompletion *comp = @@ -813,7 +817,7 @@ void CreateRequest::remove_id_object() { template void CreateRequest::handle_remove_id_object(int r) { - ldout(m_cct, 20) << __func__ << ": r=" << r << dendl; + ldout(m_cct, 20) << "r=" << r << dendl; if (r < 0) { lderr(m_cct) << "error cleaning up id object after creation failed: " -- 2.39.5