]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/: convert boost::optional users to std::optional
authorSamuel Just <sjust@redhat.com>
Fri, 3 May 2019 20:44:27 +0000 (13:44 -0700)
committerSamuel Just <sjust@redhat.com>
Fri, 10 May 2019 00:22:26 +0000 (17:22 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
23 files changed:
src/include/encoding.h
src/include/types.h
src/messages/MOSDRepOp.h
src/osd/ECBackend.cc
src/osd/ECBackend.h
src/osd/ECMsgTypes.h
src/osd/ECTransaction.cc
src/osd/ExtentCache.h
src/osd/MissingLoc.h
src/osd/OSD.cc
src/osd/OpQueueItem.h
src/osd/PG.cc
src/osd/PG.h
src/osd/PGBackend.cc
src/osd/PGBackend.h
src/osd/PGTransaction.h
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h
src/osd/ReplicatedBackend.cc
src/osd/ReplicatedBackend.h
src/osd/mClockOpClassSupport.cc
src/osd/osd_types.cc
src/osd/osd_types.h

index 9963cf7a533828916fea97fb45057cd6baa9ef68..42f4e69050468812fa49351f84969aeffd92e084 100644 (file)
@@ -21,6 +21,7 @@
 #include <string>
 #include <string_view>
 #include <tuple>
+#include <optional>
 #include <boost/container/small_vector.hpp>
 #include <boost/optional/optional_io.hpp>
 #include <boost/tuple/tuple.hpp>
@@ -335,6 +336,10 @@ template<typename T>
 inline void encode(const boost::optional<T> &p, bufferlist &bl);
 template<typename T>
 inline void decode(boost::optional<T> &p, bufferlist::const_iterator &bp);
+template<typename T>
+inline void encode(const std::optional<T> &p, bufferlist &bl);
+template<typename T>
+inline void decode(std::optional<T> &p, bufferlist::const_iterator &bp);
 template<class A, class B, class C>
 inline void encode(const boost::tuple<A, B, C> &t, bufferlist& bl);
 template<class A, class B, class C>
@@ -569,6 +574,32 @@ inline void decode(boost::optional<T> &p, bufferlist::const_iterator &bp)
 #pragma GCC diagnostic pop
 #pragma GCC diagnostic warning "-Wpragmas"
 
+// std optional
+template<typename T>
+inline void encode(const std::optional<T> &p, bufferlist &bl)
+{
+  __u8 present = static_cast<bool>(p);
+  encode(present, bl);
+  if (p)
+    encode(*p, bl);
+}
+
+#pragma GCC diagnostic ignored "-Wpragmas"
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wuninitialized"
+template<typename T>
+inline void decode(std::optional<T> &p, bufferlist::const_iterator &bp)
+{
+  __u8 present;
+  decode(present, bp);
+  if (present) {
+    p = T{};
+    decode(*p, bp);
+  } else {
+    p = std::nullopt;
+  }
+}
+
 // std::tuple
 template<typename... Ts>
 inline void encode(const std::tuple<Ts...> &t, bufferlist& bl)
index f58213895e31952bf1365e7d8f6bd989ad8fe647..44777d218c8a4e1cada4230b31b1d387c3f76e92 100644 (file)
@@ -58,6 +58,7 @@ extern "C" {
 #include <boost/container/flat_map.hpp>
 #include <map>
 #include <vector>
+#include <optional>
 #include <iostream>
 #include <iomanip>
 
@@ -106,6 +107,8 @@ template<class A, class Comp, class Alloc>
 inline std::ostream& operator<<(std::ostream& out, const std::deque<A,Alloc>& v);
 template<typename... Ts>
 inline std::ostream& operator<<(std::ostream& out, const std::tuple<Ts...> &t);
+template<typename T>
+inline std::ostream& operator<<(std::ostream& out, const std::optional<T> &t);
 template<class A, class Alloc>
 inline std::ostream& operator<<(std::ostream& out, const std::list<A,Alloc>& ilist);
 template<class A, class Comp, class Alloc>
@@ -184,6 +187,16 @@ inline std::ostream& operator<<(std::ostream& out, const std::tuple<Ts...> &t) {
   return out;
 }
 
+// Mimics boost::optional
+template<typename T>
+inline std::ostream& operator<<(std::ostream& out, const std::optional<T> &t) {
+  if (!t)
+    out << "--" ;
+  else
+    out << ' ' << *t ;
+  return out;
+}
+
 template<class A, class Alloc>
 inline std::ostream& operator<<(std::ostream& out, const std::list<A,Alloc>& ilist) {
   for (auto it = ilist.begin();
index bafee6faac09a301887920d92ae0273540a8fcb9..b998eedd2a63eec85dae64fdf6c3fb583361ab97 100644 (file)
@@ -61,7 +61,7 @@ public:
   hobject_t discard_temp_oid;  ///< previously used temp object that we can now stop tracking
 
   /// non-empty if this transaction involves a hit_set history update
-  boost::optional<pg_hit_set_history_t> updated_hit_set_history;
+  std::optional<pg_hit_set_history_t> updated_hit_set_history;
 
   epoch_t get_map_epoch() const override {
     return map_epoch;
index f498f6c9b71865a6a5c6597bb9fee2465ea04f73..a14de9558a5d27dd74cab044947f89e825a02d0c 100644 (file)
@@ -98,7 +98,7 @@ ostream &operator<<(ostream &lhs, const ECBackend::read_result_t &rhs)
   lhs << "read_result_t(r=" << rhs.r
       << ", errors=" << rhs.errors;
   if (rhs.attrs) {
-    lhs << ", attrs=" << rhs.attrs.get();
+    lhs << ", attrs=" << *(rhs.attrs);
   } else {
     lhs << ", noattrs";
   }
@@ -414,7 +414,7 @@ void ECBackend::handle_recovery_push_reply(
 void ECBackend::handle_recovery_read_complete(
   const hobject_t &hoid,
   boost::tuple<uint64_t, uint64_t, map<pg_shard_t, bufferlist> > &to_read,
-  boost::optional<map<string, bufferlist> > attrs,
+  std::optional<map<string, bufferlist> > attrs,
   RecoveryMessages *m)
 {
   dout(10) << __func__ << ": returned " << hoid << " "
@@ -1482,7 +1482,7 @@ void ECBackend::submit_transaction(
   const eversion_t &trim_to,
   const eversion_t &roll_forward_to,
   const vector<pg_log_entry_t> &log_entries,
-  boost::optional<pg_hit_set_history_t> &hset_history,
+  std::optional<pg_hit_set_history_t> &hset_history,
   Context *on_all_commit,
   ceph_tid_t tid,
   osd_reqid_t reqid,
index e003a08c73667cdb96261886b7d17855b227a44c..230542bc6de501782e0054a14d357df65677ca9a 100644 (file)
@@ -104,7 +104,7 @@ public:
     const eversion_t &trim_to,
     const eversion_t &roll_forward_to,
     const vector<pg_log_entry_t> &log_entries,
-    boost::optional<pg_hit_set_history_t> &hset_history,
+    std::optional<pg_hit_set_history_t> &hset_history,
     Context *on_all_commit,
     ceph_tid_t tid,
     osd_reqid_t reqid,
@@ -302,7 +302,7 @@ private:
   void handle_recovery_read_complete(
     const hobject_t &hoid,
     boost::tuple<uint64_t, uint64_t, map<pg_shard_t, bufferlist> > &to_read,
-    boost::optional<map<string, bufferlist> > attrs,
+    std::optional<map<string, bufferlist> > attrs,
     RecoveryMessages *m);
   void handle_recovery_push(
     const PushOp &op,
@@ -344,7 +344,7 @@ public:
   struct read_result_t {
     int r;
     map<pg_shard_t, int> errors;
-    boost::optional<map<string, bufferlist> > attrs;
+    std::optional<map<string, bufferlist> > attrs;
     list<
       boost::tuple<
        uint64_t, uint64_t, map<pg_shard_t, bufferlist> > > returned;
@@ -456,7 +456,7 @@ public:
     object_stat_sum_t delta_stats;
     eversion_t version;
     eversion_t trim_to;
-    boost::optional<pg_hit_set_history_t> updated_hit_set_history;
+    std::optional<pg_hit_set_history_t> updated_hit_set_history;
     vector<pg_log_entry_t> log_entries;
     ceph_tid_t tid;
     osd_reqid_t reqid;
index 4d18dace1b81337787d5a3743af46fb80f618593..3545edf58da761d738cc86eb577195457dc7552d 100644 (file)
@@ -33,7 +33,7 @@ struct ECSubWrite {
   vector<pg_log_entry_t> log_entries;
   std::set<hobject_t> temp_added;
   std::set<hobject_t> temp_removed;
-  boost::optional<pg_hit_set_history_t> updated_hit_set_history;
+  std::optional<pg_hit_set_history_t> updated_hit_set_history;
   bool backfill_or_async_recovery = false;
   ECSubWrite() : tid(0) {}
   ECSubWrite(
@@ -47,7 +47,7 @@ struct ECSubWrite {
     eversion_t trim_to,
     eversion_t roll_forward_to,
     vector<pg_log_entry_t> log_entries,
-    boost::optional<pg_hit_set_history_t> updated_hit_set_history,
+    std::optional<pg_hit_set_history_t> updated_hit_set_history,
     const std::set<hobject_t> &temp_added,
     const std::set<hobject_t> &temp_removed,
     bool backfill_or_async_recovery)
index ee791d633c6ea8ecdba5005cae452626228d6057..38402004c5d918e0c34a3e2e443c8ff46edcd169 100644 (file)
@@ -184,7 +184,7 @@ void ECTransaction::generate_transactions(
        entry->mod_desc.update_snaps(op.updated_snaps->first);
       }
 
-      map<string, boost::optional<bufferlist> > xattr_rollback;
+      map<string, std::optional<bufferlist> > xattr_rollback;
       ceph_assert(hinfo);
       bufferlist old_hinfo;
       encode(*hinfo, old_hinfo);
@@ -200,7 +200,7 @@ void ECTransaction::generate_transactions(
        if (op.truncate->first != op.truncate->second) {
          op.truncate->first = op.truncate->second;
        } else {
-         op.truncate = boost::none;
+         op.truncate = std::nullopt;
        }
 
        op.delete_first = true;
@@ -218,7 +218,7 @@ void ECTransaction::generate_transactions(
       }
 
       if (op.delete_first) {
-       /* We also want to remove the boost::none entries since
+       /* We also want to remove the std::nullopt entries since
           * the keys already won't exist */
        for (auto j = op.attr_updates.begin();
             j != op.attr_updates.end();
@@ -332,13 +332,13 @@ void ECTransaction::generate_transactions(
                xattr_rollback.insert(
                  make_pair(
                    j.first,
-                   boost::optional<bufferlist>(citer->second)));
+                   std::optional<bufferlist>(citer->second)));
              } else {
                // won't overwrite anything we put in earlier
                xattr_rollback.insert(
                  make_pair(
                    j.first,
-                   boost::none));
+                   std::nullopt));
              }
            }
            if (j.second) {
index 7f6e3e2e51a635a6c661649efaf08955cd10d70d..bf5a60dc1b6f270446eb97221655f6be23324745 100644 (file)
@@ -19,7 +19,7 @@
 #include <list>
 #include <vector>
 #include <utility>
-#include <boost/optional.hpp>
+#include <optional>
 #include <boost/intrusive/set.hpp>
 #include <boost/intrusive/list.hpp>
 #include "include/interval_set.h"
@@ -131,14 +131,14 @@ private:
 
     uint64_t offset;
     uint64_t length;
-    boost::optional<bufferlist> bl;
+    std::optional<bufferlist> bl;
 
     uint64_t get_length() const {
       return length;
     }
 
     bool is_pending() const {
-      return bl == boost::none;
+      return bl == std::nullopt;
     }
 
     bool pinned_by_write() const {
@@ -204,7 +204,7 @@ private:
        UPDATE_PIN
       };
       type action = NONE;
-      boost::optional<bufferlist> bl;
+      std::optional<bufferlist> bl;
     };
     template <typename F>
     void traverse_update(
index 19c8f872ea5d100bb47e187f37198064ef03970a..3b1ff161b21b9ffeaef3e241a3e05ab90853172c 100644 (file)
@@ -290,7 +290,7 @@ class MissingLoc {
     const map<pg_shard_t, pg_missing_t> &pmissing,
     const map<pg_shard_t, pg_info_t> &pinfo) {
     recovered(hoid);
-    boost::optional<pg_missing_item> item;
+    std::optional<pg_missing_item> item;
     auto miter = missing.get_items().find(hoid);
     if (miter != missing.get_items().end()) {
       item = miter->second;
index 3aca91296570b7d9ce841c5409b23e3f6b383e76..e121ca2561cd6c5c288e8faf5e23e43509c90783 100644 (file)
@@ -10416,7 +10416,7 @@ void OSD::ShardedOpWQ::_process(uint32_t thread_index, heartbeat_handle_d *hb)
               << " no pg, shouldn't exist e" << osdmap->get_epoch()
               << ", dropping " << qi << dendl;
       // share map with client?
-      if (boost::optional<OpRequestRef> _op = qi.maybe_get_op()) {
+      if (std::optional<OpRequestRef> _op = qi.maybe_get_op()) {
        osd->service.maybe_share_map((*_op)->get_req()->get_connection().get(),
                                     sdata->shard_osdmap,
                                     (*_op)->sent_epoch);
@@ -10457,7 +10457,7 @@ void OSD::ShardedOpWQ::_process(uint32_t thread_index, heartbeat_handle_d *hb)
   {
 #ifdef WITH_LTTNG
     osd_reqid_t reqid;
-    if (boost::optional<OpRequestRef> _op = qi.maybe_get_op()) {
+    if (std::optional<OpRequestRef> _op = qi.maybe_get_op()) {
       reqid = (*_op)->get_reqid();
     }
 #endif
@@ -10479,7 +10479,7 @@ void OSD::ShardedOpWQ::_process(uint32_t thread_index, heartbeat_handle_d *hb)
   {
 #ifdef WITH_LTTNG
     osd_reqid_t reqid;
-    if (boost::optional<OpRequestRef> _op = qi.maybe_get_op()) {
+    if (std::optional<OpRequestRef> _op = qi.maybe_get_op()) {
       reqid = (*_op)->get_reqid();
     }
 #endif
index 558c5c885c8b72327fbcdc24920c3931726db923..0680e0bd7e7009d1431b8f1b12a5fccb8aba7cdb 100644 (file)
@@ -55,8 +55,8 @@ public:
     virtual const spg_t& get_ordering_token() const = 0;
     virtual OrderLocker::Ref get_order_locker(PGRef pg) = 0;
     virtual op_type_t get_op_type() const = 0;
-    virtual boost::optional<OpRequestRef> maybe_get_op() const {
-      return boost::none;
+    virtual std::optional<OpRequestRef> maybe_get_op() const {
+      return std::nullopt;
     }
 
     virtual uint64_t get_reserved_pushes() const {
@@ -124,7 +124,7 @@ public:
   OpQueueable::op_type_t get_op_type() const {
     return qitem->get_op_type();
   }
-  boost::optional<OpRequestRef> maybe_get_op() const {
+  std::optional<OpRequestRef> maybe_get_op() const {
     return qitem->maybe_get_op();
   }
   uint64_t get_reserved_pushes() const {
@@ -208,7 +208,7 @@ public:
   ostream &print(ostream &rhs) const override final {
     return rhs << "PGOpItem(op=" << *(op->get_req()) << ")";
   }
-  boost::optional<OpRequestRef> maybe_get_op() const override final {
+  std::optional<OpRequestRef> maybe_get_op() const override final {
     return op;
   }
   void run(OSD *osd, OSDShard *sdata, PGRef& pg, ThreadPool::TPHandle &handle) override final;
index d6565eb5057209b14fef809cc75f1960abc0ade4..d8b86cd581befa86b40d60c4279c04460f8af5c1 100644 (file)
@@ -3053,8 +3053,8 @@ void PG::scrub_compare_maps()
   // construct authoritative scrub map for type specific scrubbing
   scrubber.cleaned_meta_map.insert(scrubber.primary_scrubmap);
   map<hobject_t,
-      pair<boost::optional<uint32_t>,
-           boost::optional<uint32_t>>> missing_digest;
+      pair<std::optional<uint32_t>,
+           std::optional<uint32_t>>> missing_digest;
 
   map<pg_shard_t, ScrubMap *> maps;
   maps[pg_whoami] = &scrubber.primary_scrubmap;
index d6119ca70f591a7649c49b68191cc15fd51340e2..e712ae54b8b50f6439666f695cebf8eb2d69db43 100644 (file)
@@ -1327,8 +1327,8 @@ protected:
   virtual void scrub_snapshot_metadata(
     ScrubMap &map,
     const std::map<hobject_t,
-                   pair<boost::optional<uint32_t>,
-                        boost::optional<uint32_t>>> &missing_digest) { }
+                   pair<std::optional<uint32_t>,
+                        std::optional<uint32_t>>> &missing_digest) { }
   virtual void _scrub_clear_state() { }
   virtual void _scrub_finish() { }
   void clear_scrub_reserved();
index 62cfed4ed5d21490bb731ed14810bc481f69121c..fa802d3a7c1f620ffcda6109767cb22e779287aa 100644 (file)
@@ -197,7 +197,7 @@ void PGBackend::rollback(
       temp.append(t);
       temp.swap(t);
     }
-    void setattrs(map<string, boost::optional<bufferlist> > &attrs) override {
+    void setattrs(map<string, std::optional<bufferlist> > &attrs) override {
       ObjectStore::Transaction temp;
       pg->rollback_setattrs(hoid, attrs, &temp);
       temp.append(t);
@@ -438,15 +438,15 @@ int PGBackend::objects_get_attrs(
 
 void PGBackend::rollback_setattrs(
   const hobject_t &hoid,
-  map<string, boost::optional<bufferlist> > &old_attrs,
+  map<string, std::optional<bufferlist> > &old_attrs,
   ObjectStore::Transaction *t) {
   map<string, bufferlist> to_set;
   ceph_assert(!hoid.is_temp());
-  for (map<string, boost::optional<bufferlist> >::iterator i = old_attrs.begin();
+  for (map<string, std::optional<bufferlist> >::iterator i = old_attrs.begin();
        i != old_attrs.end();
        ++i) {
     if (i->second) {
-      to_set[i->first] = i->second.get();
+      to_set[i->first] = *(i->second);
     } else {
       t->rmattr(
        coll,
@@ -1010,8 +1010,8 @@ void PGBackend::be_compare_scrubmaps(
   map<hobject_t, set<pg_shard_t>> &missing,
   map<hobject_t, set<pg_shard_t>> &inconsistent,
   map<hobject_t, list<pg_shard_t>> &authoritative,
-  map<hobject_t, pair<boost::optional<uint32_t>,
-                      boost::optional<uint32_t>>> &missing_digest,
+  map<hobject_t, pair<std::optional<uint32_t>,
+                      std::optional<uint32_t>>> &missing_digest,
   int &shallow_errors, int &deep_errors,
   Scrub::Store *store,
   const spg_t& pgid,
@@ -1147,7 +1147,7 @@ void PGBackend::be_compare_scrubmaps(
     }
 
     if (fix_digest) {
-      boost::optional<uint32_t> data_digest, omap_digest;
+      std::optional<uint32_t> data_digest, omap_digest;
       ceph_assert(auth_object.digest_present);
       data_digest = auth_object.digest;
       if (auth_object.omap_digest_present) {
@@ -1199,7 +1199,7 @@ void PGBackend::be_compare_scrubmaps(
        utime_t age = now - auth_oi.local_mtime;
        if (update == FORCE ||
            age > cct->_conf->osd_deep_scrub_update_digest_min_age) {
-          boost::optional<uint32_t> data_digest, omap_digest;
+          std::optional<uint32_t> data_digest, omap_digest;
           if (auth_object.digest_present) {
             data_digest = auth_object.digest;
            dout(20) << __func__ << " will update data digest on " << *k << dendl;
index 70c01ac075893c60db6f3045a97b68b95e41c1b4..cc08603edea7ca52f4ab03e59e979c2928e85ef3 100644 (file)
@@ -171,17 +171,17 @@ typedef std::shared_ptr<const OSDMap> OSDMapRef;
      virtual void add_local_next_event(const pg_log_entry_t& e) = 0;
      virtual const map<pg_shard_t, pg_missing_t> &get_shard_missing()
        const = 0;
-     virtual boost::optional<const pg_missing_const_i &> maybe_get_shard_missing(
+     virtual const pg_missing_const_i * maybe_get_shard_missing(
        pg_shard_t peer) const {
        if (peer == primary_shard()) {
-        return get_local_missing();
+        return &get_local_missing();
        } else {
         map<pg_shard_t, pg_missing_t>::const_iterator i =
           get_shard_missing().find(peer);
         if (i == get_shard_missing().end()) {
-          return boost::optional<const pg_missing_const_i &>();
+          return nullptr;
         } else {
-          return i->second;
+          return &(i->second);
         }
        }
      }
@@ -232,7 +232,7 @@ typedef std::shared_ptr<const OSDMap> OSDMapRef;
 
      virtual void log_operation(
        const vector<pg_log_entry_t> &logv,
-       const boost::optional<pg_hit_set_history_t> &hset_history,
+       const std::optional<pg_hit_set_history_t> &hset_history,
        const eversion_t &trim_to,
        const eversion_t &roll_forward_to,
        bool transaction_applied,
@@ -449,7 +449,7 @@ typedef std::shared_ptr<const OSDMap> OSDMapRef;
      const eversion_t &roll_forward_to,  ///< [in] trim rollback info to here
      const vector<pg_log_entry_t> &log_entries, ///< [in] log entries for t
      /// [in] hitset history (if updated with this transaction)
-     boost::optional<pg_hit_set_history_t> &hset_history,
+     std::optional<pg_hit_set_history_t> &hset_history,
      Context *on_all_commit,              ///< [in] called when all commit
      ceph_tid_t tid,                      ///< [in] tid
      osd_reqid_t reqid,                   ///< [in] reqid
@@ -489,7 +489,7 @@ typedef std::shared_ptr<const OSDMap> OSDMapRef;
    /// Reapply old attributes
    void rollback_setattrs(
      const hobject_t &hoid,
-     map<string, boost::optional<bufferlist> > &old_attrs,
+     map<string, std::optional<bufferlist> > &old_attrs,
      ObjectStore::Transaction *t);
 
    /// Truncate object to rollback append
@@ -595,8 +595,8 @@ typedef std::shared_ptr<const OSDMap> OSDMapRef;
      map<hobject_t, set<pg_shard_t>> &missing,
      map<hobject_t, set<pg_shard_t>> &inconsistent,
      map<hobject_t, list<pg_shard_t>> &authoritative,
-     map<hobject_t, pair<boost::optional<uint32_t>,
-                         boost::optional<uint32_t>>> &missing_digest,
+     map<hobject_t, pair<std::optional<uint32_t>,
+                         std::optional<uint32_t>>> &missing_digest,
      int &shallow_errors, int &deep_errors,
      Scrub::Store *store,
      const spg_t& pgid,
index e3a7b8e1e8206e6b7cf561b9587f33000065f581..beb61449a39b6d501f4a0136e78c84d7e75fcc2d 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <map>
 #include <memory>
-#include <boost/optional.hpp>
+#include <optional>
 
 #include "common/hobject.h"
 #include "osd/osd_types.h"
@@ -127,24 +127,24 @@ public:
      * remember the lowest truncate and the final object size
      * (the last truncate).  We also adjust the buffers map
      * to account for truncates overriding previous writes */
-    boost::optional<pair<uint64_t, uint64_t> > truncate = boost::none;
+    std::optional<pair<uint64_t, uint64_t> > truncate = std::nullopt;
 
-    std::map<string, boost::optional<bufferlist> > attr_updates;
+    std::map<string, std::optional<bufferlist> > attr_updates;
 
     enum class OmapUpdateType {Remove, Insert};
     std::vector<std::pair<OmapUpdateType, bufferlist> > omap_updates;
 
-    boost::optional<bufferlist> omap_header;
+    std::optional<bufferlist> omap_header;
 
     /// (old, new) -- only valid with no truncate or buffer updates
-    boost::optional<pair<set<snapid_t>, set<snapid_t> > > updated_snaps;
+    std::optional<pair<set<snapid_t>, set<snapid_t> > > updated_snaps;
 
     struct alloc_hint_t {
       uint64_t expected_object_size;
       uint64_t expected_write_size;
       uint32_t flags;
     };
-    boost::optional<alloc_hint_t> alloc_hint;
+    std::optional<alloc_hint_t> alloc_hint;
 
     struct BufferUpdate {
       struct Write {
@@ -338,7 +338,7 @@ public:
     auto &op = get_object_op_for_modify(hoid);
     op.clear_omap = true;
     op.omap_updates.clear();
-    op.omap_header = boost::none;
+    op.omap_header = std::nullopt;
   }
   void truncate(
     const hobject_t &hoid,         ///< [in] object
@@ -383,7 +383,7 @@ public:
     const string &attrname         ///< [in] attr to remove
     ) {
     auto &op = get_object_op_for_modify(hoid);
-    op.attr_updates[attrname] = boost::none;
+    op.attr_updates[attrname] = std::nullopt;
   }
 
   /// set alloc hint
index a95b5a4610a99966f4932169ea8428f53bfa72ab..dbe8a7daa4e124895c4191345443f599b4e2afd8 100644 (file)
@@ -2343,7 +2343,7 @@ PrimaryLogPG::cache_result_t PrimaryLogPG::maybe_handle_manifest_detail(
        }
       }
       if (all_dirty) {
-       start_flush(OpRequestRef(), obc, true, NULL, boost::none);
+       start_flush(OpRequestRef(), obc, true, NULL, std::nullopt);
       }
       return cache_result_t::NOOP;
     }
@@ -2405,7 +2405,7 @@ void PrimaryLogPG::handle_manifest_flush(hobject_t oid, ceph_tid_t tid, int r,
 }
 
 int PrimaryLogPG::start_manifest_flush(OpRequestRef op, ObjectContextRef obc, bool blocking,
-                                      boost::optional<std::function<void()>> &&on_flush)
+                                      std::optional<std::function<void()>> &&on_flush)
 {
   auto p = obc->obs.oi.manifest.chunk_map.begin();
   FlushOpRef manifest_fop(std::make_shared<FlushOp>());
@@ -2599,7 +2599,7 @@ void PrimaryLogPG::record_write_error(OpRequestRef op, const hobject_t &soid,
   submit_log_entries(
     entries,
     std::move(lock_manager),
-    boost::optional<std::function<void(void)> >(
+    std::optional<std::function<void(void)> >(
       OnComplete(this, op, orig_reply, r)),
     op,
     r);
@@ -4893,13 +4893,13 @@ struct FillInVerifyExtent : public Context {
   ceph_le64 *r;
   int32_t *rval;
   bufferlist *outdatap;
-  boost::optional<uint32_t> maybe_crc;
+  std::optional<uint32_t> maybe_crc;
   uint64_t size;
   OSDService *osd;
   hobject_t soid;
   __le32 flags;
   FillInVerifyExtent(ceph_le64 *r, int32_t *rv, bufferlist *blp,
-                    boost::optional<uint32_t> mc, uint64_t size,
+                    std::optional<uint32_t> mc, uint64_t size,
                     OSDService *osd, hobject_t soid, __le32 flags) :
     r(r), rval(rv), outdatap(blp), maybe_crc(mc),
     size(size), osd(osd), soid(soid), flags(flags) {}
@@ -5015,7 +5015,7 @@ struct C_ChecksumRead : public Context {
 
   C_ChecksumRead(PrimaryLogPG *primary_log_pg, OSDOp &osd_op,
                 Checksummer::CSumType csum_type, bufferlist &&init_value_bl,
-                boost::optional<uint32_t> maybe_crc, uint64_t size,
+                std::optional<uint32_t> maybe_crc, uint64_t size,
                 OSDService *osd, hobject_t soid, __le32 flags)
     : primary_log_pg(primary_log_pg), osd_op(osd_op),
       csum_type(csum_type), init_value_bl(std::move(init_value_bl)),
@@ -5109,7 +5109,7 @@ int PrimaryLogPG::do_checksum(OpContext *ctx, OSDOp& osd_op,
   if (pool.info.is_erasure() && op.checksum.length > 0) {
     // If there is a data digest and it is possible we are reading
     // entire object, pass the digest.
-    boost::optional<uint32_t> maybe_crc;
+    std::optional<uint32_t> maybe_crc;
     if (oi.is_data_digest() && op.checksum.offset == 0 &&
         op.checksum.length >= oi.size) {
       maybe_crc = oi.data_digest;
@@ -5227,7 +5227,7 @@ struct C_ExtentCmpRead : public Context {
   Context *fill_extent_ctx;
 
   C_ExtentCmpRead(PrimaryLogPG *primary_log_pg, OSDOp &osd_op,
-                 boost::optional<uint32_t> maybe_crc, uint64_t size,
+                 std::optional<uint32_t> maybe_crc, uint64_t size,
                  OSDService *osd, hobject_t soid, __le32 flags)
     : primary_log_pg(primary_log_pg), osd_op(osd_op),
       fill_extent_ctx(new FillInVerifyExtent(&read_length, &osd_op.rval,
@@ -5281,7 +5281,7 @@ int PrimaryLogPG::do_extent_cmp(OpContext *ctx, OSDOp& osd_op)
   } else if (pool.info.is_erasure()) {
     // If there is a data digest and it is possible we are reading
     // entire object, pass the digest.
-    boost::optional<uint32_t> maybe_crc;
+    std::optional<uint32_t> maybe_crc;
     if (oi.is_data_digest() && op.checksum.offset == 0 &&
         op.checksum.length >= oi.size) {
       maybe_crc = oi.data_digest;
@@ -5374,7 +5374,7 @@ int PrimaryLogPG::do_read(OpContext *ctx, OSDOp& osd_op) {
   } else if (pool.info.is_erasure()) {
     // The initialisation below is required to silence a false positive
     // -Wmaybe-uninitialized warning
-    boost::optional<uint32_t> maybe_crc = boost::make_optional(false, uint32_t());
+    std::optional<uint32_t> maybe_crc;
     // If there is a data digest and it is possible we are reading
     // entire object, pass the digest.  FillInVerifyExtent will
     // will check the oi.size again.
@@ -5869,7 +5869,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
          break;
        }
        if (oi.is_dirty()) {
-         result = start_flush(ctx->op, ctx->obc, false, NULL, boost::none);
+         result = start_flush(ctx->op, ctx->obc, false, NULL, std::nullopt);
          if (result == -EINPROGRESS)
            result = -EAGAIN;
        } else {
@@ -5902,7 +5902,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
        }
        hobject_t missing;
        if (oi.is_dirty()) {
-         result = start_flush(ctx->op, ctx->obc, true, &missing, boost::none);
+         result = start_flush(ctx->op, ctx->obc, true, &missing, std::nullopt);
          if (result == -EINPROGRESS)
            result = -EAGAIN;
        } else {
@@ -8208,7 +8208,7 @@ void PrimaryLogPG::do_osd_op_effects(OpContext *ctx, const ConnectionRef& conn)
        p != ctx->notify_acks.end();
        ++p) {
     if (p->watch_cookie)
-      dout(10) << "notify_ack " << make_pair(p->watch_cookie.get(), p->notify_id) << dendl;
+      dout(10) << "notify_ack " << make_pair(*(p->watch_cookie), p->notify_id) << dendl;
     else
       dout(10) << "notify_ack " << make_pair("NULL", p->notify_id) << dendl;
     for (map<pair<uint64_t, entity_name_t>, WatchRef>::iterator i =
@@ -8217,7 +8217,7 @@ void PrimaryLogPG::do_osd_op_effects(OpContext *ctx, const ConnectionRef& conn)
         ++i) {
       if (i->first.second != entity) continue;
       if (p->watch_cookie &&
-         p->watch_cookie.get() != i->first.first) continue;
+         *(p->watch_cookie) != i->first.first) continue;
       dout(10) << "acking notify on watch " << i->first << dendl;
       i->second->notify_ack(p->notify_id, p->reply_bl);
     }
@@ -9748,7 +9748,7 @@ struct C_Flush : public Context {
 int PrimaryLogPG::start_flush(
   OpRequestRef op, ObjectContextRef obc,
   bool blocking, hobject_t *pmissing,
-  boost::optional<std::function<void()>> &&on_flush)
+  std::optional<std::function<void()>> &&on_flush)
 {
   const object_info_t& oi = obc->obs.oi;
   const hobject_t& soid = oi.soid;
@@ -9982,7 +9982,7 @@ void PrimaryLogPG::finish_flush(hobject_t oid, ceph_tid_t tid, int r)
     }
     if (fop->on_flush) {
       (*(fop->on_flush))();
-      fop->on_flush = boost::none;
+      fop->on_flush = std::nullopt;
     }
     flush_ops.erase(oid);
     return;
@@ -10019,7 +10019,7 @@ int PrimaryLogPG::try_flush_mark_clean(FlushOpRef fop)
     }
     if (fop->on_flush) {
       (*(fop->on_flush))();
-      fop->on_flush = boost::none;
+      fop->on_flush = std::nullopt;
     }
     flush_ops.erase(oid);
     if (fop->blocking)
@@ -10052,7 +10052,7 @@ int PrimaryLogPG::try_flush_mark_clean(FlushOpRef fop)
     osd->logger->inc(l_osd_tier_clean);
     if (fop->on_flush) {
       (*(fop->on_flush))();
-      fop->on_flush = boost::none;
+      fop->on_flush = std::nullopt;
     }
     flush_ops.erase(oid);
     return 0;
@@ -10096,7 +10096,7 @@ int PrimaryLogPG::try_flush_mark_clean(FlushOpRef fop)
 
   if (fop->on_flush) {
     ctx->register_on_finish(*(fop->on_flush));
-    fop->on_flush = boost::none;
+    fop->on_flush = std::nullopt;
   }
 
   ctx->at_version = get_next_version();
@@ -10192,7 +10192,7 @@ void PrimaryLogPG::cancel_flush(FlushOpRef fop, bool requeue,
   }
   if (fop->on_flush) {
     (*(fop->on_flush))();
-    fop->on_flush = boost::none;
+    fop->on_flush = std::nullopt;
   }
   flush_ops.erase(fop->obc->obs.oi.soid);
 }
@@ -10390,7 +10390,7 @@ boost::intrusive_ptr<PrimaryLogPG::RepGather> PrimaryLogPG::new_repop(
   int r,
   ObcLockManager &&manager,
   OpRequestRef &&op,
-  boost::optional<std::function<void(void)> > &&on_complete)
+  std::optional<std::function<void(void)> > &&on_complete)
 {
   RepGather *repop = new RepGather(
     std::move(manager),
@@ -10453,7 +10453,7 @@ void PrimaryLogPG::simple_opc_submit(OpContextUPtr ctx)
 void PrimaryLogPG::submit_log_entries(
   const mempool::osd_pglog::list<pg_log_entry_t> &entries,
   ObcLockManager &&manager,
-  boost::optional<std::function<void(void)> > &&_on_complete,
+  std::optional<std::function<void(void)> > &&_on_complete,
   OpRequestRef op,
   int r)
 {
@@ -10467,7 +10467,7 @@ void PrimaryLogPG::submit_log_entries(
   }
 
   boost::intrusive_ptr<RepGather> repop;
-  boost::optional<std::function<void(void)> > on_complete;
+  std::optional<std::function<void(void)> > on_complete;
   if (get_osdmap()->require_osd_release >= ceph_release_t::jewel) {
     repop = new_repop(
       version,
@@ -11486,13 +11486,14 @@ void PrimaryLogPG::do_update_log_missing(OpRequestRef &op)
     op->get_req());
   ceph_assert(m->get_type() == MSG_OSD_PG_UPDATE_LOG_MISSING);
   ObjectStore::Transaction t;
-  boost::optional<eversion_t> op_trim_to, op_roll_forward_to;
+  std::optional<eversion_t> op_trim_to, op_roll_forward_to;
   if (m->pg_trim_to != eversion_t())
     op_trim_to = m->pg_trim_to;
   if (m->pg_roll_forward_to != eversion_t())
     op_roll_forward_to = m->pg_roll_forward_to;
 
-  dout(20) << __func__ << " op_trim_to = " << op_trim_to << " op_roll_forward_to = " << op_roll_forward_to << dendl;
+  dout(20) << __func__
+          << " op_trim_to = " << op_trim_to << " op_roll_forward_to = " << op_roll_forward_to << dendl;
 
   recovery_state.append_log_entries_update_missing(
     m->entries, t, op_trim_to, op_roll_forward_to);
@@ -11675,7 +11676,7 @@ void PrimaryLogPG::mark_all_unfound_lost(
   submit_log_entries(
     log_entries,
     std::move(manager),
-    boost::optional<std::function<void(void)> >(
+    std::optional<std::function<void(void)> >(
       [this, oids, con, num_unfound, tid]() {
        if (recovery_state.perform_deletes_during_peering()) {
          for (auto oid : oids) {
@@ -14403,13 +14404,13 @@ bool PrimaryLogPG::_range_available_for_scrub(
   return true;
 }
 
-static bool doing_clones(const boost::optional<SnapSet> &snapset,
+static bool doing_clones(const std::optional<SnapSet> &snapset,
                         const vector<snapid_t>::reverse_iterator &curclone) {
-    return snapset && curclone != snapset.get().clones.rend();
+    return snapset && curclone != snapset->clones.rend();
 }
 
 void PrimaryLogPG::log_missing(unsigned missing,
-                       const boost::optional<hobject_t> &head,
+                       const std::optional<hobject_t> &head,
                        LogChannelRef clog,
                        const spg_t &pgid,
                        const char *func,
@@ -14418,21 +14419,21 @@ void PrimaryLogPG::log_missing(unsigned missing,
 {
   ceph_assert(head);
   if (allow_incomplete_clones) {
-    dout(20) << func << " " << mode << " " << pgid << " " << head.get()
-               << " skipped " << missing << " clone(s) in cache tier" << dendl;
+    dout(20) << func << " " << mode << " " << pgid << " " << *head
+            << " skipped " << missing << " clone(s) in cache tier" << dendl;
   } else {
-    clog->info() << mode << " " << pgid << " " << head.get()
-                      << " : " << missing << " missing clone(s)";
+    clog->info() << mode << " " << pgid << " " << *head
+                << " : " << missing << " missing clone(s)";
   }
 }
 
-unsigned PrimaryLogPG::process_clones_to(const boost::optional<hobject_t> &head,
-  const boost::optional<SnapSet> &snapset,
+unsigned PrimaryLogPG::process_clones_to(const std::optional<hobject_t> &head,
+  const std::optional<SnapSet> &snapset,
   LogChannelRef clog,
   const spg_t &pgid,
   const char *mode,
   bool allow_incomplete_clones,
-  boost::optional<snapid_t> target,
+  std::optional<snapid_t> target,
   vector<snapid_t>::reverse_iterator *curclone,
   inconsistent_snapset_wrapper &e)
 {
@@ -14441,14 +14442,14 @@ unsigned PrimaryLogPG::process_clones_to(const boost::optional<hobject_t> &head,
   unsigned missing = 0;
 
   // NOTE: clones are in descending order, thus **curclone > target test here
-  hobject_t next_clone(head.get());
+  hobject_t next_clone(*head);
   while(doing_clones(snapset, *curclone) && (!target || **curclone > *target)) {
     ++missing;
     // it is okay to be missing one or more clones in a cache tier.
     // skip higher-numbered clones in the list.
     if (!allow_incomplete_clones) {
       next_clone.snap = **curclone;
-      clog->error() << mode << " " << pgid << " " << head.get()
+      clog->error() << mode << " " << pgid << " " << *head
                         << " : expected clone " << next_clone << " " << missing
                          << " missing";
       ++scrubber.shallow_errors;
@@ -14488,19 +14489,19 @@ unsigned PrimaryLogPG::process_clones_to(const boost::optional<hobject_t> &head,
 void PrimaryLogPG::scrub_snapshot_metadata(
   ScrubMap &scrubmap,
   const map<hobject_t,
-            pair<boost::optional<uint32_t>,
-                 boost::optional<uint32_t>>> &missing_digest)
+            pair<std::optional<uint32_t>,
+                 std::optional<uint32_t>>> &missing_digest)
 {
   dout(10) << __func__ << dendl;
 
   bool repair = state_test(PG_STATE_REPAIR);
   bool deep_scrub = state_test(PG_STATE_DEEP_SCRUB);
   const char *mode = (repair ? "repair": (deep_scrub ? "deep-scrub" : "scrub"));
-  boost::optional<snapid_t> all_clones;   // Unspecified snapid_t or boost::none
+  std::optional<snapid_t> all_clones;   // Unspecified snapid_t or std::nullopt
 
   // traverse in reverse order.
-  boost::optional<hobject_t> head;
-  boost::optional<SnapSet> snapset; // If initialized so will head (above)
+  std::optional<hobject_t> head;
+  std::optional<SnapSet> snapset; // If initialized so will head (above)
   vector<snapid_t>::reverse_iterator curclone; // Defined only if snapset initialized
   unsigned missing = 0;
   inconsistent_snapset_wrapper soid_error, head_error;
@@ -14512,7 +14513,7 @@ void PrimaryLogPG::scrub_snapshot_metadata(
     ceph_assert(!soid.is_snapdir());
     soid_error = inconsistent_snapset_wrapper{soid};
     object_stat_sum_t stat;
-    boost::optional<object_info_t> oi;
+    std::optional<object_info_t> oi;
 
     stat.num_objects++;
 
@@ -14526,7 +14527,7 @@ void PrimaryLogPG::scrub_snapshot_metadata(
 
     // basic checks.
     if (p->second.attrs.count(OI_ATTR) == 0) {
-      oi = boost::none;
+      oi = std::nullopt;
       osd->clog->error() << mode << " " << info.pgid << " " << soid
                        << " : no '" << OI_ATTR << "' attr";
       ++scrubber.shallow_errors;
@@ -14536,9 +14537,9 @@ void PrimaryLogPG::scrub_snapshot_metadata(
       bv.push_back(p->second.attrs[OI_ATTR]);
       try {
        oi = object_info_t(); // Initialize optional<> before decode into it
-       oi.get().decode(bv);
+       oi->decode(bv);
       } catch (buffer::error& e) {
-       oi = boost::none;
+       oi = std::nullopt;
        osd->clog->error() << mode << " " << info.pgid << " " << soid
                << " : can't decode '" << OI_ATTR << "' attr " << e.what();
        ++scrubber.shallow_errors;
@@ -14559,7 +14560,7 @@ void PrimaryLogPG::scrub_snapshot_metadata(
        ++scrubber.shallow_errors;
       }
 
-      dout(20) << mode << "  " << soid << " " << oi.get() << dendl;
+      dout(20) << mode << "  " << soid << " " << *oi << dendl;
 
       // A clone num_bytes will be added later when we have snapset
       if (!soid.is_snap()) {
@@ -14582,12 +14583,12 @@ void PrimaryLogPG::scrub_snapshot_metadata(
 
     // Check for any problems while processing clones
     if (doing_clones(snapset, curclone)) {
-      boost::optional<snapid_t> target;
+      std::optional<snapid_t> target;
       // Expecting an object with snap for current head
       if (soid.has_snapset() || soid.get_head() != head->get_head()) {
 
        dout(10) << __func__ << " " << mode << " " << info.pgid << " new object "
-                << soid << " while processing " << head.get() << dendl;
+                << soid << " while processing " << *head << dendl;
 
         target = all_clones;
       } else {
@@ -14655,7 +14656,7 @@ void PrimaryLogPG::scrub_snapshot_metadata(
        osd->clog->error() << mode << " " << info.pgid << " " << soid
                          << " : no '" << SS_ATTR << "' attr";
         ++scrubber.shallow_errors;
-       snapset = boost::none;
+       snapset = std::nullopt;
        head_error.set_snapset_missing();
       } else {
        bufferlist bl;
@@ -14663,10 +14664,10 @@ void PrimaryLogPG::scrub_snapshot_metadata(
        auto blp = bl.cbegin();
         try {
          snapset = SnapSet(); // Initialize optional<> before decoding into it
-         decode(snapset.get(), blp);
+         decode(*snapset, blp);
           head_error.ss_bl.push_back(p->second.attrs[SS_ATTR]);
         } catch (buffer::error& e) {
-         snapset = boost::none;
+         snapset = std::nullopt;
           osd->clog->error() << mode << " " << info.pgid << " " << soid
                << " : can't decode '" << SS_ATTR << "' attr " << e.what();
          ++scrubber.shallow_errors;
@@ -14679,7 +14680,7 @@ void PrimaryLogPG::scrub_snapshot_metadata(
        curclone = snapset->clones.rbegin();
 
        if (!snapset->clones.empty()) {
-         dout(20) << "  snapset " << snapset.get() << dendl;
+         dout(20) << "  snapset " << *snapset << dendl;
          if (snapset->seq == 0) {
            osd->clog->error() << mode << " " << info.pgid << " " << soid
                               << " : snaps.seq not set";
@@ -14757,7 +14758,7 @@ void PrimaryLogPG::scrub_snapshot_metadata(
 
   if (doing_clones(snapset, curclone)) {
     dout(10) << __func__ << " " << mode << " " << info.pgid
-            << " No more objects while processing " << head.get() << dendl;
+            << " No more objects while processing " << *head << dendl;
 
     missing += process_clones_to(head, snapset, osd->clog, info.pgid, mode,
                      pool.info.allow_incomplete_clones(), all_clones, &curclone,
index 88fc59ec5d808cb2da92acbe1aa7c910fb8a75e7..c8145cc577d5bff00ee2f2274372e8f468a45959 100644 (file)
@@ -244,7 +244,7 @@ public:
     int rval;                   ///< copy-from result
     bool blocking;              ///< whether we are blocking updates
     bool removal;               ///< we are removing the backend object
-    boost::optional<std::function<void()>> on_flush; ///< callback, may be null
+    std::optional<std::function<void()>> on_flush; ///< callback, may be null
     // for chunked object
     map<uint64_t, int> io_results; 
     map<uint64_t, ceph_tid_t> io_tids; 
@@ -444,7 +444,7 @@ public:
 
   void log_operation(
     const vector<pg_log_entry_t> &logv,
-    const boost::optional<pg_hit_set_history_t> &hset_history,
+    const std::optional<pg_hit_set_history_t> &hset_history,
     const eversion_t &trim_to,
     const eversion_t &roll_forward_to,
     bool transaction_applied,
@@ -577,7 +577,7 @@ public:
     list<watch_disconnect_t> watch_disconnects; ///< old watch + send_discon
     list<notify_info_t> notifies;
     struct NotifyAck {
-      boost::optional<uint64_t> watch_cookie;
+      std::optional<uint64_t> watch_cookie;
       uint64_t notify_id;
       bufferlist reply_bl;
       explicit NotifyAck(uint64_t notify_id) : notify_id(notify_id) {}
@@ -602,7 +602,7 @@ public:
 
     PGTransactionUPtr op_t;
     vector<pg_log_entry_t> log;
-    boost::optional<pg_hit_set_history_t> updated_hset_history;
+    std::optional<pg_hit_set_history_t> updated_hset_history;
 
     interval_set<uint64_t> modified_ranges;
     ObjectContextRef obc;
@@ -610,7 +610,7 @@ public:
     ObjectContextRef head_obc;     // if we also update snapset (see trim_object)
 
     // FIXME: we may want to kill this msgr hint off at some point!
-    boost::optional<int> data_off = boost::none;
+    std::optional<int> data_off = std::nullopt;
 
     MOSDOpReply *reply;
 
@@ -777,7 +777,7 @@ public:
     RepGather(
       ObcLockManager &&manager,
       OpRequestRef &&o,
-      boost::optional<std::function<void(void)> > &&on_complete,
+      std::optional<std::function<void(void)> > &&on_complete,
       ceph_tid_t rt,
       eversion_t lc,
       int r) :
@@ -919,7 +919,7 @@ protected:
     int r,
     ObcLockManager &&manager,
     OpRequestRef &&op,
-    boost::optional<std::function<void(void)> > &&on_complete);
+    std::optional<std::function<void(void)> > &&on_complete);
   void remove_repop(RepGather *repop);
 
   OpContextUPtr simple_opc_create(ObjectContextRef obc);
@@ -934,7 +934,7 @@ protected:
   void submit_log_entries(
     const mempool::osd_pglog::list<pg_log_entry_t> &entries,
     ObcLockManager &&manager,
-    boost::optional<std::function<void(void)> > &&on_complete,
+    std::optional<std::function<void(void)> > &&on_complete,
     OpRequestRef op = OpRequestRef(),
     int r = 0);
   struct LogUpdateCtx {
@@ -1359,7 +1359,7 @@ protected:
   int start_flush(
     OpRequestRef op, ObjectContextRef obc,
     bool blocking, hobject_t *pmissing,
-    boost::optional<std::function<void()>> &&on_flush);
+    std::optional<std::function<void()>> &&on_flush);
   void finish_flush(hobject_t oid, ceph_tid_t tid, int r);
   int try_flush_mark_clean(FlushOpRef fop);
   void cancel_flush(FlushOpRef fop, bool requeue, vector<ceph_tid_t> *tids);
@@ -1376,8 +1376,8 @@ protected:
   void scrub_snapshot_metadata(
     ScrubMap &map,
     const std::map<hobject_t,
-                   pair<boost::optional<uint32_t>,
-                        boost::optional<uint32_t>>> &missing_digest) override;
+                   pair<std::optional<uint32_t>,
+                        std::optional<uint32_t>>> &missing_digest) override;
   void _scrub_clear_state() override;
   void _scrub_finish() override;
   object_stat_collection_t scrub_cstat;
@@ -1445,7 +1445,7 @@ protected:
   int do_manifest_flush(OpRequestRef op, ObjectContextRef obc, FlushOpRef manifest_fop,
                        uint64_t start_offset, bool block);
   int start_manifest_flush(OpRequestRef op, ObjectContextRef obc, bool blocking,
-                          boost::optional<std::function<void()>> &&on_flush);
+                          std::optional<std::function<void()>> &&on_flush);
   void finish_manifest_flush(hobject_t oid, ceph_tid_t tid, int r, ObjectContextRef obc, 
                             uint64_t last_offset);
   void handle_manifest_flush(hobject_t oid, ceph_tid_t tid, int r,
@@ -1522,19 +1522,19 @@ private:
     return  pri > 0 ? pri : cct->_conf->osd_recovery_op_priority;
   }
   void log_missing(unsigned missing,
-                       const boost::optional<hobject_t> &head,
+                       const std::optional<hobject_t> &head,
                        LogChannelRef clog,
                        const spg_t &pgid,
                        const char *func,
                        const char *mode,
                        bool allow_incomplete_clones);
-  unsigned process_clones_to(const boost::optional<hobject_t> &head,
-    const boost::optional<SnapSet> &snapset,
+  unsigned process_clones_to(const std::optional<hobject_t> &head,
+    const std::optional<SnapSet> &snapset,
     LogChannelRef clog,
     const spg_t &pgid,
     const char *mode,
     bool allow_incomplete_clones,
-    boost::optional<snapid_t> target,
+    std::optional<snapid_t> target,
     vector<snapid_t>::reverse_iterator *curclone,
     inconsistent_snapset_wrapper &snap_error);
 
index 8063e0a9e132a139c1c4941ea631206582694413..57db2c3848025e7171c6bf201ba5a3d5d0327621 100644 (file)
@@ -428,7 +428,7 @@ void ReplicatedBackend::submit_transaction(
   const eversion_t &trim_to,
   const eversion_t &roll_forward_to,
   const vector<pg_log_entry_t> &_log_entries,
-  boost::optional<pg_hit_set_history_t> &hset_history,
+  std::optional<pg_hit_set_history_t> &hset_history,
   Context *on_all_commit,
   ceph_tid_t tid,
   osd_reqid_t reqid,
@@ -900,7 +900,7 @@ Message * ReplicatedBackend::generate_subop(
   hobject_t new_temp_oid,
   hobject_t discard_temp_oid,
   const bufferlist &log_entries,
-  boost::optional<pg_hit_set_history_t> &hset_hist,
+  std::optional<pg_hit_set_history_t> &hset_hist,
   ObjectStore::Transaction &op_t,
   pg_shard_t peer,
   const pg_info_t &pinfo)
@@ -950,7 +950,7 @@ void ReplicatedBackend::issue_op(
   hobject_t new_temp_oid,
   hobject_t discard_temp_oid,
   const vector<pg_log_entry_t> &log_entries,
-  boost::optional<pg_hit_set_history_t> &hset_hist,
+  std::optional<pg_hit_set_history_t> &hset_hist,
   InProgressOp *op,
   ObjectStore::Transaction &op_t)
 {
index 8f447495a4ed106d7b09136c2694c22675fc1023..ec536450987b6a1ddff2cabff1fb89e0b49042e5 100644 (file)
@@ -360,7 +360,7 @@ public:
     const eversion_t &trim_to,
     const eversion_t &roll_forward_to,
     const vector<pg_log_entry_t> &log_entries,
-    boost::optional<pg_hit_set_history_t> &hset_history,
+    std::optional<pg_hit_set_history_t> &hset_history,
     Context *on_all_commit,
     ceph_tid_t tid,
     osd_reqid_t reqid,
@@ -378,7 +378,7 @@ private:
     hobject_t new_temp_oid,
     hobject_t discard_temp_oid,
     const bufferlist &log_entries,
-    boost::optional<pg_hit_set_history_t> &hset_history,
+    std::optional<pg_hit_set_history_t> &hset_history,
     ObjectStore::Transaction &op_t,
     pg_shard_t peer,
     const pg_info_t &pinfo);
@@ -392,7 +392,7 @@ private:
     hobject_t new_temp_oid,
     hobject_t discard_temp_oid,
     const vector<pg_log_entry_t> &log_entries,
-    boost::optional<pg_hit_set_history_t> &hset_history,
+    std::optional<pg_hit_set_history_t> &hset_history,
     InProgressOp *op,
     ObjectStore::Transaction &op_t);
   void op_commit(InProgressOpRef& op);
index d35c2cbe8d5c4065ccc7935961773bec3b806369..22416e064f46c5e2e35485b024d675a9c9903e4f 100644 (file)
@@ -88,7 +88,7 @@ namespace ceph {
        // get_header returns ceph_msg_header type, ceph_msg_header
        // stores type as unsigned little endian, so be sure to
        // convert to CPU byte ordering
-       boost::optional<OpRequestRef> op_ref_maybe = op.maybe_get_op();
+       std::optional<OpRequestRef> op_ref_maybe = op.maybe_get_op();
        ceph_assert(op_ref_maybe);
        __le16 mtype_le = (*op_ref_maybe)->get_req()->get_header().type;
        __u16 mtype = le16_to_cpu(mtype_le);
index 5d329b3a40cdd7a55d2973a575c47e112b53ea08..897a9034b815e87dea8461a7edb3d734a75dc7ff 100644 (file)
@@ -1028,9 +1028,9 @@ std::string pg_state_string(uint64_t state)
   return ret;
 }
 
-boost::optional<uint64_t> pg_string_state(const std::string& state)
+std::optional<uint64_t> pg_string_state(const std::string& state)
 {
-  boost::optional<uint64_t> type;
+  std::optional<uint64_t> type;
   if (state == "active")
     type = PG_STATE_ACTIVE;
   else if (state == "clean")
@@ -1096,7 +1096,7 @@ boost::optional<uint64_t> pg_string_state(const std::string& state)
   else if (state == "unknown")
     type = 0;
   else
-    type = boost::none;
+    type = std::nullopt;
   return type;
 }
 
@@ -4121,7 +4121,7 @@ void ObjectModDesc::visit(Visitor *visitor) const
        break;
       }
       case SETATTRS: {
-       map<string, boost::optional<ceph::buffer::list> > attrs;
+       map<string, std::optional<ceph::buffer::list> > attrs;
        decode(attrs, bp);
        visitor->setattrs(attrs);
        break;
@@ -4175,7 +4175,7 @@ struct DumpVisitor : public ObjectModDesc::Visitor {
     f->dump_unsigned("old_size", old_size);
     f->close_section();
   }
-  void setattrs(map<string, boost::optional<ceph::buffer::list> > &attrs) override {
+  void setattrs(map<string, std::optional<ceph::buffer::list> > &attrs) override {
     f->open_object_section("op");
     f->dump_string("code", "SETATTRS");
     f->open_array_section("attrs");
@@ -4235,7 +4235,7 @@ void ObjectModDesc::dump(Formatter *f) const
 
 void ObjectModDesc::generate_test_instances(list<ObjectModDesc*>& o)
 {
-  map<string, boost::optional<ceph::buffer::list> > attrs;
+  map<string, std::optional<ceph::buffer::list> > attrs;
   attrs[OI_ATTR];
   attrs[SS_ATTR];
   attrs["asdf"];
index f856e63101ed0f07bd3f3bad2b69b333a59d7909..5aeb0443d2791c9268535a7d4538a1575707e3ac 100644 (file)
@@ -979,7 +979,7 @@ WRITE_CLASS_ENCODER_FEATURES(objectstore_perf_stat_t)
 
 std::string pg_state_string(uint64_t state);
 std::string pg_vector_string(const std::vector<int32_t> &a);
-boost::optional<uint64_t> pg_string_state(const std::string& state);
+std::optional<uint64_t> pg_string_state(const std::string& state);
 
 
 /*
@@ -3586,7 +3586,7 @@ public:
   class Visitor {
   public:
     virtual void append(uint64_t old_offset) {}
-    virtual void setattrs(std::map<std::string, boost::optional<ceph::buffer::list>> &attrs) {}
+    virtual void setattrs(std::map<std::string, std::optional<ceph::buffer::list>> &attrs) {}
     virtual void rmobject(version_t old_version) {}
     /**
      * Used to support the unfound_lost_delete log event: if the stashed
@@ -3655,7 +3655,7 @@ public:
     encode(old_size, bl);
     ENCODE_FINISH(bl);
   }
-  void setattrs(std::map<std::string, boost::optional<ceph::buffer::list>> &old_attrs) {
+  void setattrs(std::map<std::string, std::optional<ceph::buffer::list>> &old_attrs) {
     if (!can_local_rollback || rollback_info_completed)
       return;
     ENCODE_START(1, 1, bl);