From c62a07a9234b36e85e52efd9f9ccd95727c6ac16 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Thu, 30 Jul 2015 14:58:18 -0400 Subject: [PATCH] librbd: removed Async* prefix from request state machines In preparation for adding more snapshot handling request state machines, simplify the naming of the existing classes by removing the Async prefix. Signed-off-by: Jason Dillaman --- ...yncFlattenRequest.cc => FlattenRequest.cc} | 12 ++--- ...AsyncFlattenRequest.h => FlattenRequest.h} | 10 ++-- src/librbd/ImageCtx.cc | 8 +-- src/librbd/ImageCtx.h | 4 +- src/librbd/Makefile.am | 14 +++--- src/librbd/RebuildObjectMapRequest.cc | 14 +++--- ...AsyncResizeRequest.cc => ResizeRequest.cc} | 50 +++++++++---------- .../{AsyncResizeRequest.h => ResizeRequest.h} | 14 +++--- .../{AsyncTrimRequest.cc => TrimRequest.cc} | 26 +++++----- .../{AsyncTrimRequest.h => TrimRequest.h} | 10 ++-- src/librbd/internal.cc | 18 +++---- 11 files changed, 87 insertions(+), 93 deletions(-) rename src/librbd/{AsyncFlattenRequest.cc => FlattenRequest.cc} (94%) rename src/librbd/{AsyncFlattenRequest.h => FlattenRequest.h} (89%) rename src/librbd/{AsyncResizeRequest.cc => ResizeRequest.cc} (85%) rename src/librbd/{AsyncResizeRequest.h => ResizeRequest.h} (89%) rename src/librbd/{AsyncTrimRequest.cc => TrimRequest.cc} (94%) rename src/librbd/{AsyncTrimRequest.h => TrimRequest.h} (91%) diff --git a/src/librbd/AsyncFlattenRequest.cc b/src/librbd/FlattenRequest.cc similarity index 94% rename from src/librbd/AsyncFlattenRequest.cc rename to src/librbd/FlattenRequest.cc index dbcf3340dcca7..40e09af5aa0eb 100644 --- a/src/librbd/AsyncFlattenRequest.cc +++ b/src/librbd/FlattenRequest.cc @@ -1,7 +1,7 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab -#include "librbd/AsyncFlattenRequest.h" +#include "librbd/FlattenRequest.h" #include "librbd/AioObjectRequest.h" #include "librbd/AsyncObjectThrottle.h" #include "librbd/ImageCtx.h" @@ -14,7 +14,7 @@ #define dout_subsys ceph_subsys_rbd #undef dout_prefix -#define dout_prefix *_dout << "librbd::AsyncFlattenRequest: " +#define dout_prefix *_dout << "librbd::FlattenRequest: " namespace librbd { @@ -59,7 +59,7 @@ private: uint64_t m_object_no; }; -bool AsyncFlattenRequest::should_complete(int r) { +bool FlattenRequest::should_complete(int r) { CephContext *cct = m_image_ctx.cct; ldout(cct, 5) << this << " should_complete: " << " r=" << r << dendl; if (r < 0 && !(r == -ENOENT && m_ignore_enoent) ) { @@ -88,7 +88,7 @@ bool AsyncFlattenRequest::should_complete(int r) { return false; } -void AsyncFlattenRequest::send() { +void FlattenRequest::send() { assert(m_image_ctx.owner_lock.is_locked()); CephContext *cct = m_image_ctx.cct; ldout(cct, 5) << this << " send" << dendl; @@ -104,7 +104,7 @@ void AsyncFlattenRequest::send() { throttle->start_ops(m_image_ctx.concurrent_management_ops); } -bool AsyncFlattenRequest::send_update_header() { +bool FlattenRequest::send_update_header() { assert(m_image_ctx.owner_lock.is_locked()); CephContext *cct = m_image_ctx.cct; @@ -142,7 +142,7 @@ bool AsyncFlattenRequest::send_update_header() { return false; } -bool AsyncFlattenRequest::send_update_children() { +bool FlattenRequest::send_update_children() { CephContext *cct = m_image_ctx.cct; RWLock::RLocker owner_locker(m_image_ctx.owner_lock); diff --git a/src/librbd/AsyncFlattenRequest.h b/src/librbd/FlattenRequest.h similarity index 89% rename from src/librbd/AsyncFlattenRequest.h rename to src/librbd/FlattenRequest.h index 01f16671c5269..02155f2e314af 100644 --- a/src/librbd/AsyncFlattenRequest.h +++ b/src/librbd/FlattenRequest.h @@ -1,7 +1,7 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab -#ifndef CEPH_LIBRBD_ASYNC_FLATTEN_REQUEST_H -#define CEPH_LIBRBD_ASYNC_FLATTEN_REQUEST_H +#ifndef CEPH_LIBRBD_FLATTEN_REQUEST_H +#define CEPH_LIBRBD_FLATTEN_REQUEST_H #include "librbd/AsyncRequest.h" #include "librbd/parent_types.h" @@ -12,10 +12,10 @@ namespace librbd { class ImageCtx; class ProgressContext; -class AsyncFlattenRequest : public AsyncRequest<> +class FlattenRequest : public AsyncRequest<> { public: - AsyncFlattenRequest(ImageCtx &image_ctx, Context *on_finish, + FlattenRequest(ImageCtx &image_ctx, Context *on_finish, uint64_t object_size, uint64_t overlap_objects, const ::SnapContext &snapc, ProgressContext &prog_ctx) : AsyncRequest(image_ctx, on_finish), m_object_size(object_size), @@ -78,4 +78,4 @@ private: } // namespace librbd -#endif // CEPH_LIBRBD_ASYNC_FLATTEN_REQUEST_H +#endif // CEPH_LIBRBD_FLATTEN_REQUEST_H diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index 8fd13e4f74231..d19c7c4515f9e 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -13,13 +13,13 @@ #include "librbd/AioImageRequestWQ.h" #include "librbd/AsyncOperation.h" #include "librbd/AsyncRequest.h" -#include "librbd/AsyncResizeRequest.h" #include "librbd/internal.h" #include "librbd/ImageCtx.h" #include "librbd/ImageWatcher.h" #include "librbd/Journal.h" #include "librbd/LibrbdAdminSocketHook.h" #include "librbd/ObjectMap.h" +#include "librbd/ResizeRequest.h" #include @@ -541,9 +541,9 @@ struct C_InvalidateCache : public Context { { assert(snap_lock.is_locked()); if (in_snap_id == CEPH_NOSNAP) { - if (!async_resize_reqs.empty() && - async_resize_reqs.front()->shrinking()) { - return async_resize_reqs.front()->get_image_size(); + if (!resize_reqs.empty() && + resize_reqs.front()->shrinking()) { + return resize_reqs.front()->get_image_size(); } return size; } diff --git a/src/librbd/ImageCtx.h b/src/librbd/ImageCtx.h index f61929c1a6dff..15b476d42b710 100644 --- a/src/librbd/ImageCtx.h +++ b/src/librbd/ImageCtx.h @@ -40,11 +40,11 @@ namespace librbd { class AioImageRequestWQ; class AsyncOperation; template class AsyncRequest; - class AsyncResizeRequest; class CopyupRequest; class LibrbdAdminSocketHook; class ImageWatcher; class Journal; + class ResizeRequest; struct ImageCtx { CephContext *cct; @@ -133,7 +133,7 @@ namespace librbd { atomic_t async_request_seq; - xlist async_resize_reqs; + xlist resize_reqs; AioImageRequestWQ *aio_work_queue; ContextWQ *op_work_queue; diff --git a/src/librbd/Makefile.am b/src/librbd/Makefile.am index 72268a7ef9bc7..dab84c61b2f1c 100644 --- a/src/librbd/Makefile.am +++ b/src/librbd/Makefile.am @@ -12,23 +12,23 @@ librbd_internal_la_SOURCES = \ librbd/AioImageRequest.cc \ librbd/AioImageRequestWQ.cc \ librbd/AioObjectRequest.cc \ - librbd/AsyncFlattenRequest.cc \ librbd/AsyncObjectThrottle.cc \ librbd/AsyncOperation.cc \ librbd/AsyncRequest.cc \ - librbd/AsyncResizeRequest.cc \ - librbd/AsyncTrimRequest.cc \ librbd/CopyupRequest.cc \ librbd/DiffIterate.cc \ librbd/ImageCtx.cc \ librbd/ImageWatcher.cc \ librbd/internal.cc \ + librbd/FlattenRequest.cc \ librbd/Journal.cc \ librbd/JournalReplay.cc \ librbd/LibrbdAdminSocketHook.cc \ librbd/LibrbdWriteback.cc \ librbd/ObjectMap.cc \ - librbd/RebuildObjectMapRequest.cc + librbd/RebuildObjectMapRequest.cc \ + librbd/ResizeRequest.cc \ + librbd/TrimRequest.cc noinst_LTLIBRARIES += librbd_internal.la librbd_api_la_SOURCES = \ @@ -58,17 +58,15 @@ noinst_HEADERS += \ librbd/AioImageRequest.h \ librbd/AioImageRequestWQ.h \ librbd/AioObjectRequest.h \ - librbd/AsyncFlattenRequest.h \ librbd/AsyncObjectThrottle.h \ librbd/AsyncOperation.h \ librbd/AsyncRequest.h \ - librbd/AsyncResizeRequest.h \ - librbd/AsyncTrimRequest.h \ librbd/CopyupRequest.h \ librbd/DiffIterate.h \ librbd/ImageCtx.h \ librbd/ImageWatcher.h \ librbd/internal.h \ + librbd/FlattenRequest.h \ librbd/Journal.h \ librbd/JournalReplay.h \ librbd/JournalTypes.h \ @@ -77,8 +75,10 @@ noinst_HEADERS += \ librbd/ObjectMap.h \ librbd/parent_types.h \ librbd/RebuildObjectMapRequest.h \ + librbd/ResizeRequest.h \ librbd/SnapInfo.h \ librbd/TaskFinisher.h \ + librbd/TrimRequest.h \ librbd/WatchNotifyTypes.h endif # WITH_RBD diff --git a/src/librbd/RebuildObjectMapRequest.cc b/src/librbd/RebuildObjectMapRequest.cc index 8a3b29fe0ecd7..9b2039b0e3b03 100644 --- a/src/librbd/RebuildObjectMapRequest.cc +++ b/src/librbd/RebuildObjectMapRequest.cc @@ -5,12 +5,12 @@ #include "common/dout.h" #include "common/errno.h" #include "librbd/AsyncObjectThrottle.h" -#include "librbd/AsyncResizeRequest.h" -#include "librbd/AsyncTrimRequest.h" #include "librbd/ImageCtx.h" #include "librbd/ImageWatcher.h" #include "librbd/internal.h" #include "librbd/ObjectMap.h" +#include "librbd/ResizeRequest.h" +#include "librbd/TrimRequest.h" #include #include @@ -269,10 +269,8 @@ void RebuildObjectMapRequest::send_trim_image() { orig_size = m_image_ctx.get_object_size() * m_image_ctx.object_map.size(); } - AsyncTrimRequest *req = new AsyncTrimRequest(m_image_ctx, - create_callback_context(), - orig_size, new_size, - m_prog_ctx); + TrimRequest *req = new TrimRequest(m_image_ctx, create_callback_context(), + orig_size, new_size, m_prog_ctx); req->send(); } @@ -349,8 +347,8 @@ void RebuildObjectMapRequest::send_update_header() { uint64_t RebuildObjectMapRequest::get_image_size() const { assert(m_image_ctx.snap_lock.is_locked()); if (m_image_ctx.snap_id == CEPH_NOSNAP) { - if (!m_image_ctx.async_resize_reqs.empty()) { - return m_image_ctx.async_resize_reqs.front()->get_image_size(); + if (!m_image_ctx.resize_reqs.empty()) { + return m_image_ctx.resize_reqs.front()->get_image_size(); } else { return m_image_ctx.size; } diff --git a/src/librbd/AsyncResizeRequest.cc b/src/librbd/ResizeRequest.cc similarity index 85% rename from src/librbd/AsyncResizeRequest.cc rename to src/librbd/ResizeRequest.cc index 998249265cb70..5b08a4ebf1bd7 100644 --- a/src/librbd/AsyncResizeRequest.cc +++ b/src/librbd/ResizeRequest.cc @@ -1,22 +1,22 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab -#include "librbd/AsyncResizeRequest.h" -#include "librbd/AsyncTrimRequest.h" +#include "librbd/ResizeRequest.h" #include "librbd/ImageCtx.h" #include "librbd/ImageWatcher.h" #include "librbd/internal.h" #include "librbd/ObjectMap.h" +#include "librbd/TrimRequest.h" #include "common/dout.h" #include "common/errno.h" #define dout_subsys ceph_subsys_rbd #undef dout_prefix -#define dout_prefix *_dout << "librbd::AsyncResizeRequest: " +#define dout_prefix *_dout << "librbd::ResizeRequest: " namespace librbd { -AsyncResizeRequest::AsyncResizeRequest(ImageCtx &image_ctx, Context *on_finish, +ResizeRequest::ResizeRequest(ImageCtx &image_ctx, Context *on_finish, uint64_t new_size, ProgressContext &prog_ctx) : AsyncRequest(image_ctx, on_finish), @@ -26,13 +26,13 @@ AsyncResizeRequest::AsyncResizeRequest(ImageCtx &image_ctx, Context *on_finish, { } -AsyncResizeRequest::~AsyncResizeRequest() { - AsyncResizeRequest *next_req = NULL; +ResizeRequest::~ResizeRequest() { + ResizeRequest *next_req = NULL; { RWLock::WLocker snap_locker(m_image_ctx.snap_lock); assert(m_xlist_item.remove_myself()); - if (!m_image_ctx.async_resize_reqs.empty()) { - next_req = m_image_ctx.async_resize_reqs.front(); + if (!m_image_ctx.resize_reqs.empty()) { + next_req = m_image_ctx.resize_reqs.front(); } } @@ -42,7 +42,7 @@ AsyncResizeRequest::~AsyncResizeRequest() { } } -bool AsyncResizeRequest::safely_cancel(int r) { +bool ResizeRequest::safely_cancel(int r) { CephContext *cct = m_image_ctx.cct; ldout(cct, 5) << this << " safely_cancel: " << " r=" << r << dendl; @@ -59,7 +59,7 @@ bool AsyncResizeRequest::safely_cancel(int r) { return true; } -bool AsyncResizeRequest::should_complete(int r) { +bool ResizeRequest::should_complete(int r) { CephContext *cct = m_image_ctx.cct; ldout(cct, 5) << this << " should_complete: " << " r=" << r << dendl; @@ -115,19 +115,19 @@ bool AsyncResizeRequest::should_complete(int r) { return false; } -void AsyncResizeRequest::send() { +void ResizeRequest::send() { assert(m_image_ctx.owner_lock.is_locked()); { RWLock::WLocker snap_locker(m_image_ctx.snap_lock); if (!m_xlist_item.is_on_list()) { - m_image_ctx.async_resize_reqs.push_back(&m_xlist_item); - if (m_image_ctx.async_resize_reqs.front() != this) { + m_image_ctx.resize_reqs.push_back(&m_xlist_item); + if (m_image_ctx.resize_reqs.front() != this) { return; } } - assert(m_image_ctx.async_resize_reqs.front() == this); + assert(m_image_ctx.resize_reqs.front() == this); m_original_size = m_image_ctx.size; compute_parent_overlap(); } @@ -151,7 +151,7 @@ void AsyncResizeRequest::send() { } } -void AsyncResizeRequest::send_flush() { +void ResizeRequest::send_flush() { ldout(m_image_ctx.cct, 5) << this << " send_flush: " << " original_size=" << m_original_size << " new_size=" << m_new_size << dendl; @@ -163,7 +163,7 @@ void AsyncResizeRequest::send_flush() { m_image_ctx.flush_async_operations(create_async_callback_context()); } -void AsyncResizeRequest::send_invalidate_cache() { +void ResizeRequest::send_invalidate_cache() { assert(m_image_ctx.owner_lock.is_locked()); ldout(m_image_ctx.cct, 5) << this << " send_invalidate_cache: " << " original_size=" << m_original_size @@ -175,21 +175,19 @@ void AsyncResizeRequest::send_invalidate_cache() { m_image_ctx.invalidate_cache(create_callback_context()); } -void AsyncResizeRequest::send_trim_image() { +void ResizeRequest::send_trim_image() { assert(m_image_ctx.owner_lock.is_locked()); ldout(m_image_ctx.cct, 5) << this << " send_trim_image: " << " original_size=" << m_original_size << " new_size=" << m_new_size << dendl; m_state = STATE_TRIM_IMAGE; - AsyncTrimRequest *req = new AsyncTrimRequest(m_image_ctx, - create_callback_context(), - m_original_size, m_new_size, - m_prog_ctx); + TrimRequest *req = new TrimRequest(m_image_ctx, create_callback_context(), + m_original_size, m_new_size, m_prog_ctx); req->send(); } -void AsyncResizeRequest::send_grow_object_map() { +void ResizeRequest::send_grow_object_map() { assert(m_image_ctx.owner_lock.is_locked()); if (!m_image_ctx.object_map.enabled()) { send_update_header(); @@ -209,7 +207,7 @@ void AsyncResizeRequest::send_grow_object_map() { create_callback_context()); } -bool AsyncResizeRequest::send_shrink_object_map() { +bool ResizeRequest::send_shrink_object_map() { assert(m_image_ctx.owner_lock.is_locked()); if (!m_image_ctx.object_map.enabled() || m_new_size > m_original_size) { return true; @@ -229,7 +227,7 @@ bool AsyncResizeRequest::send_shrink_object_map() { return false; } -void AsyncResizeRequest::send_update_header() { +void ResizeRequest::send_update_header() { assert(m_image_ctx.owner_lock.is_locked()); ldout(m_image_ctx.cct, 5) << this << " send_update_header: " @@ -262,7 +260,7 @@ void AsyncResizeRequest::send_update_header() { rados_completion->release(); } -void AsyncResizeRequest::compute_parent_overlap() { +void ResizeRequest::compute_parent_overlap() { RWLock::RLocker l2(m_image_ctx.parent_lock); if (m_image_ctx.parent == NULL) { m_new_parent_overlap = 0; @@ -271,7 +269,7 @@ void AsyncResizeRequest::compute_parent_overlap() { } } -void AsyncResizeRequest::update_size_and_overlap() { +void ResizeRequest::update_size_and_overlap() { RWLock::WLocker snap_locker(m_image_ctx.snap_lock); m_image_ctx.size = m_new_size; diff --git a/src/librbd/AsyncResizeRequest.h b/src/librbd/ResizeRequest.h similarity index 89% rename from src/librbd/AsyncResizeRequest.h rename to src/librbd/ResizeRequest.h index 0acad6fb9504b..23abefed7d6c4 100644 --- a/src/librbd/AsyncResizeRequest.h +++ b/src/librbd/ResizeRequest.h @@ -1,7 +1,7 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab -#ifndef CEPH_LIBRBD_ASYNC_RESIZE_REQUEST_H -#define CEPH_LIBRBD_ASYNC_RESIZE_REQUEST_H +#ifndef CEPH_LIBRBD_RESIZE_REQUEST_H +#define CEPH_LIBRBD_RESIZE_REQUEST_H #include "librbd/AsyncRequest.h" #include "include/xlist.h" @@ -12,12 +12,12 @@ namespace librbd class ImageCtx; class ProgressContext; -class AsyncResizeRequest : public AsyncRequest<> +class ResizeRequest : public AsyncRequest<> { public: - AsyncResizeRequest(ImageCtx &image_ctx, Context *on_finish, uint64_t new_size, + ResizeRequest(ImageCtx &image_ctx, Context *on_finish, uint64_t new_size, ProgressContext &prog_ctx); - virtual ~AsyncResizeRequest(); + virtual ~ResizeRequest(); virtual void send(); @@ -80,7 +80,7 @@ private: ProgressContext &m_prog_ctx; uint64_t m_new_parent_overlap; - xlist::item m_xlist_item; + xlist::item m_xlist_item; virtual bool safely_cancel(int r); virtual bool should_complete(int r); @@ -99,4 +99,4 @@ private: } // namespace librbd -#endif // CEPH_LIBRBD_ASYNC_RESIZE_REQUEST_H +#endif // CEPH_LIBRBD_RESIZE_REQUEST_H diff --git a/src/librbd/AsyncTrimRequest.cc b/src/librbd/TrimRequest.cc similarity index 94% rename from src/librbd/AsyncTrimRequest.cc rename to src/librbd/TrimRequest.cc index 6159ef58bd3e5..a690ce5feeb9b 100644 --- a/src/librbd/AsyncTrimRequest.cc +++ b/src/librbd/TrimRequest.cc @@ -1,6 +1,6 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab -#include "librbd/AsyncTrimRequest.h" +#include "librbd/TrimRequest.h" #include "librbd/AsyncObjectThrottle.h" #include "librbd/AioObjectRequest.h" #include "librbd/ImageCtx.h" @@ -19,7 +19,7 @@ #define dout_subsys ceph_subsys_rbd #undef dout_prefix -#define dout_prefix *_dout << "librbd::AsyncTrimRequest: " +#define dout_prefix *_dout << "librbd::TrimRequest: " namespace librbd { @@ -82,9 +82,9 @@ private: uint64_t m_object_no; }; -AsyncTrimRequest::AsyncTrimRequest(ImageCtx &image_ctx, Context *on_finish, - uint64_t original_size, uint64_t new_size, - ProgressContext &prog_ctx) +TrimRequest::TrimRequest(ImageCtx &image_ctx, Context *on_finish, + uint64_t original_size, uint64_t new_size, + ProgressContext &prog_ctx) : AsyncRequest(image_ctx, on_finish), m_new_size(new_size), m_prog_ctx(prog_ctx) { @@ -104,7 +104,7 @@ AsyncTrimRequest::AsyncTrimRequest(ImageCtx &image_ctx, Context *on_finish, } -bool AsyncTrimRequest::should_complete(int r) +bool TrimRequest::should_complete(int r) { CephContext *cct = m_image_ctx.cct; ldout(cct, 5) << this << " should_complete: r=" << r << dendl; @@ -157,11 +157,11 @@ bool AsyncTrimRequest::should_complete(int r) return false; } -void AsyncTrimRequest::send() { +void TrimRequest::send() { send_copyup_objects(); } -void AsyncTrimRequest::send_copyup_objects() { +void TrimRequest::send_copyup_objects() { assert(m_image_ctx.owner_lock.is_locked()); assert(!m_image_ctx.image_watcher->is_lock_supported() || m_image_ctx.image_watcher->is_lock_owner()); @@ -212,7 +212,7 @@ void AsyncTrimRequest::send_copyup_objects() { throttle->start_ops(m_image_ctx.concurrent_management_ops); } -void AsyncTrimRequest::send_remove_objects() { +void TrimRequest::send_remove_objects() { assert(m_image_ctx.owner_lock.is_locked()); ldout(m_image_ctx.cct, 5) << this << " send_remove_objects: " @@ -230,7 +230,7 @@ void AsyncTrimRequest::send_remove_objects() { throttle->start_ops(m_image_ctx.concurrent_management_ops); } -void AsyncTrimRequest::send_pre_remove() { +void TrimRequest::send_pre_remove() { assert(m_image_ctx.owner_lock.is_locked()); if (m_delete_start >= m_num_objects) { send_clean_boundary(); @@ -269,7 +269,7 @@ void AsyncTrimRequest::send_pre_remove() { } } -void AsyncTrimRequest::send_post_remove() { +void TrimRequest::send_post_remove() { assert(m_image_ctx.owner_lock.is_locked()); bool clean_boundary = false; @@ -304,7 +304,7 @@ void AsyncTrimRequest::send_post_remove() { } } -void AsyncTrimRequest::send_clean_boundary() { +void TrimRequest::send_clean_boundary() { assert(m_image_ctx.owner_lock.is_locked()); CephContext *cct = m_image_ctx.cct; if (m_delete_off <= m_new_size) { @@ -353,7 +353,7 @@ void AsyncTrimRequest::send_clean_boundary() { completion->finish_adding_requests(); } -void AsyncTrimRequest::finish(int r) { +void TrimRequest::finish(int r) { m_state = STATE_FINISHED; async_complete(r); } diff --git a/src/librbd/AsyncTrimRequest.h b/src/librbd/TrimRequest.h similarity index 91% rename from src/librbd/AsyncTrimRequest.h rename to src/librbd/TrimRequest.h index 2160c405a4ffa..223c6005e3ba7 100644 --- a/src/librbd/AsyncTrimRequest.h +++ b/src/librbd/TrimRequest.h @@ -1,7 +1,7 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab -#ifndef CEPH_LIBRBD_ASYNC_TRIM_REQUEST_H -#define CEPH_LIBRBD_ASYNC_TRIM_REQUEST_H +#ifndef CEPH_LIBRBD_TRIM_REQUEST_H +#define CEPH_LIBRBD_TRIM_REQUEST_H #include "librbd/AsyncRequest.h" @@ -11,10 +11,10 @@ namespace librbd class ImageCtx; class ProgressContext; -class AsyncTrimRequest : public AsyncRequest<> +class TrimRequest : public AsyncRequest<> { public: - AsyncTrimRequest(ImageCtx &image_ctx, Context *on_finish, + TrimRequest(ImageCtx &image_ctx, Context *on_finish, uint64_t original_size, uint64_t new_size, ProgressContext &prog_ctx); @@ -87,4 +87,4 @@ private: } // namespace librbd -#endif // CEPH_LIBRBD_ASYNC_TRIM_REQUEST_H +#endif // CEPH_LIBRBD_TRIM_REQUEST_H diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index d925b42b229ac..704252bba2b03 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -21,18 +21,18 @@ #include "librbd/AioImageRequest.h" #include "librbd/AioImageRequestWQ.h" #include "librbd/AioObjectRequest.h" -#include "librbd/AsyncFlattenRequest.h" -#include "librbd/AsyncResizeRequest.h" -#include "librbd/AsyncTrimRequest.h" #include "librbd/CopyupRequest.h" #include "librbd/DiffIterate.h" #include "librbd/ImageCtx.h" #include "librbd/ImageWatcher.h" #include "librbd/internal.h" +#include "librbd/FlattenRequest.h" #include "librbd/Journal.h" #include "librbd/ObjectMap.h" #include "librbd/parent_types.h" #include "librbd/RebuildObjectMapRequest.h" +#include "librbd/ResizeRequest.h" +#include "librbd/TrimRequest.h" #include "include/util.h" #include @@ -326,8 +326,8 @@ int invoke_async_request(ImageCtx *ictx, const std::string& request_type, C_SaferCond ctx; ictx->snap_lock.get_read(); - AsyncTrimRequest *req = new AsyncTrimRequest(*ictx, &ctx, ictx->size, - newsize, prog_ctx); + TrimRequest *req = new TrimRequest(*ictx, &ctx, ictx->size, newsize, + prog_ctx); ictx->snap_lock.put_read(); req->send(); @@ -2335,8 +2335,7 @@ reprotect_and_return_err: ProgressContext& prog_ctx) { assert(ictx->owner_lock.is_locked()); - AsyncResizeRequest *req = new AsyncResizeRequest(*ictx, ctx, new_size, - prog_ctx); + ResizeRequest *req = new ResizeRequest(*ictx, ctx, new_size, prog_ctx); req->send(); } @@ -3339,9 +3338,8 @@ reprotect_and_return_err: overlap_objects = Striper::get_num_objects(ictx->layout, overlap); } - AsyncFlattenRequest *req = - new AsyncFlattenRequest(*ictx, ctx, object_size, overlap_objects, - snapc, prog_ctx); + FlattenRequest *req = new FlattenRequest(*ictx, ctx, object_size, + overlap_objects, snapc, prog_ctx); req->send(); return 0; } -- 2.39.5