]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
neorados: Take `claim_append`ed `buffer::list`s by value
authorAdam Emerson <aemerson@redhat.com>
Mon, 14 Aug 2023 23:11:27 +0000 (19:11 -0400)
committerAdam Emerson <aemerson@redhat.com>
Thu, 7 Dec 2023 21:26:52 +0000 (16:26 -0500)
Since both const lvalue and rvalue make sense, instead of duplicating
everything, just take a value and move from it.

Signed-off-by: Adam Emerson <aemerson@redhat.com>
src/include/neorados/RADOS.hpp
src/neorados/RADOS.cc
src/osdc/Objecter.h
src/test/librados_test_stub/NeoradosTestStub.cc

index aaa1fea005cb3b0e3f1fc2760e4d2ccd3c4c2f66..e89c7d02e41af2911e707584d8030936e56d7270 100644 (file)
@@ -336,7 +336,7 @@ public:
   void set_fadvise_dontneed();
   void set_fadvise_nocache();
 
-  void cmpext(uint64_t off, ceph::buffer::list&& cmp_bl,
+  void cmpext(uint64_t off, ceph::buffer::list cmp_bl,
              uint64_t* unmatch = nullptr);
   void cmpxattr(std::string_view name, cmp_op op,
                const ceph::buffer::list& val);
@@ -584,12 +584,12 @@ public:
     return std::move(*this);
   }
 
