]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/bl: drop clone() and clone_empty() from buffer::raw.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Fri, 24 Jul 2020 09:13:04 +0000 (09:13 +0000)
committerRadosław Zarzyński <rzarzyns@redhat.com>
Mon, 23 May 2022 21:50:31 +0000 (23:50 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/blk/kernel/KernelDevice.cc
src/common/buffer.cc
src/common/buffer_seastar.cc
src/include/buffer_raw.h

index ee06af61e055f96f425af802a2a8c720d5558e68..ddba9473f59ece70e6a40cf0ada65ddb1303df83 100644 (file)
@@ -1065,11 +1065,6 @@ struct ExplicitHugePagePool {
       // don't delete nor unmmap; recycle the region instead
       region_q.push(data);
     }
-    raw* clone_empty() override {
-      // the entire cloning facility is used solely by the dev-only MemDB.
-      // see: https://github.com/ceph/ceph/pull/36282
-      ceph_abort_msg("this should be never called on this path!");
-    }
   };
 
   ExplicitHugePagePool(const size_t buffer_size, size_t buffers_in_pool)
index 18f510394e911fb2a047125c7bc3d1cd523bfad2..e32503c289021e20707ee0f11ffa0786946a2119 100644 (file)
@@ -87,15 +87,9 @@ static ceph::spinlock debug_lock;
    * raw_combined at the end.
    */
   class buffer::raw_combined : public buffer::raw {
-    size_t alignment;
   public:
-    raw_combined(char *dataptr, unsigned l, unsigned align,
-                int mempool)
-      : raw(dataptr, l, mempool),
-       alignment(align) {
-    }
-    raw* clone_empty() override {
-      return create(len, alignment).release();
+    raw_combined(char *dataptr, unsigned l, int mempool)
+      : raw(dataptr, l, mempool) {
     }
 
     static ceph::unique_leakable_ptr<buffer::raw>
@@ -123,7 +117,7 @@ static ceph::spinlock debug_lock;
       // actual data first, since it has presumably larger alignment restriction
       // then put the raw_combined at the end
       return ceph::unique_leakable_ptr<buffer::raw>(
-       new (ptr + datalen) raw_combined(ptr, len, align, mempool));
+       new (ptr + datalen) raw_combined(ptr, len, mempool));
     }
 
     static void operator delete(void *ptr) {
@@ -153,20 +147,16 @@ static ceph::spinlock debug_lock;
       free(data);
       bdout << "raw_malloc " << this << " free " << (void *)data << " " << bendl;
     }
-    raw* clone_empty() override {
-      return new raw_malloc(len);
-    }
   };
 
 #ifndef __CYGWIN__
   class buffer::raw_posix_aligned : public buffer::raw {
-    unsigned align;
   public:
     MEMPOOL_CLASS_HELPERS();
 
-    raw_posix_aligned(unsigned l, unsigned _align) : raw(l) {
+    raw_posix_aligned(unsigned l, unsigned align) : raw(l) {
       // posix_memalign() requires a multiple of sizeof(void *)
-      align = std::max<unsigned>(_align, sizeof(void *));
+      align = std::max<unsigned>(align, sizeof(void *));
 #ifdef DARWIN
       data = (char *) valloc(len);
 #else
@@ -183,19 +173,14 @@ static ceph::spinlock debug_lock;
       aligned_free(data);
       bdout << "raw_posix_aligned " << this << " free " << (void *)data << bendl;
     }
-    raw* clone_empty() override {
-      return new raw_posix_aligned(len, align);
-    }
   };
 #endif
 
 #ifdef __CYGWIN__
   class buffer::raw_hack_aligned : public buffer::raw {
-    unsigned align;
     char *realdata;
   public:
-    raw_hack_aligned(unsigned l, unsigned _align) : raw(l) {
-      align = _align;
+    raw_hack_aligned(unsigned l, unsigned align) : raw(l) {
       realdata = new char[len+align-1];
       unsigned off = ((uintptr_t)realdata) & (align-1);
       if (off)
@@ -210,9 +195,6 @@ static ceph::spinlock debug_lock;
     ~raw_hack_aligned() {
       delete[] realdata;
     }
-    raw* clone_empty() {
-      return new raw_hack_aligned(len, align);
-    }
   };
 #endif
 
@@ -237,9 +219,6 @@ static ceph::spinlock debug_lock;
       delete[] data;
       bdout << "raw_char " << this << " free " << (void *)data << bendl;
     }
-    raw* clone_empty() override {
-      return new raw_char(len);
-    }
   };
 
   class buffer::raw_claimed_char : public buffer::raw {
@@ -254,9 +233,6 @@ static ceph::spinlock debug_lock;
       bdout << "raw_claimed_char " << this << " free " << (void *)data
            << bendl;
     }
-    raw* clone_empty() override {
-      return new raw_char(len);
-    }
   };
 
   class buffer::raw_static : public buffer::raw {
@@ -265,9 +241,6 @@ static ceph::spinlock debug_lock;
 
     raw_static(const char *d, unsigned l) : raw((char*)d, l) { }
     ~raw_static() override {}
-    raw* clone_empty() override {
-      return new buffer::raw_char(len);
-    }
   };
 
   class buffer::raw_claim_buffer : public buffer::raw {
@@ -276,9 +249,6 @@ static ceph::spinlock debug_lock;
     raw_claim_buffer(const char *b, unsigned l, deleter d)
         : raw((char*)b, l), del(std::move(d)) { }
     ~raw_claim_buffer() override {}
-    raw* clone_empty() override {
-      return new buffer::raw_char(len);
-    }
   };
 
   ceph::unique_leakable_ptr<buffer::raw> buffer::copy(const char *c, unsigned len) {
index 7d0e98e379a9a8a9939a0a157fd9b9d2a2239bd4..1f85c33f51425baa609de16ca662733730533e6f 100644 (file)
@@ -27,9 +27,6 @@ class raw_seastar_foreign_ptr : public raw {
  public:
   raw_seastar_foreign_ptr(temporary_buffer&& buf)
     : raw(buf.get_write(), buf.size()), ptr(std::move(buf)) {}
-  raw* clone_empty() override {
-    return create(len).release();
-  }
 };
 
 class raw_seastar_local_ptr : public raw {
@@ -37,9 +34,6 @@ class raw_seastar_local_ptr : public raw {
  public:
   raw_seastar_local_ptr(temporary_buffer&& buf)
     : raw(buf.get_write(), buf.size()), buf(std::move(buf)) {}
-  raw* clone_empty() override {
-    return create(len).release();
-  }
 };
 
 inline namespace v15_2_0 {
@@ -93,9 +87,6 @@ class raw_seastar_local_shared_ptr : public raw {
 public:
   raw_seastar_local_shared_ptr(temporary_buffer& buf)
     : raw(buf.get_write(), buf.size()), buf(buf.share()) {}
-  raw* clone_empty() override {
-    return ceph::buffer::create(len).release();
-  }
 };
 }
 
index 890fb04d5b2fd9e04273ec24ea094584ba367690..2298525c9599a3184791a9b83c9c102cbc2a1ea7 100644 (file)
@@ -92,12 +92,6 @@ public:
     unsigned get_len() const {
       return len;
     }
-    virtual raw* clone_empty() = 0;
-    ceph::unique_leakable_ptr<raw> clone() {
-      raw* const c = clone_empty();
-      memcpy(c->data, data, len);
-      return ceph::unique_leakable_ptr<raw>(c);
-    }
     bool get_crc(const std::pair<size_t, size_t> &fromto,
                 std::pair<uint32_t, uint32_t> *crc) const {
       std::lock_guard lg(crc_spinlock);