]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common/bl, *: deprecate list::claim() in favor of operator=(list&&).
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 23 Jun 2020 10:28:15 +0000 (10:28 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 29 Jun 2020 11:29:54 +0000 (13:29 +0200)
The motivation is that `claim(list&)` seems to actually be a pre-C++11
counterpart of the already available `operator=(list&&)`.
This commit deprecates the `claim()` method but doesn't drop it yet.

All occurrences of `buffer::list::claim(list&)` are switched to
  * `list::operator=(list&&)` or
  * reworked to use `list::list(list&&)` instead.

Changes are applied to: rgw, osdc, osd, os/memstore, os/filestore,
os/bluestore, os, msg, mgr, messages, mds, librbd, librados, crimson,
common, cls, mon.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
46 files changed:
src/ceph_mon.cc
src/cls/rgw/cls_rgw.cc
src/common/admin_socket.cc
src/common/buffer.cc
src/crimson/os/cyanstore/cyan_object.cc
src/crimson/osd/objclass.cc
src/crimson/osd/replicated_recovery_backend.cc
src/include/buffer.h
src/librados/IoCtxImpl.cc
src/librbd/image_watcher/NotifyLockOwner.cc
src/mds/CDir.cc
src/mds/MDCache.cc
src/mds/Migrator.cc
src/mds/Mutation.h
src/mds/mdstypes.h
src/messages/MClientReply.h
src/messages/MLock.h
src/messages/MMDSResolve.h
src/messages/MMonMap.h
src/messages/MOSDOp.h
src/messages/MOSDOpReply.h
src/messages/MPoolOpReply.h
src/mgr/MgrClient.cc
src/msg/Message.h
src/os/FuseStore.cc
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/os/filestore/FileJournal.cc
src/os/filestore/FileJournal.h
src/os/memstore/MemStore.cc
src/osd/ECBackend.cc
src/osd/ExtentCache.h
src/osd/OSD.cc
src/osd/PGLog.cc
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h
src/osd/ReplicatedBackend.cc
src/osd/objclass.cc
src/osd/osd_types.h
src/osdc/Objecter.cc
src/rgw/rgw_compression.cc
src/rgw/rgw_file.cc
src/rgw/rgw_file.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rest_client.cc
src/test/bufferlist.cc

index 5e35b61e7e9153f82a392f0223cafa2da8742469..3bd219f11074aaab634bbd7fa4fccab0091ccbe1 100644 (file)
@@ -101,7 +101,7 @@ int obtain_monmap(MonitorDBStore &store, bufferlist &bl)
        if (b.get_epoch() > latest_ver) {
          dout(10) << __func__ << " using stashed monmap " << b.get_epoch()
                   << " instead" << dendl;
-         bl.claim(bl2);
+         bl = std::move(bl2);
        } else {
          dout(10) << __func__ << " ignoring stashed monmap " << b.get_epoch()
                   << dendl;
index f09bf8d0cf9b01f2a5565d128a3b04d9ffbbf44d..b05849763e31dbd496bb1dec8d9e5037e2c8ea7d 100644 (file)
@@ -2543,7 +2543,7 @@ static int list_instance_entries(cls_method_context_t hctx,
     }
   }
   if (found_first) {
-    keys[start_after_key].claim(k);
+    keys[start_after_key] = std::move(k);
   }
 
   for (auto iter = keys.begin(); iter != keys.end(); ++iter) {
@@ -2634,7 +2634,7 @@ static int list_olh_entries(cls_method_context_t hctx,
   }
 
   if (found_first) {
-    keys[start_after_key].claim(k);
+    keys[start_after_key] = std::move(k);
   }
 
   for (auto iter = keys.begin(); iter != keys.end(); ++iter) {
index f7c042e5d14f2cdc4c603daeed088b4e41ec4039..8a2256f44b5c1590c723163b93c31839247b57fe 100644 (file)
@@ -465,7 +465,7 @@ int AdminSocket::execute_command(
     inbl,
     [&errss, outbl, &fin](int r, const std::string& err, bufferlist& out) {
       errss << err;
-      outbl->claim(out);
+      *outbl = std::move(out);
       fin.finish(r);
     });
   {
index 331ad890e555297357ab116ca554300d205de9c3..496c735d80ab55316dd6b23928b745f782d04f0f 100644 (file)
@@ -1272,14 +1272,6 @@ static ceph::spinlock debug_lock;
     }
   }
 
-  // sort-of-like-assignment-op
-  void buffer::list::claim(list& bl)
-  {
-    // free my buffers
-    clear();
-    claim_append(bl);
-  }
-
   void buffer::list::claim_append(list& bl)
   {
     // steal the other guy's buffers
index 4692e695cadf26978fc441f25250712982d8bef9..34bc13b7f39dd25e2af0c85ba88d56561879f41e 100644 (file)
@@ -37,7 +37,7 @@ int Object::write(uint64_t offset, const bufferlist &src)
     newdata.append(tail);
   }
 
-  data.claim(newdata);
+  data = std::move(newdata);
   return 0;
 }
 
@@ -59,7 +59,7 @@ int Object::truncate(uint64_t size)
   if (get_size() > size) {
     bufferlist bl;
     bl.substr_of(data, 0, size);
-    data.claim(bl);
+    data = std::move(bl);
   } else if (get_size() == size) {
     // do nothing
   } else {
index 013ef35743bdef1a80882c78c0239ce7fc050660..c59b8b03d9e58eb12aeb21d0916dc18fd15634fb 100644 (file)
@@ -138,7 +138,7 @@ int cls_cxx_read2(cls_method_context_t hctx,
   if (const auto ret = execute_osd_op(hctx, op); ret < 0) {
     return ret;
   }
-  outbl->claim(op.outdata);
+  *outbl = std::move(op.outdata);
   return outbl->length();
 }
 
@@ -209,7 +209,7 @@ int cls_cxx_getxattr(cls_method_context_t hctx,
   if (const auto ret = execute_osd_op(hctx, op); ret < 0) {
     return ret;
   }
-  outbl->claim(op.outdata);
+  *outbl = std::move(op.outdata);
   return outbl->length();
 }
 
index 30df1da992818f706e6daa0c6696191cc9554a6d..3bf287813ca7ad6c2d6ed6cc7b1a41052dcb3a03 100644 (file)
@@ -645,11 +645,12 @@ seastar::future<bool> ReplicatedRecoveryBackend::_handle_pull_response(
                            [this, &pop, &pi, first, t, response]
                            (auto& data_zeros, auto& data,
                             auto& usable_intervals) {
-      data = pop.data;
-      ceph::bufferlist usable_data;
-      trim_pushed_data(pi.recovery_info.copy_subset, pop.data_included, data,
-         &usable_intervals, &usable_data);
-      data.claim(usable_data);
+      {
+        ceph::bufferlist usable_data;
+        trim_pushed_data(pi.recovery_info.copy_subset, pop.data_included, pop.data,
+           &usable_intervals, &usable_data);
+        data = std::move(usable_data);
+      }
       pi.recovery_progress = pop.after_progress;
       logger().debug("new recovery_info {}, new progress {}",
          pi.recovery_info, pi.recovery_progress);
index 91caab2accb29934a7c4282e2a7141ce0d945773..d0bd279898f7bab04d0cd3980ee9d2c7a0fb9aa5 100644 (file)
@@ -1064,7 +1064,9 @@ struct error_code;
 
     void reserve(size_t prealloc);
 
-    void claim(list& bl);
+    [[deprecated("in favor of operator=(list&&)")]] void claim(list& bl) {
+      *this = std::move(bl);
+    }
     void claim_append(list& bl);
     // only for bl is bufferlist::page_aligned_appender
     void claim_append_piecewise(list& bl);
index f384c49766fc5d6409ff470c969c62f6cfc3e0ad..5c485f4efafff62a5c7aacae45babcebcca08d17 100644 (file)
@@ -75,7 +75,7 @@ struct CB_notify_Finish {
     if (preply_buf_len)
       *preply_buf_len = reply_bl.length();
     if (preply_bl)
-      preply_bl->claim(reply_bl);
+      *preply_bl = std::move(reply_bl);
 
     ctx->complete(ceph::from_error_code(ec));
   }
index 1d34106f9d937538c148738751ee006aec0edc03..e37fb597e7e3aac3b467d54223d6cd119e626910 100644 (file)
@@ -62,7 +62,7 @@ void NotifyLockOwner::handle_notify(int r) {
         return;
       }
       lock_owner_responded = true;
-      response.claim(it.second);
+      response = std::move(it.second);
     }
   }
 
index 627b7a313ab3fcdde6b756f01b0cac7bb0f5c48c..5d4b458664b48b78dbbc0f9a77ed1a3d715a9866 100644 (file)
@@ -1675,7 +1675,7 @@ void CDir::_omap_fetch_more(
   object_t oid = get_ondisk_object();
   object_locator_t oloc(cache->mds->mdsmap->get_metadata_pool());
   C_IO_Dir_OMAP_FetchedMore *fin = new C_IO_Dir_OMAP_FetchedMore(this, c);
-  fin->hdrbl.claim(hdrbl);
+  fin->hdrbl = std::move(hdrbl);
   fin->omap.swap(omap);
   ObjectOperation rd;
   rd.omap_get_vals(fin->omap.rbegin()->first,
index 366569eca26362ad16424ddfe903ac6da75ad109..9f93a864b4c63820e27cafd6cb9b008ff7e0fe69 100644 (file)
@@ -9674,7 +9674,7 @@ void MDCache::request_drop_foreign_locks(MDRequestRef& mdr)
     } else if (mdr->more()->srcdn_auth_mds == *p &&
               mdr->more()->inode_import.length() > 0) {
       // information about rename imported caps
-      r->inode_export.claim(mdr->more()->inode_import);
+      r->inode_export = std::move(mdr->more()->inode_import);
     }
 
     mds->send_message_mds(r, *p);
index 874e56416aa68a85fb81082fcbe2808b3fbc5a93..ad99cf806b8c893ef20379004fd42665d6290f4e 100644 (file)
@@ -1303,7 +1303,7 @@ void Migrator::encode_export_prep_trace(bufferlist &final_bl, CDir *bound,
     cache->encode_replica_inode(cur->inode, es.peer, bl, mds->mdsmap->get_up_features());
     dout(7) << "  added " << *cur->inode << dendl;
     bl.claim_append(tracebl);
-    tracebl.claim(bl);
+    tracebl = std::move(bl);
 
     cur = cur->get_parent_dir();
     // don't repeat dirfrags
@@ -1317,7 +1317,7 @@ void Migrator::encode_export_prep_trace(bufferlist &final_bl, CDir *bound,
     cache->encode_replica_dir(cur, es.peer, bl);
     dout(7) << "  added " << *cur << dendl;
     bl.claim_append(tracebl);
-    tracebl.claim(bl);
+    tracebl = std::move(bl);
     start = 'f';  // start with dirfrag
   }
   dirfrag_t df = cur->dirfrag();
index 5ab68fd62b219478869e9f3496c8b693e9c4a265..afbdf4f26503817014d885e86b685d45839e2d73 100644 (file)
@@ -451,7 +451,7 @@ private:
 struct MDSlaveUpdate {
   MDSlaveUpdate(int oo, ceph::buffer::list &rbl) :
     origop(oo) {
-    rollback.claim(rbl);
+    rollback = std::move(rbl);
   }
   ~MDSlaveUpdate() {
     if (waiter)
index 9ced1b641522a9b684adfc729624e23691e279e2..38b780f4575f73c2bc5b1f6d02bc29e521944d51 100644 (file)
@@ -1475,7 +1475,7 @@ struct cap_reconnect_t {
     capinfo.pathbase = pino;
     capinfo.flock_len = 0;
     snap_follows = sf;
-    flockbl.claim(lb);
+    flockbl = std::move(lb);
   }
   void encode(ceph::buffer::list& bl) const;
   void decode(ceph::buffer::list::const_iterator& bl);
index ccf2b6ac340b40a895f943b26185a938c1ce3c81..72d53eff3ae0d1d88c554f95173c0339325a15c8 100644 (file)
@@ -357,7 +357,7 @@ public:
 
   // dir contents
   void set_extra_bl(ceph::buffer::list& bl) {
-    extra_bl.claim(bl);
+    extra_bl = std::move(bl);
   }
   ceph::buffer::list& get_extra_bl() {
     return extra_bl;
@@ -368,7 +368,7 @@ public:
 
   // trace
   void set_trace(ceph::buffer::list& bl) {
-    trace_bl.claim(bl);
+    trace_bl = std::move(bl);
   }
   ceph::buffer::list& get_trace_bl() {
     return trace_bl;
index e1ac38ba951c38cb83e9f3154c87f55f207f9095..4471ab220378259314c03570452359057387dc2c 100644 (file)
@@ -61,7 +61,7 @@ protected:
     SafeMessage{MSG_MDS_LOCK, HEAD_VERSION, COMPAT_VERSION},
     action(ac), asker(as), lock_type(lock->get_type()) {
     lock->get_parent()->set_object_info(object_info);
-    lockdata.claim(bl);
+    lockdata = std::move(bl);
   }
   ~MLock() override {}
   
index c303b241a7a9f369814632724ac5b9d356378fa4..29a5988356887a64aab45ac001f3b2c4acbd1cca 100644 (file)
@@ -125,7 +125,7 @@ public:
   }
 
   void add_slave_request(metareqid_t reqid, ceph::buffer::list& bl) {
-    slave_requests[reqid].inode_caps.claim(bl);
+    slave_requests[reqid].inode_caps = std::move(bl);
   }
 
   void add_table_commits(int table, const std::set<version_t>& pending_commits) {
index e06eabc2500ba22f54ed1ff4cd99cda1eaa89f47..111060b88b905be26a8b3cdaeafd4e8a093b33cf 100644 (file)
@@ -27,7 +27,7 @@ public:
 
   MMonMap() : Message{CEPH_MSG_MON_MAP} { }
   explicit MMonMap(ceph::buffer::list &bl) : Message{CEPH_MSG_MON_MAP} {
-    monmapbl.claim(bl);
+    monmapbl = std::move(bl);
   }
 private:
   ~MMonMap() override {}
index 5301f0a43b255703910ab7743cee16629891011c..8d3761a1e0f2cd347ba9aff98d6aaeabd7846f8e 100644 (file)
@@ -211,12 +211,12 @@ public:
   }
   void write(uint64_t off, uint64_t len, ceph::buffer::list& bl) {
     add_simple_op(CEPH_OSD_OP_WRITE, off, len);
-    data.claim(bl);
+    data = std::move(bl);
     header.data_off = off;
   }
   void writefull(ceph::buffer::list& bl) {
     add_simple_op(CEPH_OSD_OP_WRITEFULL, 0, bl.length());
-    data.claim(bl);
+    data = std::move(bl);
     header.data_off = 0;
   }
   void zero(uint64_t off, uint64_t len) {
index 3824e30c3076cafaa3996b42758bf7dec4e92aca..ebe32006aa067c6e9d8c965540731590d33119bb 100644 (file)
@@ -99,7 +99,7 @@ public:
   void claim_op_out_data(std::vector<OSDOp>& o) {
     ceph_assert(ops.size() == o.size());
     for (unsigned i = 0; i < o.size(); i++) {
-      ops[i].outdata.claim(o[i].outdata);
+      ops[i].outdata = std::move(o[i].outdata);
     }
   }
   void claim_ops(std::vector<OSDOp>& o) {
index df06525db78165db3107ed37e560538eb85db482..59ec764af585662db7a0c8d19e293b87dfa8a80c 100644 (file)
@@ -41,7 +41,7 @@ public:
     epoch(e) {
     set_tid(t);
     if (blp)
-      response_data.claim(*blp);
+      response_data = std::move(*blp);
   }
 
   std::string_view get_type_name() const override { return "poolopreply"; }
index 2f998635c3f1bec4cebb4d947a6bac067a1b57c4..c63d54f2fee81ae4181f8693ace56aa715e4ac6d 100644 (file)
@@ -552,7 +552,7 @@ bool MgrClient::handle_command_reply(
 
   auto &op = command_table.get_command(tid);
   if (op.outbl) {
-    op.outbl->claim(data);
+    *op.outbl = std::move(data);
   }
 
   if (op.outs) {
index 5b7e6eabd85c231cf669596a32b6f31453876790..5f73023f95a675a12c38c31497d8534e6a577fdd 100644 (file)
@@ -398,7 +398,7 @@ public:
   void set_payload(ceph::buffer::list& bl) {
     if (byte_throttler)
       byte_throttler->put(payload.length());
-    payload.claim(bl);
+    payload = std::move(bl);
     if (byte_throttler)
       byte_throttler->take(payload.length());
   }
@@ -406,7 +406,7 @@ public:
   void set_middle(ceph::buffer::list& bl) {
     if (byte_throttler)
       byte_throttler->put(middle.length());
-    middle.claim(bl);
+    middle = std::move(bl);
     if (byte_throttler)
       byte_throttler->take(middle.length());
   }
@@ -425,7 +425,7 @@ public:
   void claim_data(ceph::buffer::list& bl) {
     if (byte_throttler)
       byte_throttler->put(data.length());
-    bl.claim(data);
+    bl = std::move(data);
   }
   off_t get_data_len() const { return data.length(); }
 
index 8845d9f08063e64f1586ea45819f63932d514b36..e06131ce33ce57b2d6fc91985dc0778748b8d3f8 100644 (file)
@@ -62,7 +62,7 @@ int FuseStore::open_file(string p, struct fuse_file_info *fi,
   }
   OpenFile *o = new OpenFile;
   o->path = p;
-  o->bl.claim(bl);
+  o->bl = std::move(bl);
   open_files[p] = o;
   fi->fh = reinterpret_cast<uint64_t>(o);
   ++o->ref;
@@ -730,7 +730,7 @@ static int os_open(const char *path, struct fuse_file_info *fi)
 
   if (pbl) {
     FuseStore::OpenFile *o = new FuseStore::OpenFile;
-    o->bl.claim(*pbl);
+    o->bl = std::move(*pbl);
     fi->fh = reinterpret_cast<uint64_t>(o);
   }
   return 0;
@@ -877,7 +877,7 @@ static int os_create(const char *path, mode_t mode, struct fuse_file_info *fi)
 
   if (pbl) {
     FuseStore::OpenFile *o = new FuseStore::OpenFile;
-    o->bl.claim(*pbl);
+    o->bl = std::move(*pbl);
     o->dirty = true;
     fi->fh = reinterpret_cast<uint64_t>(o);
   }
index ddb730f7efa0d52a8d0e216f29c6f9f4cc382615..3b4ec8bb87985f82ff00fabd2a9a8bbbbe649ff5 100644 (file)
@@ -9662,7 +9662,7 @@ void BlueStore::_read_cache(
       if (pc != cache_res.end() &&
           pc->first == b_off) {
         l = pc->second.length();
-        ready_regions[pos].claim(pc->second);
+        ready_regions[pos] = std::move(pc->second);
         dout(30) << __func__ << "    use cache 0x" << std::hex << pos << ": 0x"
                  << b_off << "~" << l << std::dec << dendl;
         ++pc;
@@ -13257,7 +13257,7 @@ void BlueStore::_do_write_small(
                return 0;
              });
            ceph_assert(r == 0);
-           op->data.claim(bl);
+           op->data = std::move(bl);
            dout(20) << __func__ << "  deferred write 0x" << std::hex << b_off << "~"
                     << b_len << std::dec << " of mutable " << *b
                     << " at " << op->extents << dendl;
@@ -13513,7 +13513,7 @@ void BlueStore::_do_write_big_apply_deferred(
     bluestore_deferred_op_t* op = _get_deferred_op(txc);
     op->op = bluestore_deferred_op_t::OP_WRITE;
     op->extents.swap(dctx.res_extents);
-    op->data.claim(bl);
+    op->data = std::move(bl);
   }
 }
 
index 759b6b6126d3db83e9b89034a2129656e42646b0..4635e9b1f9388df5fc501b9daca2a595cf631879 100644 (file)
@@ -245,7 +245,7 @@ public:
       if (data.length()) {
        ceph::buffer::list t;
        t.substr_of(data, 0, newlen);
-       data.claim(t);
+       data = std::move(t);
       }
       length = newlen;
     }
index 198dbc83c294f474ad6313aaa60bb2a86323758c..05894fa99926927ec90b3a2747be7bb4cb0470d4 100644 (file)
@@ -1602,7 +1602,7 @@ int FileJournal::prepare_entry(vector<ObjectStore::Transaction>& tls, bufferlist
   ebl.append((const char*)&h, sizeof(h));
   if (directio)
     ebl.rebuild_aligned(CEPH_DIRECTIO_ALIGNMENT);
-  tbl->claim(ebl);
+  *tbl = std::move(ebl);
   return h.len;
 }
 
index 86492572d9ad0d29d85a7aaf60aab5b083747b37..53b18c12587745242671718174f456242e13a3bb 100644 (file)
@@ -64,7 +64,7 @@ public:
     ZTracer::Trace trace;
     write_item(uint64_t s, ceph::buffer::list& b, int ol, TrackedOpRef opref) :
       seq(s), orig_len(ol), tracked_op(opref) {
-      bl.claim(b);
+      bl = std::move(b);
     }
     write_item() : seq(0), orig_len(0) {}
   };
@@ -265,7 +265,7 @@ private:
 
     aio_info(ceph::buffer::list& b, uint64_t o, uint64_t s)
       : iov(NULL), done(false), off(o), len(b.length()), seq(s) {
-      bl.claim(b);
+      bl = std::move(b);
     }
     ~aio_info() {
       delete[] iov;
index 69cef7e96ebc7374f76c9c2ee5a80d90d582bc46..dc29ab1b6fde88f6458c97003fc8cf73d60f93a6 100644 (file)
@@ -1517,7 +1517,7 @@ int BufferlistObject::write(uint64_t offset, const ceph::buffer::list &src)
     newdata.append(tail);
   }
 
-  data.claim(newdata);
+  data = std::move(newdata);
   return 0;
 }
 
@@ -1546,7 +1546,7 @@ int BufferlistObject::truncate(uint64_t size)
   if (get_size() > size) {
     ceph::buffer::list bl;
     bl.substr_of(data, 0, size);
-    data.claim(bl);
+    data = std::move(bl);
   } else if (get_size() == size) {
     // do nothing
   } else {
index 6c33e6c405248aadecdbc29a6c3f85bf066faaf0..3e6e9587a8565bf6029eb4b5a5e45979d7303120 100644 (file)
@@ -455,7 +455,7 @@ void ECBackend::handle_recovery_read_complete(
   for(map<pg_shard_t, bufferlist>::iterator i = to_read.get<2>().begin();
       i != to_read.get<2>().end();
       ++i) {
-    from[i->first.shard].claim(i->second);
+    from[i->first.shard] = std::move(i->second);
   }
   dout(10) << __func__ << ": " << from << dendl;
   int r;
@@ -1214,7 +1214,7 @@ void ECBackend::handle_sub_read_reply(
        sinfo.aligned_offset_len_to_chunk(
          make_pair(req_iter->get<0>(), req_iter->get<1>()));
       ceph_assert(adjusted.first == j->first);
-      riter->get<2>()[from].claim(j->second);
+      riter->get<2>()[from] = std::move(j->second);
     }
   }
   for (auto i = op.attrs_read.begin();
@@ -2334,7 +2334,7 @@ struct CallClientContexts :
             res.returned.front().get<2>().begin();
           j != res.returned.front().get<2>().end();
           ++j) {
-       to_decode[j->first.shard].claim(j->second);
+       to_decode[j->first.shard] = std::move(j->second);
       }
       int r = ECUtil::decode(
        ec->sinfo,
index 9d387879216cb3b82acfaae2c069d77b7c5b40fa..972228cd077e20a022bc71289e03e47988e2bbbb 100644 (file)
@@ -108,8 +108,7 @@ struct bl_split_merge {
     return true;
   }
   ceph::buffer::list merge(ceph::buffer::list &&left, ceph::buffer::list &&right) const {
-    ceph::buffer::list bl;
-    bl.claim(left);
+    ceph::buffer::list bl{std::move(left)};
     bl.claim_append(right);
     return bl;
   }
index b5a2b7fbed5f22cf91bbc2f603001aa573be2518..c7bd62365fbcde9c02ddef397cef49dd46f45b5f 100644 (file)
@@ -1429,19 +1429,19 @@ MOSDMap *OSDService::build_incremental_map_msg(epoch_t since, epoch_t to,
     }
     max--;
     max_bytes -= bl.length();
-    m->maps[since].claim(bl);
+    m->maps[since] = std::move(bl);
   }
   for (epoch_t e = since + 1; e <= to; ++e) {
     bufferlist bl;
     if (get_inc_map_bl(e, bl)) {
-      m->incremental_maps[e].claim(bl);
+      m->incremental_maps[e] = std::move(bl);
     } else {
       dout(10) << __func__ << " missing incremental map " << e << dendl;
       if (!get_map_bl(e, bl)) {
        derr << __func__ << " also missing full map " << e << dendl;
        goto panic;
       }
-      m->maps[e].claim(bl);
+      m->maps[e] = std::move(bl);
     }
     max--;
     max_bytes -= bl.length();
@@ -1460,7 +1460,7 @@ MOSDMap *OSDService::build_incremental_map_msg(epoch_t since, epoch_t to,
   // send something
   bufferlist bl;
   if (get_inc_map_bl(m->newest_map, bl)) {
-    m->incremental_maps[m->newest_map].claim(bl);
+    m->incremental_maps[m->newest_map] = std::move(bl);
   } else {
     derr << __func__ << " unable to load latest map " << m->newest_map << dendl;
     if (!get_map_bl(m->newest_map, bl)) {
@@ -1468,7 +1468,7 @@ MOSDMap *OSDService::build_incremental_map_msg(epoch_t since, epoch_t to,
           << dendl;
       ceph_abort();
     }
-    m->maps[m->newest_map].claim(bl);
+    m->maps[m->newest_map] = std::move(bl);
   }
   return m;
 }
index d4539192cc836a8b6f1ada65971f4d54cef0f4e6..0a01b8478a8f5185b1987a4c341c7965197db87e 100644 (file)
@@ -732,7 +732,7 @@ void PGLog::_write_log_and_missing_wo_missing(
        ++p) {
     bufferlist bl(sizeof(*p) * 2);
     p->encode_with_checksum(bl);
-    (*km)[p->get_key_name()].claim(bl);
+    (*km)[p->get_key_name()] = std::move(bl);
   }
 
   for (auto p = log.log.rbegin();
@@ -742,7 +742,7 @@ void PGLog::_write_log_and_missing_wo_missing(
        ++p) {
     bufferlist bl(sizeof(*p) * 2);
     p->encode_with_checksum(bl);
-    (*km)[p->get_key_name()].claim(bl);
+    (*km)[p->get_key_name()] = std::move(bl);
   }
 
   if (log_keys_debug) {
@@ -779,7 +779,7 @@ void PGLog::_write_log_and_missing_wo_missing(
       break;
     bufferlist bl;
     encode(entry, bl);
-    (*km)[entry.get_key_name()].claim(bl);
+    (*km)[entry.get_key_name()] = std::move(bl);
   }
 
   for (auto p = log.dups.rbegin();
@@ -789,7 +789,7 @@ void PGLog::_write_log_and_missing_wo_missing(
        ++p) {
     bufferlist bl;
     encode(*p, bl);
-    (*km)[p->get_key_name()].claim(bl);
+    (*km)[p->get_key_name()] = std::move(bl);
   }
 
   if (dirty_divergent_priors) {
@@ -861,7 +861,7 @@ void PGLog::_write_log_and_missing(
        ++p) {
     bufferlist bl(sizeof(*p) * 2);
     p->encode_with_checksum(bl);
-    (*km)[p->get_key_name()].claim(bl);
+    (*km)[p->get_key_name()] = std::move(bl);
   }
 
   for (auto p = log.log.rbegin();
@@ -871,7 +871,7 @@ void PGLog::_write_log_and_missing(
        ++p) {
     bufferlist bl(sizeof(*p) * 2);
     p->encode_with_checksum(bl);
-    (*km)[p->get_key_name()].claim(bl);
+    (*km)[p->get_key_name()] = std::move(bl);
   }
 
   if (log_keys_debug) {
@@ -908,7 +908,7 @@ void PGLog::_write_log_and_missing(
       break;
     bufferlist bl;
     encode(entry, bl);
-    (*km)[entry.get_key_name()].claim(bl);
+    (*km)[entry.get_key_name()] = std::move(bl);
   }
 
   for (auto p = log.dups.rbegin();
@@ -918,7 +918,7 @@ void PGLog::_write_log_and_missing(
        ++p) {
     bufferlist bl;
     encode(*p, bl);
-    (*km)[p->get_key_name()].claim(bl);
+    (*km)[p->get_key_name()] = std::move(bl);
   }
 
   if (clear_divergent_priors) {
index 9738568bad576860225637f656d36480a4830889..ce2227cf46acf8a57388c3c6e99aec1c22b68ea2 100644 (file)
@@ -4584,12 +4584,12 @@ int PrimaryLogPG::trim_object(
     map <string, bufferlist> attrs;
     bl.clear();
     encode(snapset, bl);
-    attrs[SS_ATTR].claim(bl);
+    attrs[SS_ATTR] = std::move(bl);
 
     bl.clear();
     encode(head_obc->obs.oi, bl,
             get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr));
-    attrs[OI_ATTR].claim(bl);
+    attrs[OI_ATTR] = std::move(bl);
     t->setattrs(head_oid, attrs);
   }
 
@@ -4744,10 +4744,10 @@ int PrimaryLogPG::do_tmap2omap(OpContext *ctx, unsigned flags)
   ops[0].op.extent.length = 0;
 
   ops[1].op.op = CEPH_OSD_OP_OMAPSETHEADER;
-  ops[1].indata.claim(header);
+  ops[1].indata = std::move(header);
 
   ops[2].op.op = CEPH_OSD_OP_OMAPSETVALS;
-  ops[2].indata.claim(vals);
+  ops[2].indata = std::move(vals);
 
   return do_osd_ops(ctx, ops);
 }
@@ -5802,7 +5802,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
        int r = osd->store->fiemap(ch, ghobject_t(soid, ghobject_t::NO_GEN,
                                                  info.pgid.shard),
                                   op.extent.offset, op.extent.length, bl);
-       osd_op.outdata.claim(bl);
+       osd_op.outdata = std::move(bl);
        if (r < 0)
          result = r;
        else
@@ -7226,7 +7226,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
        newop.op.extent.truncate_seq = oi.truncate_seq;
         newop.indata = osd_op.indata;
        result = do_osd_ops(ctx, nops);
-       osd_op.outdata.claim(newop.outdata);
+       osd_op.outdata = std::move(newop.outdata);
       }
       break;
 
@@ -7249,7 +7249,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
        newop.op.extent.offset = 0;
        newop.op.extent.length = 0;
        result = do_osd_ops(ctx, nops);
-       osd_op.outdata.claim(newop.outdata);
+       osd_op.outdata = std::move(newop.outdata);
       }
       break;
 
@@ -8570,7 +8570,7 @@ void PrimaryLogPG::finish_ctx(OpContext *ctx, int log_op_type, int result)
     bufferlist bv(sizeof(ctx->new_obs.oi));
     encode(ctx->new_obs.oi, bv,
             get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr));
-    attrs[OI_ATTR].claim(bv);
+    attrs[OI_ATTR] = std::move(bv);
 
     // snapset
     if (soid.snap == CEPH_NOSNAP) {
@@ -8578,7 +8578,7 @@ void PrimaryLogPG::finish_ctx(OpContext *ctx, int log_op_type, int result)
               << " in " << soid << dendl;
       bufferlist bss;
       encode(ctx->new_snapset, bss);
-      attrs[SS_ATTR].claim(bss);
+      attrs[SS_ATTR] = std::move(bss);
     } else {
       dout(10) << " no snapset (this is a clone)" << dendl;
     }
@@ -13803,8 +13803,8 @@ void PrimaryLogPG::hit_set_persist()
     ctx->clean_regions.mark_data_region_dirty(0, bl.length());
   }
   map <string, bufferlist> attrs;
-  attrs[OI_ATTR].claim(boi);
-  attrs[SS_ATTR].claim(bss);
+  attrs[OI_ATTR] = std::move(boi);
+  attrs[SS_ATTR] = std::move(bss);
   setattrs_maybe_cache(ctx->obc, ctx->op_t.get(), attrs);
   ctx->log.push_back(
     pg_log_entry_t(
@@ -15445,7 +15445,7 @@ int PrimaryLogPG::getattrs_maybe_cache(
        i != out->end();
        ++i) {
     if (i->first.size() > 1 && i->first[0] == '_')
-      tmp[i->first.substr(1, i->first.size())].claim(i->second);
+      tmp[i->first.substr(1, i->first.size())] = std::move(i->second);
   }
   tmp.swap(*out);
   return r;
index ebc36e8117091d7ff1265c34e1e9f4743aeb032c..f9e69556ca0c029ecab74ea965dd979bc182ff93 100644 (file)
@@ -618,7 +618,7 @@ public:
       explicit NotifyAck(uint64_t notify_id) : notify_id(notify_id) {}
       NotifyAck(uint64_t notify_id, uint64_t cookie, ceph::buffer::list& rbl)
        : watch_cookie(cookie), notify_id(notify_id) {
-       reply_bl.claim(rbl);
+       reply_bl = std::move(rbl);
       }
     };
     std::list<NotifyAck> notify_acks;
index e831101aa87ad164991b6d45580519138c59ac04..d0e4c8c0195e1003b1431bfc3a1f675a3e1ade10 100644 (file)
@@ -1847,7 +1847,7 @@ bool ReplicatedBackend::handle_pull_response(
                   &usable_intervals,
                   &usable_data);
   data_included = usable_intervals;
-  data.claim(usable_data);
+  data = std::move(usable_data);
 
 
   pi.recovery_progress = pop.after_progress;
index e0659c88bac16870b647825d185158413504ad4b..73c5406856a56d68f5c453377b599b1e2eb83f0d 100644 (file)
@@ -207,7 +207,7 @@ int cls_cxx_read2(cls_method_context_t hctx, int ofs, int len,
   ret = (*pctx)->pg->do_osd_ops(*pctx, ops);
   if (ret < 0)
     return ret;
-  outbl->claim(ops[0].outdata);
+  *outbl = std::move(ops[0].outdata);
   return outbl->length();
 }
 
@@ -284,7 +284,7 @@ int cls_cxx_getxattr(cls_method_context_t hctx, const char *name,
   if (r < 0)
     return r;
 
-  outbl->claim(op.outdata);
+  *outbl = std::move(op.outdata);
   return outbl->length();
 }
 
@@ -436,7 +436,7 @@ int cls_cxx_map_read_header(cls_method_context_t hctx, bufferlist *outbl)
   if (ret < 0)
     return ret;
 
-  outbl->claim(op.outdata);
+  *outbl = std::move(op.outdata);
 
   return 0;
 }
@@ -545,7 +545,7 @@ int cls_cxx_map_write_header(cls_method_context_t hctx, bufferlist *inbl)
   PrimaryLogPG::OpContext **pctx = (PrimaryLogPG::OpContext **)hctx;
   vector<OSDOp> ops(1);
   OSDOp& op = ops[0];
-  op.indata.claim(*inbl);
+  op.indata = std::move(*inbl);
 
   op.op.op = CEPH_OSD_OP_OMAPSETHEADER;
 
index 630ff3d07aa0e5c21125dad22339a3c40f891104..fc8426802d3802a5751878c58b15ea68ea4bb67c 100644 (file)
@@ -3765,8 +3765,7 @@ public:
     bl.reassign_to_mempool(mempool::mempool_osd_pglog);
   }
   void claim(ObjectModDesc &other) {
-    bl.clear();
-    bl.claim(other.bl);
+    bl = std::move(other.bl);
     can_local_rollback = other.can_local_rollback;
     rollback_info_completed = other.rollback_info_completed;
   }
@@ -4022,7 +4021,7 @@ struct OSDOp {
        ceph::buffer::list bl;
        bl.push_back(ceph::buffer::ptr_node::create(op.op.xattr.name_len));
        bl.begin().copy_in(op.op.xattr.name_len, op.indata);
-       op.indata.claim(bl);
+       op.indata = std::move(bl);
       } else if (ceph_osd_op_type_exec(op.op.op) &&
                 op.op.cls.class_len &&
                 op.indata.length() >
@@ -4031,7 +4030,7 @@ struct OSDOp {
        ceph::buffer::list bl;
        bl.push_back(ceph::buffer::ptr_node::create(len));
        bl.begin().copy_in(len, op.indata);
-       op.indata.claim(bl);
+       op.indata = std::move(bl);
       } else {
        op.indata.clear();
       }
index 79ed8c6185db9dc65ecaa5c53f32df43fe006d70..816d358ad12c9688d9925f4fedb98fa1d8611727 100644 (file)
@@ -3404,7 +3404,7 @@ void Objecter::handle_osd_op_reply(MOSDOpReply *m)
                    << " into existing ceph::buffer of length " << op->outbl->length()
                    << dendl;
       cb::list t;
-      t.claim(*op->outbl);
+      t = std::move(*op->outbl);
       t.invalidate_crc();  // we're overwriting the raw buffers via c_str()
       bl.begin().copy(bl.length(), t.c_str());
       op->outbl->substr_of(t, 0, bl.length());
@@ -4002,8 +4002,7 @@ void Objecter::handle_pool_op_reply(MPoolOpReply *m)
     PoolOp *op = iter->second;
     ldout(cct, 10) << "have request " << tid << " at " << op << " Op: "
                   << ceph_pool_op_name(op->pool_op) << dendl;
-    cb::list bl;
-    bl.claim(m->response_data);
+    cb::list bl{std::move(m->response_data)};
     if (m->version > last_seen_osdmap_version)
       last_seen_osdmap_version = m->version;
     if (osdmap->get_epoch() < m->epoch) {
@@ -4315,7 +4314,7 @@ void Objecter::_sg_read_finish(vector<ObjectExtent>& extents,
     r.assemble_result(cct, *bl, false);
   } else {
     ldout(cct, 15) << "  only one frag" << dendl;
-    bl->claim(resultbl[0]);
+    *bl = std::move(resultbl[0]);
   }
 
   // done
index c60cfb026f0b3b00195be9c1cc31aa5e9d8fb5f6..f27f446a0bd6675a87f590a63146b776521c2c4b 100644 (file)
@@ -50,7 +50,7 @@ int RGWPutObj_Compress::process(bufferlist&& in, uint64_t logical_offset)
         compressed = false;
         ldout(cct, 5) << "Compression failed with exit code " << cr
             << " for first part, storing uncompressed" << dendl;
-        out.claim(in);
+        out = std::move(in);
       } else {
         compressed = true;
     
@@ -63,7 +63,7 @@ int RGWPutObj_Compress::process(bufferlist&& in, uint64_t logical_offset)
       }
     } else {
       compressed = false;
-      out.claim(in);
+      out = std::move(in);
     }
     // end of compression stuff
   }
@@ -106,7 +106,7 @@ int RGWGetObj_Decompress::handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len
     in_bl.append(temp_in_bl);        
     waiting.clear();
   } else {
-    in_bl.claim(temp_in_bl);
+    in_bl = std::move(temp_in_bl);
   }
   bl_len = in_bl.length();
   
index 38ae6467611ce2575ed739dd901c3f2c2b584fed..68fd775640c5fb90293e0c35faa6a6247d379e95 100644 (file)
@@ -2313,7 +2313,7 @@ class RGWReadV
 
 public:
   RGWReadV(buffer::list& _bl, rgw_vio* _vio) : vio(_vio) {
-    bl.claim(_bl);
+    bl = std::move(_bl);
   }
 
   struct rgw_vio* get_vio() { return vio; }
index 8132b24ac22a0da88d0dbb5dfdc07418de96ebee..73a6cd121a4caaa74234986ea2d0d441f2ce7903 100644 (file)
@@ -1950,7 +1950,7 @@ public:
 
   int get_data(buffer::list& _bl) override {
     /* XXX for now, use sharing semantics */
-    _bl.claim(bl);
+    _bl = std::move(bl);
     uint32_t len = _bl.length();
     bytes_written += len;
     return len;
@@ -2489,7 +2489,7 @@ public:
   int get_data(buffer::list& _bl) override {
     /* XXX for now, use sharing semantics */
     uint32_t len = data.length();
-    _bl.claim(data);
+    _bl = std::move(data);
     bytes_written += len;
     return len;
   }
@@ -2498,7 +2498,7 @@ public:
     if (off != real_ofs) {
       eio = true;
     }
-    data.claim(_bl);
+    data = std::move(_bl);
     real_ofs += data.length();
     ofs = off; /* consumed in exec_continue() */
   }
index 1b14343bf484faff5fa287618597ebd8b43010ec..abbb5946254cfd96a7cc78ccbe055178862ad6f3 100644 (file)
@@ -1483,8 +1483,7 @@ int RGWRados::log_show_next(RGWAccessHandle handle, rgw_log_entry *entry)
     } catch (buffer::error& err) {
       return -EINVAL;
     }
-    state->bl.clear();
-    state->bl.claim(old);
+    state->bl = std::move(old);
     state->bl.claim_append(more);
     state->p = state->bl.cbegin();
     if ((unsigned)r < chunk)
@@ -5346,7 +5345,7 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket
     if (bletag.length() > 0 && bletag[bletag.length() - 1] == '\0') {
       bufferlist newbl;
       bletag.splice(0, bletag.length() - 1, &newbl);
-      bletag.claim(newbl);
+      bletag = std::move(newbl);
     }
   }
 
index eab3f7a5321024c92f67348e79a4fea28aebb3b3..c9e9729a9f32a8bec256caf09bb584345b7dc306 100644 (file)
@@ -335,7 +335,7 @@ int RGWRESTSimpleRequest::forward_request(RGWAccessKey& key, req_info& info, siz
   response.append((char)0); /* NULL terminate response */
 
   if (outbl) {
-    outbl->claim(response);
+    *outbl = std::move(response);
   }
 
   return status;
index 0eb85cd6d86b71a4510dcd071000e133e363b47b..5cb8df89ea052833a3c625897d4944b23eace925 100644 (file)
@@ -1391,6 +1391,26 @@ TEST(BufferList, append_bench) {
   }
 }
 
+TEST(BufferList, operator_assign_rvalue) {
+  bufferlist from;
+  {
+    bufferptr ptr(2);
+    from.append(ptr);
+  }
+  bufferlist to;
+  {
+    bufferptr ptr(4);
+    to.append(ptr);
+  }
+  EXPECT_EQ((unsigned)4, to.length());
+  EXPECT_EQ((unsigned)1, to.get_num_buffers());
+  to = std::move(from);
+  EXPECT_EQ((unsigned)2, to.length());
+  EXPECT_EQ((unsigned)1, to.get_num_buffers());
+  EXPECT_EQ((unsigned)0, from.get_num_buffers());
+  EXPECT_EQ((unsigned)0, from.length());
+}
+
 TEST(BufferList, operator_equal) {
   //
   // list& operator= (const list& other)
@@ -1869,26 +1889,6 @@ TEST(BufferList, rebuild_page_aligned) {
   }
 }
 
-TEST(BufferList, claim) {
-  bufferlist from;
-  {
-    bufferptr ptr(2);
-    from.append(ptr);
-  }
-  bufferlist to;
-  {
-    bufferptr ptr(4);
-    to.append(ptr);
-  }
-  EXPECT_EQ((unsigned)4, to.length());
-  EXPECT_EQ((unsigned)1, to.get_num_buffers());
-  to.claim(from);
-  EXPECT_EQ((unsigned)2, to.length());
-  EXPECT_EQ((unsigned)1, to.get_num_buffers());
-  EXPECT_EQ((unsigned)0, from.get_num_buffers());
-  EXPECT_EQ((unsigned)0, from.length());
-}
-
 TEST(BufferList, claim_append) {
   bufferlist from;
   {