]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd/crypto/LoadRequest: rename m_is_current_format_cloned
authorIlya Dryomov <idryomov@gmail.com>
Mon, 16 Sep 2024 09:37:49 +0000 (11:37 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 3 Oct 2024 16:32:17 +0000 (18:32 +0200)
Formats must also be cloned if the image is under migration, so
rename m_is_current_format_cloned to m_is_current_format_assumed to
avoid potential confusion with clone() being called in two places but
m_is_current_format_cloned being set in only one place.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/librbd/crypto/LoadRequest.cc
src/librbd/crypto/LoadRequest.h

index 5bc57d693c5d311db647de0cd3500b13ccf06864..a751605e0d5ee2d684b20a535fa251c852ebc6e2 100644 (file)
@@ -31,7 +31,7 @@ LoadRequest<I>::LoadRequest(
         Context* on_finish) : m_image_ctx(image_ctx),
                               m_on_finish(on_finish),
                               m_format_idx(0),
-                              m_is_current_format_cloned(false),
+                              m_is_current_format_assumed(false),
                               m_formats(std::move(formats)) {
 }
 
@@ -108,7 +108,7 @@ void LoadRequest<I>::handle_load(int r) {
   ldout(m_image_ctx->cct, 20) << "r=" << r << dendl;
 
   if (r < 0) {
-    if (m_is_current_format_cloned &&
+    if (m_is_current_format_assumed &&
         m_detected_format_name == UNKNOWN_FORMAT) {
       // encryption format was not detected, assume plaintext
       ldout(m_image_ctx->cct, 5) << "assuming plaintext for image "
@@ -125,7 +125,7 @@ void LoadRequest<I>::handle_load(int r) {
   }
 
   ldout(m_image_ctx->cct, 5) << "loaded format " << m_detected_format_name
-                             << (m_is_current_format_cloned ? " (cloned)" : "")
+                             << (m_is_current_format_assumed ? " (assumed)" : "")
                              << " for image " << m_current_image_ctx->name
                              << dendl;
 
@@ -136,8 +136,8 @@ void LoadRequest<I>::handle_load(int r) {
     if (m_format_idx >= m_formats.size()) {
       // try to load next ancestor using the same format
       ldout(m_image_ctx->cct, 20) << "cloning format" << dendl;
-      m_is_current_format_cloned = true;
       m_formats.push_back(m_formats[m_formats.size() - 1]->clone());
+      m_is_current_format_assumed = true;
     }
 
     load();
index 84f595bb6c61631c5cfa58b14abd2bcfe55ca90c..702748a24187da6b7955faab4416ebaa6ef233cc 100644 (file)
@@ -44,7 +44,7 @@ private:
     Context* m_on_finish;
 
     size_t m_format_idx;
-    bool m_is_current_format_cloned;
+    bool m_is_current_format_assumed;
     std::vector<EncryptionFormat> m_formats;
     I* m_current_image_ctx;
     std::string m_detected_format_name;