]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/librbd/operation/MigrateRequest.cc
import 15.2.0 Octopus source
[ceph.git] / ceph / src / librbd / operation / MigrateRequest.cc
index 71a6f93288efa38e09c230befe1e5138860cc66e..890d26c4b07b85bc086ba0fd494881194c443cf3 100644 (file)
@@ -40,7 +40,7 @@ public:
 
   int send() override {
     I &image_ctx = this->m_image_ctx;
-    ceph_assert(image_ctx.owner_lock.is_locked());
+    ceph_assert(ceph_mutex_is_locked(image_ctx.owner_lock));
     CephContext *cct = image_ctx.cct;
 
     if (image_ctx.exclusive_lock != nullptr &&
@@ -54,7 +54,6 @@ public:
   }
 
 private:
-  uint64_t m_object_size;
   ::SnapContext m_snapc;
   uint64_t m_object_no;
 
@@ -62,7 +61,7 @@ private:
 
   void start_async_op() {
     I &image_ctx = this->m_image_ctx;
-    ceph_assert(image_ctx.owner_lock.is_locked());
+    ceph_assert(ceph_mutex_is_locked(image_ctx.owner_lock));
     CephContext *cct = image_ctx.cct;
     ldout(cct, 10) << dendl;
 
@@ -95,13 +94,13 @@ private:
       return;
     }
 
-    RWLock::RLocker owner_locker(image_ctx.owner_lock);
+    std::shared_lock owner_locker{image_ctx.owner_lock};
     start_async_op();
   }
 
   bool is_within_overlap_bounds() {
     I &image_ctx = this->m_image_ctx;
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    std::shared_lock image_locker{image_ctx.image_lock};
 
     auto overlap = std::min(image_ctx.size, image_ctx.migration_info.overlap);
     return overlap > 0 &&
@@ -110,7 +109,7 @@ private:
 
   void migrate_object() {
     I &image_ctx = this->m_image_ctx;
-    ceph_assert(image_ctx.owner_lock.is_locked());
+    ceph_assert(ceph_mutex_is_locked(image_ctx.owner_lock));
     CephContext *cct = image_ctx.cct;
 
     auto ctx = create_context_callback<
@@ -118,8 +117,7 @@ private:
 
     if (is_within_overlap_bounds()) {
       bufferlist bl;
-      string oid = image_ctx.get_object_name(m_object_no);
-      auto req = new io::ObjectWriteRequest<I>(&image_ctx, oid, m_object_no, 0,
+      auto req = new io::ObjectWriteRequest<I>(&image_ctx, m_object_no, 0,
                                                std::move(bl), m_snapc, 0, {},
                                                ctx);
 
@@ -131,7 +129,7 @@ private:
       ceph_assert(image_ctx.parent != nullptr);
 
       auto req = deep_copy::ObjectCopyRequest<I>::create(
-        image_ctx.parent, &image_ctx, image_ctx.migration_info.snap_map,
+        image_ctx.parent, &image_ctx, 0, 0, image_ctx.migration_info.snap_map,
         m_object_no, image_ctx.migration_info.flatten, ctx);
 
       ldout(cct, 20) << "deep copy object req " << req << ", object_no "
@@ -159,7 +157,7 @@ private:
 template <typename I>
 void MigrateRequest<I>::send_op() {
   I &image_ctx = this->m_image_ctx;
-  ceph_assert(image_ctx.owner_lock.is_locked());
+  ceph_assert(ceph_mutex_is_locked(image_ctx.owner_lock));
   CephContext *cct = image_ctx.cct;
   ldout(cct, 10) << dendl;
 
@@ -183,7 +181,7 @@ template <typename I>
 void MigrateRequest<I>::migrate_objects() {
   I &image_ctx = this->m_image_ctx;
   CephContext *cct = image_ctx.cct;
-  ceph_assert(image_ctx.owner_lock.is_locked());
+  ceph_assert(ceph_mutex_is_locked(image_ctx.owner_lock));
 
   uint64_t overlap_objects = get_num_overlap_objects();
 
@@ -220,8 +218,7 @@ uint64_t MigrateRequest<I>::get_num_overlap_objects() {
   CephContext *cct = image_ctx.cct;
   ldout(cct, 10) << dendl;
 
-  RWLock::RLocker snap_locker(image_ctx.snap_lock);
-  RWLock::RLocker parent_locker(image_ctx.parent_lock);
+  std::shared_lock image_locker{image_ctx.image_lock};
 
   auto overlap = image_ctx.migration_info.overlap;