-  ReadOp& cmpext(uint64_t off, ceph::buffer::list&& cmp_bl,
+  ReadOp& cmpext(uint64_t off, ceph::buffer::list cmp_bl,
                 uint64_t* unmatch = nullptr) & {
     Op::cmpext(off, std::move(cmp_bl), unmatch);
     return *this;
   }
-  ReadOp&& cmpext(uint64_t off, ceph::buffer::list&& cmp_bl,
+  ReadOp&& cmpext(uint64_t off, ceph::buffer::list cmp_bl,
                  uint64_t* unmatch = nullptr) && {
     Op::cmpext(off, std::move(cmp_bl), unmatch);
     return std::move(*this);
@@ -827,22 +827,22 @@ public:
   WriteOp&& create(bool exclusive) && {
     return std::move(create(exclusive));
   }
-  WriteOp& write(uint64_t off, ceph::buffer::list&& bl) &;
-  WriteOp&& write(uint64_t off, ceph::buffer::list&& bl) && {
+  WriteOp& write(uint64_t off, ceph::buffer::list bl) &;
+  WriteOp&& write(uint64_t off, ceph::buffer::list bl) && {
     return std::move(write(off, std::move(bl)));
   }
-  WriteOp& write_full(ceph::buffer::list&& bl) &;
-  WriteOp&& write_full(ceph::buffer::list&& bl) && {
+  WriteOp& write_full(ceph::buffer::list bl) &;
+  WriteOp&& write_full(ceph::buffer::list bl) && {
     return std::move(write_full(std::move(bl)));
   }
   WriteOp& writesame(std::uint64_t off, std::uint64_t write_len,
-                    ceph::buffer::list&& bl) &;
+                    ceph::buffer::list bl) &;
   WriteOp&& writesame(std::uint64_t off, std::uint64_t write_len,
-                     ceph::buffer::list&& bl) && {
+                     ceph::buffer::list bl) && {
     return std::move(writesame(off, write_len, std::move(bl)));
   }
-  WriteOp& append(ceph::buffer::list&& bl) &;
-  WriteOp&& append(ceph::buffer::list&& bl) && {
+  WriteOp& append(ceph::buffer::list bl) &;
+  WriteOp&& append(ceph::buffer::list bl) && {
     return std::move(append(std::move(bl)));
   }
   WriteOp& remove() &;
@@ -862,9 +862,9 @@ public:
     return std::move(rmxattr(name));
   }
   WriteOp& setxattr(std::string_view name,
-                   ceph::buffer::list&& bl) &;
+                   ceph::buffer::list bl) &;
   WriteOp&& setxattr(std::string_view name,
-                    ceph::buffer::list&& bl) && {
+                    ceph::buffer::list bl) && {
     return std::move(setxattr(name, std::move(bl)));
   }
   WriteOp& rollback(uint64_t snapid) &;
@@ -877,8 +877,8 @@ public:
     const boost::container::flat_map<std::string, ceph::buffer::list>& map) && {
     return std::move(set_omap(map));
   }
-  WriteOp& set_omap_header(ceph::buffer::list&& bl) &;
-  WriteOp&& set_omap_header(ceph::buffer::list&& bl) && {
+  WriteOp& set_omap_header(ceph::buffer::list bl) &;
+  WriteOp&& set_omap_header(ceph::buffer::list bl) && {
     return std::move(set_omap_header(std::move(bl)));
   }
   WriteOp& clear_omap() &;
@@ -964,12 +964,12 @@ public:
     return std::move(*this);
   }
 
-  WriteOp& cmpext(uint64_t off, ceph::buffer::list&& cmp_bl,
+  WriteOp& cmpext(uint64_t off, ceph::buffer::list cmp_bl,
                  uint64_t* unmatch = nullptr) & {
     Op::cmpext(off, std::move(cmp_bl), unmatch);
     return *this;
   }
-  WriteOp&& cmpext(uint64_t off, ceph::buffer::list&& cmp_bl,
+  WriteOp&& cmpext(uint64_t off, ceph::buffer::list cmp_bl,
                   uint64_t* unmatch = nullptr) && {
     Op::cmpext(off, std::move(cmp_bl), unmatch);
     return std::move(*this);
index b04aa6c2b9be947db2716ac6bd928d5bcb6454f0..91c55ba5f8495ecca5c7196a22a4b1e15d431a94 100644 (file)
@@ -420,7 +420,7 @@ void Op::set_fadvise_nocache() {
     CEPH_OSD_OP_FLAG_FADVISE_NOCACHE);
 }
 
-void Op::cmpext(uint64_t off, bufferlist&& cmp_bl, uint64_t* unmatch) {
+void Op::cmpext(uint64_t off, bufferlist cmp_bl, uint64_t* unmatch) {
   reinterpret_cast<OpImpl*>(&impl)->op.cmpext(off, std::move(cmp_bl), nullptr,
                                              unmatch);
 }
@@ -676,23 +676,23 @@ WriteOp& WriteOp::create(bool exclusive) & {
   return *this;
 }
 
-WriteOp& WriteOp::write(uint64_t off, bufferlist&& bl) & {
-  reinterpret_cast<OpImpl*>(&impl)->op.write(off, bl);
+WriteOp& WriteOp::write(uint64_t off, bufferlist bl) & {
+  reinterpret_cast<OpImpl*>(&impl)->op.write(off, std::move(bl));
   return *this;
 }
 
-WriteOp& WriteOp::write_full(bufferlist&& bl) & {
-  reinterpret_cast<OpImpl*>(&impl)->op.write_full(bl);
+WriteOp& WriteOp::write_full(bufferlist bl) & {
+  reinterpret_cast<OpImpl*>(&impl)->op.write_full(std::move(bl));
   return *this;
 }
 
-WriteOp& WriteOp::writesame(uint64_t off, uint64_t write_len, bufferlist&& bl) & {
-  reinterpret_cast<OpImpl*>(&impl)->op.writesame(off, write_len, bl);
+WriteOp& WriteOp::writesame(uint64_t off, uint64_t write_len, bufferlist bl) & {
+  reinterpret_cast<OpImpl*>(&impl)->op.writesame(off, write_len, std::move(bl));
   return *this;
 }
 
-WriteOp& WriteOp::append(bufferlist&& bl) & {
-  reinterpret_cast<OpImpl*>(&impl)->op.append(bl);
+WriteOp& WriteOp::append(bufferlist bl) & {
+  reinterpret_cast<OpImpl*>(&impl)->op.append(std::move(bl));
   return *this;
 }
 
@@ -717,8 +717,8 @@ WriteOp& WriteOp::rmxattr(std::string_view name) & {
 }
 
 WriteOp& WriteOp::setxattr(std::string_view name,
-                          bufferlist&& bl) & {
-  reinterpret_cast<OpImpl*>(&impl)->op.setxattr(name, bl);
+                          bufferlist bl) & {
+  reinterpret_cast<OpImpl*>(&impl)->op.setxattr(name, std::move(bl));
   return *this;
 }
 
@@ -733,8 +733,8 @@ WriteOp& WriteOp::set_omap(
   return *this;
 }
 
-WriteOp& WriteOp::set_omap_header(bufferlist&& bl) & {
-  reinterpret_cast<OpImpl*>(&impl)->op.omap_set_header(bl);
+WriteOp& WriteOp::set_omap_header(bufferlist bl) & {
+  reinterpret_cast<OpImpl*>(&impl)->op.omap_set_header(std::move(bl));
   return *this;
 }
 
index 2fd8bf5fb46b947b3ab9ab8f860f840aff59fc3f..c54d87bace435bd2dd5eeff7902ea88538c11b9e 100644 (file)
@@ -579,15 +579,27 @@ struct ObjectOperation {
   void write(uint64_t off, ceph::buffer::list& bl) {
     write(off, bl, 0, 0);
   }
+  void write(uint64_t off, ceph::buffer::list&& bl) {
+    write(off, bl, 0, 0);
+  }
   void write_full(ceph::buffer::list& bl) {
     add_data(CEPH_OSD_OP_WRITEFULL, 0, bl.length(), bl);
   }
+  void write_full(ceph::buffer::list&& bl) {
+    add_data(CEPH_OSD_OP_WRITEFULL, 0, bl.length(), bl);
+  }
   void writesame(uint64_t off, uint64_t write_len, ceph::buffer::list& bl) {
     add_writesame(CEPH_OSD_OP_WRITESAME, off, write_len, bl);
   }
+  void writesame(uint64_t off, uint64_t write_len, ceph::buffer::list&& bl) {
+    add_writesame(CEPH_OSD_OP_WRITESAME, off, write_len, bl);
+  }
   void append(ceph::buffer::list& bl) {
     add_data(CEPH_OSD_OP_APPEND, 0, bl.length(), bl);
   }
+  void append(ceph::buffer::list&& bl) {
+    add_data(CEPH_OSD_OP_APPEND, 0, bl.length(), bl);
+  }
   void zero(uint64_t off, uint64_t len) {
     ceph::buffer::list bl;
     add_data(CEPH_OSD_OP_ZERO, off, len, bl);
@@ -1357,7 +1369,11 @@ struct ObjectOperation {
     add_data(CEPH_OSD_OP_OMAPSETVALS, 0, bl.length(), bl);
   }
 
-  void omap_set_header(ceph::buffer::list &bl) {
+  void omap_set_header(ceph::buffer::list& bl) {
+    add_data(CEPH_OSD_OP_OMAPSETHEADER, 0, bl.length(), bl);
+  }
+
+  void omap_set_header(ceph::buffer::list&& bl) {
     add_data(CEPH_OSD_OP_OMAPSETHEADER, 0, bl.length(), bl);
   }
 
index 1eb0d627ebeea5b5497eb8974db391cfbb762fb2..a1b61f2459b3a8a24a67209408628c9f0bb014f4 100644 (file)
@@ -331,7 +331,7 @@ void Op::assert_version(uint64_t ver) {
           &librados::TestIoCtxImpl::assert_version, _1, _2, ver));
 }
 
-void Op::cmpext(uint64_t off, ceph::buffer::list&& cmp_bl, uint64_t* s) {
+void Op::cmpext(uint64_t off, ceph::buffer::list cmp_bl, uint64_t* s) {
   auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
   librados::ObjectOperationTestImpl op = std::bind(
     &librados::TestIoCtxImpl::cmpext, _1, _2, off, cmp_bl, _4);
@@ -504,14 +504,14 @@ WriteOp& WriteOp::create(bool exclusive) & {
   return *this;
 }
 
-WriteOp& WriteOp::write(uint64_t off, ceph::buffer::list&& bl) & {
+WriteOp& WriteOp::write(uint64_t off, ceph::buffer::list bl) & {
   auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
   o->ops.push_back(std::bind(
     &librados::TestIoCtxImpl::write, _1, _2, bl, bl.length(), off, _5));
   return *this;
 }
 
-WriteOp& WriteOp::write_full(ceph::buffer::list&& bl) & {
+WriteOp& WriteOp::write_full(ceph::buffer::list bl) & {
   auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
   o->ops.push_back(std::bind(
     &librados::TestIoCtxImpl::write_full, _1, _2, bl, _5));
@@ -540,7 +540,7 @@ WriteOp& WriteOp::zero(uint64_t off, uint64_t len) & {
 }
 
 WriteOp& WriteOp::writesame(std::uint64_t off, std::uint64_t write_len,
-                           ceph::buffer::list&& bl) & {
+                           ceph::buffer::list bl) & {
   auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
   o->ops.push_back(std::bind(
     &librados::TestIoCtxImpl::writesame, _1, _2, bl, write_len, off, _5));