]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
src/: use make_message<Foo> instead of Foo::create()
authorKefu Chai <kchai@redhat.com>
Sun, 14 Apr 2019 07:01:57 +0000 (15:01 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 17 Apr 2019 22:59:42 +0000 (06:59 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
175 files changed:
src/client/Client.cc
src/common/CommandTable.h
src/crimson/osd/heartbeat.cc
src/crimson/osd/osd.cc
src/crimson/osd/pg.cc
src/mds/Beacon.cc
src/mds/CInode.cc
src/mds/Locker.cc
src/mds/MDBalancer.cc
src/mds/MDCache.cc
src/mds/MDSDaemon.cc
src/mds/MDSRank.cc
src/mds/MDSTableClient.cc
src/mds/MDSTableServer.cc
src/mds/Migrator.cc
src/mds/Server.cc
src/mds/SnapClient.cc
src/mds/SnapServer.cc
src/mds/StrayManager.cc
src/messages/MAuth.h
src/messages/MAuthReply.h
src/messages/MBackfillReserve.h
src/messages/MCacheExpire.h
src/messages/MClientCapRelease.h
src/messages/MClientCaps.h
src/messages/MClientLease.h
src/messages/MClientQuota.h
src/messages/MClientReclaim.h
src/messages/MClientReclaimReply.h
src/messages/MClientReconnect.h
src/messages/MClientReply.h
src/messages/MClientRequest.h
src/messages/MClientRequestForward.h
src/messages/MClientSession.h
src/messages/MClientSnap.h
src/messages/MCommand.h
src/messages/MCommandReply.h
src/messages/MConfig.h
src/messages/MDentryLink.h
src/messages/MDentryUnlink.h
src/messages/MDirUpdate.h
src/messages/MDiscover.h
src/messages/MDiscoverReply.h
src/messages/MExportCaps.h
src/messages/MExportCapsAck.h
src/messages/MExportDir.h
src/messages/MExportDirAck.h
src/messages/MExportDirCancel.h
src/messages/MExportDirDiscover.h
src/messages/MExportDirDiscoverAck.h
src/messages/MExportDirFinish.h
src/messages/MExportDirNotify.h
src/messages/MExportDirNotifyAck.h
src/messages/MExportDirPrep.h
src/messages/MExportDirPrepAck.h
src/messages/MFSMap.h
src/messages/MFSMapUser.h
src/messages/MForward.h
src/messages/MGatherCaps.h
src/messages/MGenericMessage.h
src/messages/MGetConfig.h
src/messages/MGetPoolStats.h
src/messages/MGetPoolStatsReply.h
src/messages/MHeartbeat.h
src/messages/MInodeFileCaps.h
src/messages/MLock.h
src/messages/MLog.h
src/messages/MLogAck.h
src/messages/MMDSBeacon.h
src/messages/MMDSCacheRejoin.h
src/messages/MMDSFindIno.h
src/messages/MMDSFindInoReply.h
src/messages/MMDSFragmentNotify.h
src/messages/MMDSFragmentNotifyAck.h
src/messages/MMDSLoadTargets.h
src/messages/MMDSMap.h
src/messages/MMDSOpenIno.h
src/messages/MMDSOpenInoReply.h
src/messages/MMDSResolve.h
src/messages/MMDSResolveAck.h
src/messages/MMDSSlaveRequest.h
src/messages/MMDSSnapUpdate.h
src/messages/MMDSTableRequest.h
src/messages/MMgrBeacon.h
src/messages/MMgrClose.h
src/messages/MMgrConfigure.h
src/messages/MMgrDigest.h
src/messages/MMgrMap.h
src/messages/MMgrOpen.h
src/messages/MMgrReport.h
src/messages/MMonCommand.h
src/messages/MMonCommandAck.h
src/messages/MMonElection.h
src/messages/MMonGetMap.h
src/messages/MMonGetOSDMap.h
src/messages/MMonGetVersion.h
src/messages/MMonGetVersionReply.h
src/messages/MMonGlobalID.h
src/messages/MMonHealth.h
src/messages/MMonHealthChecks.h
src/messages/MMonJoin.h
src/messages/MMonMap.h
src/messages/MMonMetadata.h
src/messages/MMonMgrReport.h
src/messages/MMonPaxos.h
src/messages/MMonProbe.h
src/messages/MMonScrub.h
src/messages/MMonSubscribe.h
src/messages/MMonSubscribeAck.h
src/messages/MMonSync.h
src/messages/MOSDAlive.h
src/messages/MOSDBackoff.h
src/messages/MOSDBeacon.h
src/messages/MOSDBoot.h
src/messages/MOSDECSubOpRead.h
src/messages/MOSDECSubOpReadReply.h
src/messages/MOSDECSubOpWrite.h
src/messages/MOSDECSubOpWriteReply.h
src/messages/MOSDFailure.h
src/messages/MOSDForceRecovery.h
src/messages/MOSDFull.h
src/messages/MOSDMap.h
src/messages/MOSDMarkMeDown.h
src/messages/MOSDOp.h
src/messages/MOSDOpReply.h
src/messages/MOSDPGBackfill.h
src/messages/MOSDPGBackfillRemove.h
src/messages/MOSDPGCreate.h
src/messages/MOSDPGCreate2.h
src/messages/MOSDPGCreated.h
src/messages/MOSDPGInfo.h
src/messages/MOSDPGLog.h
src/messages/MOSDPGNotify.h
src/messages/MOSDPGPull.h
src/messages/MOSDPGPush.h
src/messages/MOSDPGPushReply.h
src/messages/MOSDPGQuery.h
src/messages/MOSDPGReadyToMerge.h
src/messages/MOSDPGRecoveryDelete.h
src/messages/MOSDPGRecoveryDeleteReply.h
src/messages/MOSDPGRemove.h
src/messages/MOSDPGScan.h
src/messages/MOSDPGTemp.h
src/messages/MOSDPGTrim.h
src/messages/MOSDPGUpdateLogMissing.h
src/messages/MOSDPGUpdateLogMissingReply.h
src/messages/MOSDPing.h
src/messages/MOSDRepOp.h
src/messages/MOSDRepOpReply.h
src/messages/MOSDRepScrub.h
src/messages/MOSDRepScrubMap.h
src/messages/MOSDScrub.h
src/messages/MOSDScrub2.h
src/messages/MOSDScrubReserve.h
src/messages/MPGStats.h
src/messages/MPGStatsAck.h
src/messages/MPing.h
src/messages/MPoolOp.h
src/messages/MPoolOpReply.h
src/messages/MRecoveryReserve.h
src/messages/MRemoveSnaps.h
src/messages/MRoute.h
src/messages/MServiceMap.h
src/messages/MStatfs.h
src/messages/MStatfsReply.h
src/messages/MTimeCheck.h
src/messages/MTimeCheck2.h
src/messages/MWatchNotify.h
src/mgr/DaemonServer.cc
src/mgr/MgrClient.cc
src/mon/MDSMonitor.cc
src/mon/MgrMonitor.cc
src/msg/Message.cc
src/msg/Message.h
src/tools/ceph-dencoder/ceph_dencoder.cc

index fad1a9a11e00a36760b8427244be46326761e9c4..082ea7173277f725933a9a93fe3aae93376b5dae 100644 (file)
@@ -2055,7 +2055,7 @@ MetaSession *Client::_open_mds_session(mds_rank_t mds)
     }
   }
 
-  auto m = MClientSession::create(CEPH_SESSION_REQUEST_OPEN);
+  auto m = make_message<MClientSession>(CEPH_SESSION_REQUEST_OPEN);
   m->metadata = metadata;
   m->supported_features = feature_bitset_t(CEPHFS_FEATURES_CLIENT_SUPPORTED);
   session->con->send_message2(std::move(m));
@@ -2066,7 +2066,7 @@ void Client::_close_mds_session(MetaSession *s)
 {
   ldout(cct, 2) << __func__ << " mds." << s->mds_num << " seq " << s->seq << dendl;
   s->state = MetaSession::STATE_CLOSING;
-  s->con->send_message2(MClientSession::create(CEPH_SESSION_REQUEST_CLOSE, s->seq));
+  s->con->send_message2(make_message<MClientSession>(CEPH_SESSION_REQUEST_CLOSE, s->seq));
 }
 
 void Client::_closed_mds_session(MetaSession *s)
@@ -2148,7 +2148,7 @@ void Client::handle_client_session(const MConstRef<MClientSession>& m)
     if (auto& m = session->release; m) {
       session->con->send_message2(std::move(m));
     }
-    session->con->send_message2(MClientSession::create(CEPH_SESSION_FLUSHMSG_ACK, m->get_seq()));
+    session->con->send_message2(make_message<MClientSession>(CEPH_SESSION_FLUSHMSG_ACK, m->get_seq()));
     break;
 
   case CEPH_SESSION_FORCE_RO:
@@ -2251,7 +2251,7 @@ void Client::send_request(MetaRequest *request, MetaSession *session,
 
 ref_t<MClientRequest> Client::build_client_request(MetaRequest *request)
 {
-  auto req = MClientRequest::create(request->get_op());
+  auto req = make_message<MClientRequest>(request->get_op());
   req->set_tid(request->tid);
   req->set_stamp(request->op_stamp);
   memcpy(&req->head, &request->head, sizeof(ceph_mds_request_head));
@@ -2783,7 +2783,7 @@ void Client::send_reconnect(MetaSession *session)
 
   early_kick_flushing_caps(session);
 
-  auto m = MClientReconnect::create();
+  auto m = make_message<MClientReconnect>();
   bool allow_multi = session->mds_features.test(CEPHFS_FEATURE_MULTI_RECONNECT);
 
   // i have an open session.
@@ -2799,7 +2799,7 @@ void Client::send_reconnect(MetaSession *session)
        m->mark_more();
        session->con->send_message2(std::move(m));
 
-       m = MClientReconnect::create();
+       m = make_message<MClientReconnect>();
       }
 
       Cap &cap = it->second;
@@ -2965,7 +2965,7 @@ void Client::got_mds_push(MetaSession *s)
   s->seq++;
   ldout(cct, 10) << " mds." << s->mds_num << " seq now " << s->seq << dendl;
   if (s->state == MetaSession::STATE_CLOSING) {
-    s->con->send_message2(MClientSession::create(CEPH_SESSION_REQUEST_CLOSE, s->seq));
+    s->con->send_message2(make_message<MClientSession>(CEPH_SESSION_REQUEST_CLOSE, s->seq));
   }
 }
 
@@ -3005,7 +3005,9 @@ void Client::handle_lease(const MConstRef<MClientLease>& m)
 
  revoke:
   {
-    auto reply = MClientLease::create(CEPH_MDS_LEASE_RELEASE, seq, m->get_mask(), m->get_ino(), m->get_first(), m->get_last(), m->dname);
+    auto reply = make_message<MClientLease>(CEPH_MDS_LEASE_RELEASE, seq,
+                                           m->get_mask(), m->get_ino(),
+                                           m->get_first(), m->get_last(), m->dname);
     m->get_connection()->send_message2(std::move(reply));
   }
 }
@@ -3359,7 +3361,7 @@ void Client::send_cap(Inode *in, MetaSession *session, Cap *cap,
   if (flush)
     follows = in->snaprealm->get_snap_context().seq;
   
-  auto m = MClientCaps::create(op,
+  auto m = make_message<MClientCaps>(op,
                                   in->ino,
                                   0,
                                   cap->cap_id, cap->seq,
@@ -3728,7 +3730,7 @@ void Client::flush_snaps(Inode *in, bool all_again)
       session->flushing_caps_tids.insert(capsnap.flush_tid);
     }
 
-    auto m = MClientCaps::create(CEPH_CAP_OP_FLUSHSNAP, in->ino, in->snaprealm->ino, 0, mseq,
+    auto m = make_message<MClientCaps>(CEPH_CAP_OP_FLUSHSNAP, in->ino, in->snaprealm->ino, 0, mseq,
                                     cap_epoch_barrier);
     m->caller_uid = capsnap.cap_dirtier_uid;
     m->caller_gid = capsnap.cap_dirtier_gid;
@@ -5951,7 +5953,7 @@ void Client::flush_mdlog(MetaSession *session)
   // will crash if they see an unknown CEPH_SESSION_* value in this msg.
   const uint64_t features = session->con->get_features();
   if (HAVE_FEATURE(features, SERVER_LUMINOUS)) {
-    auto m = MClientSession::create(CEPH_SESSION_REQUEST_FLUSH_MDLOG);
+    auto m = make_message<MClientSession>(CEPH_SESSION_REQUEST_FLUSH_MDLOG);
     session->con->send_message2(std::move(m));
   }
 }
@@ -6219,7 +6221,7 @@ void Client::renew_caps(MetaSession *session)
   ldout(cct, 10) << "renew_caps mds." << session->mds_num << dendl;
   session->last_cap_renew_request = ceph_clock_now();
   uint64_t seq = ++session->cap_renew_seq;
-  session->con->send_message2(MClientSession::create(CEPH_SESSION_REQUEST_RENEWCAPS, seq));
+  session->con->send_message2(make_message<MClientSession>(CEPH_SESSION_REQUEST_RENEWCAPS, seq));
 }
 
 
@@ -14369,7 +14371,7 @@ int Client::start_reclaim(const std::string& uuid, unsigned flags,
     if (session->reclaim_state == MetaSession::RECLAIM_NULL ||
        session->reclaim_state == MetaSession::RECLAIMING) {
       session->reclaim_state = MetaSession::RECLAIMING;
-      auto m = MClientReclaim::create(uuid, flags);
+      auto m = make_message<MClientReclaim>(uuid, flags);
       session->con->send_message2(std::move(m));
       wait_on_list(waiting_for_reclaim);
     } else if (session->reclaim_state == MetaSession::RECLAIM_FAIL) {
@@ -14421,7 +14423,7 @@ void Client::finish_reclaim()
 
   for (auto &p : mds_sessions) {
     p.second.reclaim_state = MetaSession::RECLAIM_NULL;
-    auto m = MClientReclaim::create("", MClientReclaim::FLAG_FINISH);
+    auto m = make_message<MClientReclaim>("", MClientReclaim::FLAG_FINISH);
     p.second.con->send_message2(std::move(m));
   }
 
index c269773efa8ca9c3285c7f761e425e331ffdc009..3c16d8d4054527a404c1e93feec01bf19c360ae2 100644 (file)
@@ -31,7 +31,7 @@ class CommandOp
 
   MCommand::ref get_message(const uuid_d &fsid) const
   {
-    auto m = MCommand::create(fsid);
+    auto m = make_message<MCommand>(fsid);
     m->cmd = cmd;
     m->set_data(inbl);
     m->set_tid(tid);
index a44fd7e79a8f9904f39404fbce2fe63638978102..f2c203a23a0b17bc484e530a872db330ab00f1f1 100644 (file)
@@ -20,12 +20,6 @@ namespace {
   seastar::logger& logger() {
     return ceph::get_logger(ceph_subsys_osd);
   }
-
-  template<typename Message, typename... Args>
-  Ref<Message> make_message(Args&&... args)
-  {
-    return {new Message{std::forward<Args>(args)...}, false};
-  }
 }
 
 Heartbeat::Heartbeat(const OSDMapService& service,
index cae846471b6a953de1c76bfb43498b4b7f2026b3..124fed81d1e3afdc2323e8d977727cf8f77c5f82 100644 (file)
@@ -37,12 +37,6 @@ namespace {
   seastar::logger& logger() {
     return ceph::get_logger(ceph_subsys_osd);
   }
-
-  template<typename Message, typename... Args>
-  Ref<Message> make_message(Args&&... args)
-  {
-    return {new Message{std::forward<Args>(args)...}, false};
-  }
   static constexpr int TICK_INTERVAL = 1;
 }
 
index cb87cc03ca52ef4ed6eff764370cf97f46227f66..dffb98d1fc7b4927eb93150f03dfdc02139dfe0c 100644 (file)
@@ -36,11 +36,6 @@ namespace {
   seastar::logger& logger() {
     return ceph::get_logger(ceph_subsys_osd);
   }
-  template<typename Message, typename... Args>
-  Ref<Message> make_message(Args&&... args)
-  {
-    return {new Message{std::forward<Args>(args)...}, false};
-  }
 }
 
 using recovery::AdvMap;
index de1284ba5dc564aa14ba55eabefda7cb6e3fb9f3..b1aac5855c3459182c18c14fea3f69e10ec631e3 100644 (file)
@@ -197,7 +197,7 @@ bool Beacon::_send()
 
   ceph_assert(want_state != MDSMap::STATE_NULL);
   
-  auto beacon = MMDSBeacon::create(
+  auto beacon = make_message<MMDSBeacon>(
       monc->get_fsid(), mds_gid_t(monc->get_global_id()),
       name,
       epoch,
index d16d29f334473cb843dc9eff2e4e52bb65bbc77e..95356aec54ddb40b968adaa907a1f5d21139e3a6 100644 (file)
@@ -2057,7 +2057,7 @@ void CInode::finish_scatter_update(ScatterLock *lock, CDir *dir,
       mempool_inode *pi = get_projected_inode();
       fnode_t *pf = dir->project_fnode();
 
-      std::string_view ename = 0;
+      std::string_view ename;
       switch (lock->get_type()) {
       case CEPH_LOCK_IFILE:
        pf->fragstat.version = pi->dirstat.version;
index 014d8d7f4aed3f48dec85a6db4ced92099a7726f..a4776c00fa3bf342dd73f9070d81cdc3a033bfd7 100644 (file)
@@ -136,7 +136,7 @@ void Locker::send_lock_message(SimpleLock *lock, int msg)
     if (mds->is_cluster_degraded() &&
        mds->mdsmap->get_state(it.first) < MDSMap::STATE_REJOIN)
       continue;
-    auto m = MLock::create(lock, msg, mds->get_nodeid());
+    auto m = make_message<MLock>(lock, msg, mds->get_nodeid());
     mds->send_message_mds(m, it.first);
   }
 }
@@ -147,7 +147,7 @@ void Locker::send_lock_message(SimpleLock *lock, int msg, const bufferlist &data
     if (mds->is_cluster_degraded() &&
        mds->mdsmap->get_state(it.first) < MDSMap::STATE_REJOIN)
       continue;
-    auto m = MLock::create(lock, msg, mds->get_nodeid());
+    auto m = make_message<MLock>(lock, msg, mds->get_nodeid());
     m->set_data(data);
     mds->send_message_mds(m, it.first);
   }
@@ -431,7 +431,8 @@ bool Locker::acquire_locks(MDRequestRef& mdr,
        return false;
       }
       
-      auto req = MMDSSlaveRequest::create(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_AUTHPIN);
+      auto req = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt,
+                                               MMDSSlaveRequest::OP_AUTHPIN);
       for (set<MDSCacheObject*>::iterator q = p->second.begin();
           q != p->second.end();
           ++q) {
@@ -707,7 +708,8 @@ void Locker::_drop_locks(MutationImpl *mut, set<CInode*> *pneed_issue,
     if (!mds->is_cluster_degraded() ||
        mds->mdsmap->get_state(*p) >= MDSMap::STATE_REJOIN) {
       dout(10) << "_drop_non_rdlocks dropping remote locks on mds." << *p << dendl;
-      auto slavereq = MMDSSlaveRequest::create(mut->reqid, mut->attempt, MMDSSlaveRequest::OP_DROPLOCKS);
+      auto slavereq = make_message<MMDSSlaveRequest>(mut->reqid, mut->attempt,
+                                                    MMDSSlaveRequest::OP_DROPLOCKS);
       mds->send_message_mds(slavereq, *p);
     }
   }
@@ -885,12 +887,12 @@ void Locker::eval_gather(SimpleLock *lock, bool first, bool *pneed_issue, MDSCon
          mds->mdsmap->get_state(auth) >= MDSMap::STATE_REJOIN) {
        switch (lock->get_state()) {
        case LOCK_SYNC_LOCK:
-         mds->send_message_mds(MLock::create(lock, LOCK_AC_LOCKACK, mds->get_nodeid()), auth);
+         mds->send_message_mds(make_message<MLock>(lock, LOCK_AC_LOCKACK, mds->get_nodeid()), auth);
          break;
 
        case LOCK_MIX_SYNC:
          {
-           auto reply = MLock::create(lock, LOCK_AC_SYNCACK, mds->get_nodeid());
+           auto reply = make_message<MLock>(lock, LOCK_AC_SYNCACK, mds->get_nodeid());
            lock->encode_locked_state(reply->get_data());
            mds->send_message_mds(reply, auth);
            next = LOCK_MIX_SYNC2;
@@ -908,7 +910,7 @@ void Locker::eval_gather(SimpleLock *lock, bool first, bool *pneed_issue, MDSCon
          
        case LOCK_SYNC_MIX:
          { 
-           auto reply = MLock::create(lock, LOCK_AC_MIXACK, mds->get_nodeid());
+           auto reply = make_message<MLock>(lock, LOCK_AC_MIXACK, mds->get_nodeid());
            mds->send_message_mds(reply, auth);
            next = LOCK_SYNC_MIX2;
          }
@@ -918,7 +920,7 @@ void Locker::eval_gather(SimpleLock *lock, bool first, bool *pneed_issue, MDSCon
          {
            bufferlist data;
            lock->encode_locked_state(data);
-           mds->send_message_mds(MLock::create(lock, LOCK_AC_LOCKACK, mds->get_nodeid(), data), auth);
+           mds->send_message_mds(make_message<MLock>(lock, LOCK_AC_LOCKACK, mds->get_nodeid(), data), auth);
            (static_cast<ScatterLock *>(lock))->start_flush();
            // we'll get an AC_LOCKFLUSHED to complete
          }
@@ -1281,7 +1283,7 @@ bool Locker::_rdlock_kick(SimpleLock *lock, bool as_anon)
          mds->mdsmap->is_clientreplay_or_active_or_stopping(auth)) {
        dout(10) << "requesting rdlock from auth on "
                 << *lock << " on " << *lock->get_parent() << dendl;
-       mds->send_message_mds(MLock::create(lock, LOCK_AC_REQRDLOCK, mds->get_nodeid()), auth);
+       mds->send_message_mds(make_message<MLock>(lock, LOCK_AC_REQRDLOCK, mds->get_nodeid()), auth);
       }
       return false;
     }
@@ -1504,7 +1506,7 @@ bool Locker::wrlock_start(const MutationImpl::LockOp &op, MDRequestRef& mut, boo
          mds->mdsmap->is_clientreplay_or_active_or_stopping(auth)) {
        dout(10) << "requesting scatter from auth on "
                 << *lock << " on " << *lock->get_parent() << dendl;
-       mds->send_message_mds(MLock::create(lock, LOCK_AC_REQSCATTER, mds->get_nodeid()), auth);
+       mds->send_message_mds(make_message<MLock>(lock, LOCK_AC_REQSCATTER, mds->get_nodeid()), auth);
       }
       break;
     }
@@ -1563,7 +1565,7 @@ void Locker::remote_wrlock_start(SimpleLock *lock, mds_rank_t target, MDRequestR
   // send lock request
   mut->start_locking(lock, target);
   mut->more()->slaves.insert(target);
-  auto r = MMDSSlaveRequest::create(mut->reqid, mut->attempt, MMDSSlaveRequest::OP_WRLOCK);
+  auto r = make_message<MMDSSlaveRequest>(mut->reqid, mut->attempt, MMDSSlaveRequest::OP_WRLOCK);
   r->set_lock_type(lock->get_type());
   lock->get_parent()->set_object_info(r->get_object_info());
   mds->send_message_mds(r, target);
@@ -1587,7 +1589,7 @@ void Locker::remote_wrlock_finish(const MutationImpl::lock_iterator& it, Mutatio
          << " " << *lock->get_parent()  << dendl;
   if (!mds->is_cluster_degraded() ||
       mds->mdsmap->get_state(target) >= MDSMap::STATE_REJOIN) {
-    auto slavereq = MMDSSlaveRequest::create(mut->reqid, mut->attempt, MMDSSlaveRequest::OP_UNWRLOCK);
+    auto slavereq = make_message<MMDSSlaveRequest>(mut->reqid, mut->attempt, MMDSSlaveRequest::OP_UNWRLOCK);
     slavereq->set_lock_type(lock->get_type());
     lock->get_parent()->set_object_info(slavereq->get_object_info());
     mds->send_message_mds(slavereq, target);
@@ -1671,7 +1673,7 @@ bool Locker::xlock_start(SimpleLock *lock, MDRequestRef& mut)
     // send lock request
     mut->more()->slaves.insert(auth);
     mut->start_locking(lock, auth);
-    auto r = MMDSSlaveRequest::create(mut->reqid, mut->attempt, MMDSSlaveRequest::OP_XLOCK);
+    auto r = make_message<MMDSSlaveRequest>(mut->reqid, mut->attempt, MMDSSlaveRequest::OP_XLOCK);
     r->set_lock_type(lock->get_type());
     lock->get_parent()->set_object_info(r->get_object_info());
     mds->send_message_mds(r, auth);
@@ -1739,7 +1741,7 @@ void Locker::xlock_finish(const MutationImpl::lock_iterator& it, MutationImpl *m
     mds_rank_t auth = lock->get_parent()->authority().first;
     if (!mds->is_cluster_degraded() ||
        mds->mdsmap->get_state(auth) >= MDSMap::STATE_REJOIN) {
-      auto slavereq = MMDSSlaveRequest::create(mut->reqid, mut->attempt, MMDSSlaveRequest::OP_UNXLOCK);
+      auto slavereq = make_message<MMDSSlaveRequest>(mut->reqid, mut->attempt, MMDSSlaveRequest::OP_UNXLOCK);
       slavereq->set_lock_type(lock->get_type());
       lock->get_parent()->set_object_info(slavereq->get_object_info());
       mds->send_message_mds(slavereq, auth);
@@ -2072,7 +2074,7 @@ bool Locker::issue_caps(CInode *in, Capability *only_cap)
                cap->reset_num_revoke_warnings();
        }
 
-       auto m = MClientCaps::create(op, in->ino(),
+       auto m = make_message<MClientCaps>(op, in->ino(),
                                            in->find_snaprealm()->inode->ino(),
                                            cap->get_cap_id(),
                                            cap->get_last_seq(),
@@ -2098,7 +2100,7 @@ void Locker::issue_truncate(CInode *in)
   
   for (auto &p : in->client_caps) {
     Capability *cap = &p.second;
-    auto m = MClientCaps::create(CEPH_CAP_OP_TRUNC,
+    auto m = make_message<MClientCaps>(CEPH_CAP_OP_TRUNC,
                                        in->ino(),
                                        in->find_snaprealm()->inode->ino(),
                                        cap->get_cap_id(), cap->get_last_seq(),
@@ -2252,7 +2254,7 @@ void Locker::request_inode_file_caps(CInode *in)
 
     if (!mds->is_cluster_degraded() ||
        mds->mdsmap->is_clientreplay_or_active_or_stopping(auth))
-      mds->send_message_mds(MInodeFileCaps::create(in->ino(), in->replica_caps_wanted), auth);
+      mds->send_message_mds(make_message<MInodeFileCaps>(in->ino(), in->replica_caps_wanted), auth);
   }
 }
 
@@ -2499,7 +2501,7 @@ void Locker::share_inode_max_size(CInode *in, Capability *only_cap)
     if (cap->pending() & (CEPH_CAP_FILE_WR|CEPH_CAP_FILE_BUFFER)) {
       dout(10) << "share_inode_max_size with client." << client << dendl;
       cap->inc_last_seq();
-      auto m = MClientCaps::create(CEPH_CAP_OP_GRANT,
+      auto m = make_message<MClientCaps>(CEPH_CAP_OP_GRANT,
                                          in->ino(),
                                          in->find_snaprealm()->inode->ino(),
                                          cap->get_cap_id(),
@@ -2699,9 +2701,9 @@ void Locker::handle_client_caps(const cref_t<MClientCaps> &m)
            << " for client." << client << dendl;
     ref_t<MClientCaps> ack;
     if (op == CEPH_CAP_OP_FLUSHSNAP) {
-      ack = MClientCaps::create(CEPH_CAP_OP_FLUSHSNAP_ACK, m->get_ino(), 0, 0, 0, 0, 0, dirty, 0, mds->get_osd_epoch_barrier());
+      ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSHSNAP_ACK, m->get_ino(), 0, 0, 0, 0, 0, dirty, 0, mds->get_osd_epoch_barrier());
     } else {
-      ack = MClientCaps::create(CEPH_CAP_OP_FLUSH_ACK, m->get_ino(), 0, m->get_cap_id(), m->get_seq(), m->get_caps(), 0, dirty, 0, mds->get_osd_epoch_barrier());
+      ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSH_ACK, m->get_ino(), 0, m->get_cap_id(), m->get_seq(), m->get_caps(), 0, dirty, 0, mds->get_osd_epoch_barrier());
     }
     ack->set_snap_follows(follows);
     ack->set_client_tid(m->get_client_tid());
@@ -2823,7 +2825,7 @@ void Locker::handle_client_caps(const cref_t<MClientCaps> &m)
     // case we get a dup response, so whatever.)
     ref_t<MClientCaps> ack;
     if (dirty) {
-      ack = MClientCaps::create(CEPH_CAP_OP_FLUSHSNAP_ACK, in->ino(), 0, 0, 0, 0, 0, dirty, 0, mds->get_osd_epoch_barrier());
+      ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSHSNAP_ACK, in->ino(), 0, 0, 0, 0, 0, dirty, 0, mds->get_osd_epoch_barrier());
       ack->set_snap_follows(follows);
       ack->set_client_tid(m->get_client_tid());
       ack->set_oldest_flush_tid(m->get_oldest_flush_tid());
@@ -2906,7 +2908,7 @@ void Locker::handle_client_caps(const cref_t<MClientCaps> &m)
     if (dirty && in->is_auth()) {
       dout(7) << " flush client." << client << " dirty " << ccap_string(dirty)
              << " seq " << m->get_seq() << " on " << *in << dendl;
-      ack = MClientCaps::create(CEPH_CAP_OP_FLUSH_ACK, in->ino(), 0, cap->get_cap_id(), m->get_seq(),
+      ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSH_ACK, in->ino(), 0, cap->get_cap_id(), m->get_seq(),
           m->get_caps(), 0, dirty, 0, mds->get_osd_epoch_barrier());
       ack->set_client_tid(m->get_client_tid());
       ack->set_oldest_flush_tid(m->get_oldest_flush_tid());
@@ -3741,7 +3743,7 @@ void Locker::handle_client_lease(const cref_t<MClientLease> &m)
       dout(7) << "handle_client_lease client." << client << " renew on " << *dn
              << (!dn->lock.can_lease(client)?", revoking lease":"") << dendl;
       if (dn->lock.can_lease(client)) {
-        auto reply = MClientLease::create(*m);
+        auto reply = make_message<MClientLease>(*m);
        int pool = 1;   // fixme.. do something smart!
        reply->h.duration_ms = (int)(1000 * mdcache->client_lease_durations[pool]);
        reply->h.seq = ++l->seq;
@@ -3812,7 +3814,7 @@ void Locker::revoke_client_leases(SimpleLock *lock)
     
     // i should also revoke the dir ICONTENT lease, if they have it!
     CInode *diri = dn->get_dir()->get_inode();
-    auto lease = MClientLease::create(CEPH_MDS_LEASE_REVOKE, l->seq, mask, diri->ino(), diri->first, CEPH_NOSNAP, dn->get_name());
+    auto lease = make_message<MClientLease>(CEPH_MDS_LEASE_REVOKE, l->seq, mask, diri->ino(), diri->first, CEPH_NOSNAP, dn->get_name());
     mds->send_message_client_counted(lease, l->client);
   }
 }
@@ -4682,7 +4684,7 @@ void Locker::scatter_nudge(ScatterLock *lock, MDSContext *c, bool forcelockchang
     // request unscatter?
     mds_rank_t auth = lock->get_parent()->authority().first;
     if (!mds->is_cluster_degraded() || mds->mdsmap->is_clientreplay_or_active_or_stopping(auth)) {
-      mds->send_message_mds(MLock::create(lock, LOCK_AC_NUDGE, mds->get_nodeid()), auth);
+      mds->send_message_mds(make_message<MLock>(lock, LOCK_AC_NUDGE, mds->get_nodeid()), auth);
     }
 
     // wait...
index ee809fbcbf8ed2da65f09f70f7bb2bbb9ccd9639..2cb109a4e11853526040e2eee4f07ec88f79381b 100644 (file)
@@ -400,7 +400,7 @@ void MDBalancer::send_heartbeat()
   for (const auto& r : up) {
     if (r == mds->get_nodeid())
       continue;
-    auto hb = MHeartbeat::create(load, beat_epoch);
+    auto hb = make_message<MHeartbeat>(load, beat_epoch);
     hb->get_import_map() = import_map;
     mds->send_message_mds(hb, r);
   }
index 4d5398ac7fcee0293c146f929f9f7854608db98c..15913a35d13d080ad0e0e627a5aa776056f836f8 100644 (file)
@@ -1979,14 +1979,14 @@ update:
     cap->last_rsize = i->rstat.rsize();
     cap->last_rbytes = i->rstat.rbytes;
 
-    auto msg = MClientQuota::create();
+    auto msg = make_message<MClientQuota>();
     msg->ino = in->ino();
     msg->rstat = i->rstat;
     msg->quota = i->quota;
     mds->send_message_client_counted(msg, cap->get_session());
   }
   for (const auto &it : in->get_replicas()) {
-    auto msg = MGatherCaps::create();
+    auto msg = make_message<MGatherCaps>();
     msg->ino = in->ino();
     mds->send_message_mds(msg, it.first);
   }
@@ -2412,7 +2412,7 @@ void MDCache::_logged_slave_commit(mds_rank_t from, metareqid_t reqid)
   dout(10) << "_logged_slave_commit from mds." << from << " " << reqid << dendl;
   
   // send a message
-  auto req = MMDSSlaveRequest::create(reqid, 0, MMDSSlaveRequest::OP_COMMITTED);
+  auto req = make_message<MMDSSlaveRequest>(reqid, 0, MMDSSlaveRequest::OP_COMMITTED);
   mds->send_message_mds(req, from);
 }
 
@@ -2666,7 +2666,7 @@ void MDCache::send_slave_resolves()
     for (map<mds_rank_t, map<metareqid_t, MDSlaveUpdate*> >::iterator p = uncommitted_slave_updates.begin();
         p != uncommitted_slave_updates.end();
         ++p) {
-      resolves[p->first] = MMDSResolve::create();
+      resolves[p->first] = make_message<MMDSResolve>();
       for (map<metareqid_t, MDSlaveUpdate*>::iterator q = p->second.begin();
           q != p->second.end();
           ++q) {
@@ -2690,7 +2690,7 @@ void MDCache::send_slave_resolves()
       if (resolve_set.count(master) || is_ambiguous_slave_update(p->first, master)) {
        dout(10) << " including uncommitted " << *mdr << dendl;
        if (!resolves.count(master))
-         resolves[master] = MMDSResolve::create();
+         resolves[master] = make_message<MMDSResolve>();
        if (!mdr->committing &&
            mdr->has_more() && mdr->more()->is_inode_exporter) {
          // re-send cap exports
@@ -2734,7 +2734,7 @@ void MDCache::send_subtree_resolves()
     if (*p == mds->get_nodeid())
       continue;
     if (mds->is_resolve() || mds->mdsmap->is_resolve(*p))
-      resolves[*p] = MMDSResolve::create();
+      resolves[*p] = make_message<MMDSResolve>();
   }
 
   map<dirfrag_t, vector<dirfrag_t> > my_subtrees;
@@ -3118,7 +3118,7 @@ void MDCache::handle_resolve(const cref_t<MMDSResolve> &m)
       }
     }
 
-    auto ack = MMDSResolveAck::create();
+    auto ack = make_message<MMDSResolveAck>();
     for (const auto &p : m->slave_requests) {
       if (uncommitted_masters.count(p.first)) {  //mds->sessionmap.have_completed_request(p.first)) {
        // COMMIT
@@ -3922,9 +3922,9 @@ void MDCache::rejoin_send_rejoins()
     if (*p == mds->get_nodeid())  continue;  // nothing to myself!
     if (rejoin_sent.count(*p)) continue;     // already sent a rejoin to this node!
     if (mds->is_rejoin())
-      rejoins[*p] = MMDSCacheRejoin::create(MMDSCacheRejoin::OP_WEAK);
+      rejoins[*p] = make_message<MMDSCacheRejoin>(MMDSCacheRejoin::OP_WEAK);
     else if (mds->mdsmap->is_rejoin(*p))
-      rejoins[*p] = MMDSCacheRejoin::create(MMDSCacheRejoin::OP_STRONG);
+      rejoins[*p] = make_message<MMDSCacheRejoin>(MMDSCacheRejoin::OP_STRONG);
   }
 
   if (mds->is_rejoin()) {
@@ -4291,7 +4291,7 @@ void MDCache::handle_cache_rejoin_weak(const cref_t<MMDSCacheRejoin> &weak)
   if (mds->is_clientreplay() || mds->is_active() || mds->is_stopping()) {
     survivor = true;
     dout(10) << "i am a surivivor, and will ack immediately" << dendl;
-    ack = MMDSCacheRejoin::create(MMDSCacheRejoin::OP_ACK);
+    ack = make_message<MMDSCacheRejoin>(MMDSCacheRejoin::OP_ACK);
 
     map<inodeno_t,map<client_t,Capability::Import> > imported_caps;
 
@@ -5068,7 +5068,7 @@ void MDCache::handle_cache_rejoin_ack(const cref_t<MMDSCacheRejoin> &ack)
       }
 
       // mark client caps stale.
-      auto m = MClientCaps::create(CEPH_CAP_OP_EXPORT, p->first, 0,
+      auto m = make_message<MClientCaps>(CEPH_CAP_OP_EXPORT, p->first, 0,
                                       r->second.capinfo.cap_id, 0,
                                        mds->get_osd_epoch_barrier());
       m->set_cap_peer(q->second.cap_id, q->second.issue_seq, q->second.mseq,
@@ -5502,7 +5502,7 @@ void MDCache::prepare_realm_split(SnapRealm *realm, client_t client, inodeno_t i
     snap = it->second;
     snap->head.op = CEPH_SNAP_OP_SPLIT;
   } else {
-    snap = MClientSnap::create(CEPH_SNAP_OP_SPLIT);
+    snap = make_message<MClientSnap>(CEPH_SNAP_OP_SPLIT);
     splits.emplace(std::piecewise_construct, std::forward_as_tuple(client), std::forward_as_tuple(snap));
     snap->head.split = realm->inode->ino();
     snap->bl = realm->get_snap_trace();
@@ -5534,7 +5534,7 @@ void MDCache::prepare_realm_merge(SnapRealm *realm, SnapRealm *parent_realm,
     ceph_assert(!p.second->empty());
     auto em = splits.emplace(std::piecewise_construct, std::forward_as_tuple(p.first), std::forward_as_tuple());
     if (em.second) {
-      auto update = MClientSnap::create(CEPH_SNAP_OP_SPLIT);
+      auto update = make_message<MClientSnap>(CEPH_SNAP_OP_SPLIT);
       update->head.split = parent_realm->inode->ino();
       update->split_inos = split_inos;
       update->split_realms = split_realms;
@@ -5650,7 +5650,9 @@ void MDCache::export_remaining_imported_caps()
       Session *session = mds->sessionmap.get_session(entity_name_t::CLIENT(q->first.v));
       if (session) {
        // mark client caps stale.
-       auto stale = MClientCaps::create(CEPH_CAP_OP_EXPORT, p->first, 0, 0, 0, mds->get_osd_epoch_barrier());
+       auto stale = make_message<MClientCaps>(CEPH_CAP_OP_EXPORT, p->first,
+                                              0, 0, 0,
+                                              mds->get_osd_epoch_barrier());
        stale->set_cap_peer(0, 0, 0, -1, 0);
        mds->send_message_client_counted(stale, q->first);
       }
@@ -5727,7 +5729,10 @@ void MDCache::do_cap_import(Session *session, CInode *in, Capability *cap,
     cap->set_last_issue();
     cap->set_last_issue_stamp(ceph_clock_now());
     cap->clear_new();
-    auto reap = MClientCaps::create(CEPH_CAP_OP_IMPORT, in->ino(), realm->inode->ino(), cap->get_cap_id(), cap->get_last_seq(), cap->pending(), cap->wanted(), 0, cap->get_mseq(), mds->get_osd_epoch_barrier());
+    auto reap = make_message<MClientCaps>(
+      CEPH_CAP_OP_IMPORT, in->ino(), realm->inode->ino(), cap->get_cap_id(),
+      cap->get_last_seq(), cap->pending(), cap->wanted(), 0, cap->get_mseq(),
+      mds->get_osd_epoch_barrier());
     in->encode_cap_message(reap, cap);
     reap->snapbl = realm->get_snap_trace();
     reap->set_cap_peer(p_cap_id, p_seq, p_mseq, peer, p_flags);
@@ -5924,7 +5929,7 @@ void MDCache::finish_snaprealm_reconnect(client_t client, SnapRealm *realm, snap
   if (seq < realm->get_newest_seq()) {
     dout(10) << "finish_snaprealm_reconnect client." << client << " has old seq " << seq << " < " 
             << realm->get_newest_seq() << " on " << *realm << dendl;
-    auto snap = MClientSnap::create(CEPH_SNAP_OP_UPDATE);
+    auto snap = make_message<MClientSnap>(CEPH_SNAP_OP_UPDATE);
     snap->bl = realm->get_snap_trace();
     for (const auto& child : realm->open_children)
       snap->split_realms.push_back(child->inode->ino());
@@ -5980,7 +5985,7 @@ void MDCache::rejoin_send_acks()
        ++p) {
     if (rejoin_ack_sent.count(*p))
       continue;
-    acks[*p] = MMDSCacheRejoin::create(MMDSCacheRejoin::OP_ACK);
+    acks[*p] = make_message<MMDSCacheRejoin>(MMDSCacheRejoin::OP_ACK);
   }
 
   rejoin_ack_sent = recovery_set;
@@ -6623,7 +6628,7 @@ std::pair<bool, uint64_t> MDCache::trim(uint64_t count)
 
     auto em = expiremap.emplace(std::piecewise_construct, std::forward_as_tuple(rank), std::forward_as_tuple());
     if (em.second) {
-      em.first->second = MCacheExpire::create(mds->get_nodeid());
+      em.first->second = make_message<MCacheExpire>(mds->get_nodeid());
     }
 
     dout(20) << __func__ << ": try expiring " << *mdsdir_in << " for stopping mds." << mds <<  dendl;
@@ -6752,7 +6757,7 @@ bool MDCache::trim_dentry(CDentry *dn, expiremap& expiremap)
       ceph_assert(a != mds->get_nodeid());
       auto em = expiremap.emplace(std::piecewise_construct, std::forward_as_tuple(a), std::forward_as_tuple());
       if (em.second)
-       em.first->second = MCacheExpire::create(mds->get_nodeid());
+       em.first->second = make_message<MCacheExpire>(mds->get_nodeid());
       em.first->second->add_dentry(con->dirfrag(), dir->dirfrag(), dn->get_name(), dn->last, dn->get_replica_nonce());
     }
   }
@@ -6808,7 +6813,7 @@ void MDCache::trim_dirfrag(CDir *dir, CDir *con, expiremap& expiremap)
       ceph_assert(a != mds->get_nodeid());
       auto em = expiremap.emplace(std::piecewise_construct, std::forward_as_tuple(a), std::forward_as_tuple());
       if (em.second)
-       em.first->second = MCacheExpire::create(mds->get_nodeid()); /* new */
+       em.first->second = make_message<MCacheExpire>(mds->get_nodeid()); /* new */
       em.first->second->add_dir(condf, dir->dirfrag(), dir->replica_nonce);
     }
   }
@@ -6875,7 +6880,7 @@ bool MDCache::trim_inode(CDentry *dn, CInode *in, CDir *con, expiremap& expirema
       ceph_assert(a != mds->get_nodeid());
       auto em = expiremap.emplace(std::piecewise_construct, std::forward_as_tuple(a), std::forward_as_tuple());
       if (em.second)
-       em.first->second = MCacheExpire::create(mds->get_nodeid()); /* new */
+       em.first->second = make_message<MCacheExpire>(mds->get_nodeid()); /* new */
       em.first->second->add_inode(df, in->vino(), in->get_replica_nonce());
     }
   }
@@ -7236,7 +7241,7 @@ void MDCache::handle_cache_expire(const cref_t<MCacheExpire> &m)
 
         auto em = delayed_expire[parent_dir].emplace(std::piecewise_construct, std::forward_as_tuple(from), std::forward_as_tuple());
         if (em.second)
-         em.first->second = MCacheExpire::create(from); /* new */
+         em.first->second = make_message<MCacheExpire>(from); /* new */
 
        // merge these expires into it
        em.first->second->add_realm(p.first, p.second);
@@ -8801,7 +8806,7 @@ void MDCache::do_open_ino_peer(inodeno_t ino, open_ino_info_t& info)
     // got backtrace from peer or backtrace just fetched
     if (info.discover || !info.fetch_backtrace)
       pa = &info.ancestors;
-    mds->send_message_mds(MMDSOpenIno::create(info.tid, ino, pa), peer);
+    mds->send_message_mds(make_message<MMDSOpenIno>(info.tid, ino, pa), peer);
     if (mds->logger)
       mds->logger->inc(l_mds_openino_peer_discover);
   }
@@ -8822,7 +8827,7 @@ void MDCache::handle_open_ino(const cref_t<MMDSOpenIno> &m, int err)
   CInode *in = get_inode(ino);
   if (in) {
     dout(10) << " have " << *in << dendl;
-    reply = MMDSOpenInoReply::create(m->get_tid(), ino, mds_rank_t(0));
+    reply = make_message<MMDSOpenInoReply>(m->get_tid(), ino, mds_rank_t(0));
     if (in->is_auth()) {
       touch_inode(in);
       while (1) {
@@ -8838,13 +8843,13 @@ void MDCache::handle_open_ino(const cref_t<MMDSOpenIno> &m, int err)
       reply->hint = in->authority().first;
     }
   } else if (err < 0) {
-    reply = MMDSOpenInoReply::create(m->get_tid(), ino, MDS_RANK_NONE, err);
+    reply = make_message<MMDSOpenInoReply>(m->get_tid(), ino, MDS_RANK_NONE, err);
   } else {
     mds_rank_t hint = MDS_RANK_NONE;
     int ret = open_ino_traverse_dir(ino, m, m->ancestors, false, false, &hint);
     if (ret > 0)
       return;
-    reply = MMDSOpenInoReply::create(m->get_tid(), ino, hint, ret);
+    reply = make_message<MMDSOpenInoReply>(m->get_tid(), ino, hint, ret);
   }
   mds->send_message_mds(reply, from);
 }
@@ -9018,7 +9023,7 @@ void MDCache::_do_find_ino_peer(find_ino_peer_info_t& fip)
     }
   } else {
     fip.checking = m;
-    mds->send_message_mds(MMDSFindIno::create(fip.tid, fip.ino), m);
+    mds->send_message_mds(make_message<MMDSFindIno>(fip.tid, fip.ino), m);
   }
 }
 
@@ -9029,7 +9034,7 @@ void MDCache::handle_find_ino(const cref_t<MMDSFindIno> &m)
   }
 
   dout(10) << "handle_find_ino " << *m << dendl;
-  auto r = MMDSFindInoReply::create(m->tid);
+  auto r = make_message<MMDSFindInoReply>(m->tid);
   CInode *in = get_inode(m->ino);
   if (in) {
     in->make_path(r->path);
@@ -9306,8 +9311,8 @@ void MDCache::request_drop_foreign_locks(MDRequestRef& mdr)
   for (set<mds_rank_t>::iterator p = mdr->more()->slaves.begin();
        p != mdr->more()->slaves.end();
        ++p) {
-    auto r = MMDSSlaveRequest::create(mdr->reqid, mdr->attempt,
-                                              MMDSSlaveRequest::OP_FINISH);
+    auto r = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt,
+                                           MMDSSlaveRequest::OP_FINISH);
 
     if (mdr->killed && !mdr->committing) {
       r->mark_abort();
@@ -9483,7 +9488,7 @@ void MDCache::do_realm_invalidate_and_update_notify(CInode *in, int snapop, bool
 
         auto em = updates.emplace(std::piecewise_construct, std::forward_as_tuple(client), std::forward_as_tuple());
         if (em.second) {
-          auto update = MClientSnap::create(CEPH_SNAP_OP_SPLIT);
+          auto update = make_message<MClientSnap>(CEPH_SNAP_OP_SPLIT);
          update->head.split = in->ino();
          update->split_inos = split_inos;
          update->split_realms = split_realms;
@@ -9567,7 +9572,7 @@ void MDCache::send_snap_update(CInode *in, version_t stid, int snap_op)
     in->encode_snap(snap_blob);
 
     for (auto p : mds_set) {
-      auto m = MMDSSnapUpdate::create(in->ino(), stid, snap_op);
+      auto m = make_message<MMDSSnapUpdate>(in->ino(), stid, snap_op);
       m->snap_blob = snap_blob;
       mds->send_message_mds(m, p);
     }
@@ -9625,7 +9630,7 @@ void MDCache::notify_global_snaprealm_update(int snap_op)
   for (auto &session : sessions) {
     if (!session->is_open() && !session->is_stale())
       continue;
-    auto update = MClientSnap::create(snap_op);
+    auto update = make_message<MClientSnap>(snap_op);
     update->head.split = global_snaprealm->inode->ino();
     update->bl = global_snaprealm->get_snap_trace();
     mds->send_message_client_counted(update, session);
@@ -9700,7 +9705,8 @@ void MDCache::fetch_backtrace(inodeno_t ino, int64_t pool, bufferlist& bl, Conte
 
 void MDCache::_send_discover(discover_info_t& d)
 {
-  auto dis = MDiscover::create(d.ino, d.frag, d.snap, d.want_path, d.want_base_dir, d.want_xlocked);
+  auto dis = make_message<MDiscover>(d.ino, d.frag, d.snap, d.want_path,
+                                    d.want_base_dir, d.want_xlocked);
   dis->set_tid(d.tid);
   mds->send_message_mds(dis, d.mds);
 }
@@ -9892,7 +9898,7 @@ void MDCache::handle_discover(const cref_t<MDiscover> &dis)
 
 
   CInode *cur = 0;
-  auto reply = MDiscoverReply::create(*dis);
+  auto reply = make_message<MDiscoverReply>(*dis);
 
   snapid_t snapid = dis->get_snapid();
 
@@ -10501,7 +10507,7 @@ int MDCache::send_dir_updates(CDir *dir, bool bcast)
     for (const auto &r : dir->dir_rep_by) {
       s.insert(r);
     }
-    mds->send_message_mds(MDirUpdate::create(mds->get_nodeid(), dir->dirfrag(), dir->dir_rep, s, path, bcast), *it);
+    mds->send_message_mds(make_message<MDirUpdate>(mds->get_nodeid(), dir->dirfrag(), dir->dir_rep, s, path, bcast), *it);
   }
 
   return 0;
@@ -10570,7 +10576,7 @@ void MDCache::send_dentry_link(CDentry *dn, MDRequestRef& mdr)
         rejoin_gather.count(p.first)))
       continue;
     CDentry::linkage_t *dnl = dn->get_linkage();
-    auto m = MDentryLink::create(subtree->dirfrag(), dn->get_dir()->dirfrag(), dn->get_name(), dnl->is_primary());
+    auto m = make_message<MDentryLink>(subtree->dirfrag(), dn->get_dir()->dirfrag(), dn->get_name(), dnl->is_primary());
     if (dnl->is_primary()) {
       dout(10) << "  primary " << *dnl->get_inode() << dendl;
       replicate_inode(dnl->get_inode(), p.first, m->bl,
@@ -10657,7 +10663,7 @@ void MDCache::send_dentry_unlink(CDentry *dn, CDentry *straydn, MDRequestRef& md
         rejoin_gather.count(*it)))
       continue;
 
-    auto unlink = MDentryUnlink::create(dn->get_dir()->dirfrag(), dn->get_name());
+    auto unlink = make_message<MDentryUnlink>(dn->get_dir()->dirfrag(), dn->get_name());
     if (straydn) {
       replicate_stray(straydn, *it, unlink->straybl);
       unlink->snapbl = snapbl;
@@ -11511,7 +11517,7 @@ void MDCache::_fragment_stored(MDRequestRef& mdr)
         rejoin_gather.count(p.first)))
       continue;
 
-    auto notify = MMDSFragmentNotify::create(basedirfrag, info.bits, mdr->reqid.tid);
+    auto notify = make_message<MMDSFragmentNotify>(basedirfrag, info.bits, mdr->reqid.tid);
     if (diri_auth != CDIR_AUTH_UNKNOWN && // subtree root
        diri_auth != p.first) { // not auth mds of diri
       /*
@@ -11734,7 +11740,7 @@ void MDCache::handle_fragment_notify(const cref_t<MMDSFragmentNotify> &notify)
   }
 
   if (notify->is_ack_wanted()) {
-    auto ack = MMDSFragmentNotifyAck::create(notify->get_base_dirfrag(),
+    auto ack = make_message<MMDSFragmentNotifyAck>(notify->get_base_dirfrag(),
                                             notify->get_bits(), notify->get_tid());
     mds->send_message_mds(ack, from);
   }
index db0b7f543ae74b0bbe11a6cfe93bbd3568965142..9d91043541a30729970f3619b0d11923ce91b835 100644 (file)
@@ -601,7 +601,7 @@ void MDSDaemon::send_command_reply(const cref_t<MCommand> &m, MDSRank *mds_rank,
   }
   priv.reset();
 
-  auto reply = MCommandReply::create(r, outs);
+  auto reply = make_message<MCommandReply>(r, outs);
   reply->set_tid(m->get_tid());
   reply->set_data(outbl);
   m->get_connection()->send_message2(reply);
index 1791048e8a04ebefb649c02abc977c1c677014fa..a17bbe7008f0d3e22293eb28aa25e08a83223775 100644 (file)
@@ -648,7 +648,7 @@ void MDSRank::update_targets()
 
   if (send) {
     dout(15) << "updating export_targets, now " << new_map_targets.size() << " ranks are targets" << dendl;
-    auto m = MMDSLoadTargets::create(mds_gid_t(monc->get_global_id()), new_map_targets);
+    auto m = make_message<MMDSLoadTargets>(mds_gid_t(monc->get_global_id()), new_map_targets);
     monc->send_mon_message(m.detach());
   }
 }
@@ -1380,7 +1380,7 @@ void MDSRank::send_message_mds(const ref_t<Message>& m, mds_rank_t mds)
 
   // send mdsmap first?
   if (mds != whoami && peer_mdsmap_epoch[mds] < mdsmap->get_epoch()) {
-    auto _m = MMDSMap::create(monc->get_fsid(), *mdsmap);
+    auto _m = make_message<MMDSMap>(monc->get_fsid(), *mdsmap);
     messenger->send_to_mds(_m.detach(), mdsmap->get_addrs(mds));
     peer_mdsmap_epoch[mds] = mdsmap->get_epoch();
   }
@@ -1404,7 +1404,7 @@ void MDSRank::forward_message_mds(const cref_t<MClientRequest>& m, mds_rank_t md
 
   // tell the client where it should go
   auto session = get_session(m);
-  auto f = MClientRequestForward::create(m->get_tid(), mds, m->get_num_fwd()+1, client_must_resend);
+  auto f = make_message<MClientRequestForward>(m->get_tid(), mds, m->get_num_fwd()+1, client_must_resend);
   send_message_client(f, session);
 }
 
@@ -3445,7 +3445,7 @@ void MDSRank::bcast_mds_map()
   set<Session*> clients;
   sessionmap.get_client_session_set(clients);
   for (const auto &session : clients) {
-    auto m = MMDSMap::create(monc->get_fsid(), *mdsmap);
+    auto m = make_message<MMDSMap>(monc->get_fsid(), *mdsmap);
     session->get_connection()->send_message2(std::move(m));
   }
   last_client_mdsmap_bcast = mdsmap->get_epoch();
index 7e53db476d3c59cbecf78f27953738f61c11bb14..9794ab532483a4fcfae1e236f95ac0c9a870ad5a 100644 (file)
@@ -102,7 +102,7 @@ void MDSTableClient::handle_request(const cref_t<MMDSTableRequest> &m)
       dout(10) << "stray agree on " << reqid << " tid " << tid
               << ", sending ROLLBACK" << dendl;
       ceph_assert(!server_ready);
-      auto req = MMDSTableRequest::create(table, TABLESERVER_OP_ROLLBACK, 0, tid);
+      auto req = make_message<MMDSTableRequest>(table, TABLESERVER_OP_ROLLBACK, 0, tid);
       mds->send_message_mds(req, mds->get_mds_map()->get_tableserver());
     }
     break;
@@ -174,7 +174,7 @@ void MDSTableClient::_prepare(bufferlist& mutation, version_t *ptid, bufferlist
 
   if (server_ready) {
     // send message
-    auto req = MMDSTableRequest::create(table, TABLESERVER_OP_PREPARE, reqid);
+    auto req = make_message<MMDSTableRequest>(table, TABLESERVER_OP_PREPARE, reqid);
     req->bl = mutation;
     mds->send_message_mds(req, mds->get_mds_map()->get_tableserver());
   } else
@@ -198,7 +198,7 @@ void MDSTableClient::commit(version_t tid, LogSegment *ls)
 
   if (server_ready) {
     // send message
-    auto req = MMDSTableRequest::create(table, TABLESERVER_OP_COMMIT, 0, tid);
+    auto req = make_message<MMDSTableRequest>(table, TABLESERVER_OP_COMMIT, 0, tid);
     mds->send_message_mds(req, mds->get_mds_map()->get_tableserver());
   } else
     dout(10) << "tableserver is not ready yet, deferring request" << dendl;
@@ -232,7 +232,7 @@ void MDSTableClient::resend_commits()
        p != pending_commit.end();
        ++p) {
     dout(10) << "resending commit on " << p->first << dendl;
-    auto req = MMDSTableRequest::create(table, TABLESERVER_OP_COMMIT, 0, p->first);
+    auto req = make_message<MMDSTableRequest>(table, TABLESERVER_OP_COMMIT, 0, p->first);
     mds->send_message_mds(req, mds->get_mds_map()->get_tableserver());
   }
 }
@@ -248,7 +248,7 @@ void MDSTableClient::resend_prepares()
        p != pending_prepare.end();
        ++p) {
     dout(10) << "resending prepare on " << p->first << dendl;
-    auto req = MMDSTableRequest::create(table, TABLESERVER_OP_PREPARE, p->first);
+    auto req = make_message<MMDSTableRequest>(table, TABLESERVER_OP_PREPARE, p->first);
     req->bl = p->second.mutation;
     mds->send_message_mds(req, mds->get_mds_map()->get_tableserver());
   }
index 04677c9b957cfa6d90553222e911c9d3846fcd12..3666e0db9e4b86fa74541296c2e9dcdf7d4a17c4 100644 (file)
@@ -80,7 +80,7 @@ void MDSTableServer::_prepare_logged(const cref_t<MMDSTableRequest> &req, versio
   _prepare(req->bl, req->reqid, from, out);
   ceph_assert(version == tid);
 
-  auto reply = MMDSTableRequest::create(table, TABLESERVER_OP_AGREE, req->reqid, tid);
+  auto reply = make_message<MMDSTableRequest>(table, TABLESERVER_OP_AGREE, req->reqid, tid);
   reply->bl = std::move(out);
 
   if (_notify_prep(tid)) {
@@ -153,7 +153,7 @@ void MDSTableServer::handle_commit(const cref_t<MMDSTableRequest> &req)
   else if (tid <= version) {
     dout(0) << "got commit for tid " << tid << " <= " << version
            << ", already committed, sending ack." << dendl;
-    auto reply = MMDSTableRequest::create(table, TABLESERVER_OP_ACK, req->reqid, tid);
+    auto reply = make_message<MMDSTableRequest>(table, TABLESERVER_OP_ACK, req->reqid, tid);
     mds->send_message(reply, req->get_connection());
   } 
   else {
@@ -176,7 +176,7 @@ void MDSTableServer::_commit_logged(const cref_t<MMDSTableRequest> &req)
   _commit(tid, req);
   _note_commit(tid);
 
-  auto reply = MMDSTableRequest::create(table, TABLESERVER_OP_ACK, req->reqid, req->get_tid());
+  auto reply = make_message<MMDSTableRequest>(table, TABLESERVER_OP_ACK, req->reqid, req->get_tid());
   mds->send_message_mds(reply, mds_rank_t(req->get_source().num()));
 }
 
@@ -281,13 +281,13 @@ void MDSTableServer::_do_server_recovery()
       next_reqids[who] = p.second.reqid + 1;
 
     version_t tid = p.second.tid;
-    auto reply = MMDSTableRequest::create(table, TABLESERVER_OP_AGREE, p.second.reqid, tid);
+    auto reply = make_message<MMDSTableRequest>(table, TABLESERVER_OP_AGREE, p.second.reqid, tid);
     _get_reply_buffer(tid, &reply->bl);
     mds->send_message_mds(reply, who);
   }
 
   for (auto p : active_clients) {
-    auto reply = MMDSTableRequest::create(table, TABLESERVER_OP_SERVER_READY, next_reqids[p]);
+    auto reply = make_message<MMDSTableRequest>(table, TABLESERVER_OP_SERVER_READY, next_reqids[p]);
     mds->send_message_mds(reply, p);
   }
   recovered = true;
@@ -331,12 +331,12 @@ void MDSTableServer::handle_mds_recovery(mds_rank_t who)
     if (p->second.reqid >= next_reqid)
       next_reqid = p->second.reqid + 1;
 
-    auto reply = MMDSTableRequest::create(table, TABLESERVER_OP_AGREE, p->second.reqid, p->second.tid);
+    auto reply = make_message<MMDSTableRequest>(table, TABLESERVER_OP_AGREE, p->second.reqid, p->second.tid);
     _get_reply_buffer(p->second.tid, &reply->bl);
     mds->send_message_mds(reply, who);
   }
 
-  auto reply = MMDSTableRequest::create(table, TABLESERVER_OP_SERVER_READY, next_reqid);
+  auto reply = make_message<MMDSTableRequest>(table, TABLESERVER_OP_SERVER_READY, next_reqid);
   mds->send_message_mds(reply, who);
 }
 
index b1868b53f15aa9cf6a79dc0363834ccc66fc0cce..b5579dcb15d977d83d47e25e226542f241b29e8e 100644 (file)
@@ -275,7 +275,9 @@ void Migrator::export_try_cancel(CDir *dir, bool notify_peer)
     if (notify_peer &&
        (!mds->is_cluster_degraded() ||
         mds->mdsmap->is_clientreplay_or_active_or_stopping(it->second.peer))) // tell them.
-      mds->send_message_mds(MExportDirCancel::create(dir->dirfrag(), it->second.tid), it->second.peer);
+      mds->send_message_mds(make_message<MExportDirCancel>(dir->dirfrag(),
+                                                          it->second.tid),
+                           it->second.peer);
     break;
 
   case EXPORT_FREEZING:
@@ -287,7 +289,9 @@ void Migrator::export_try_cancel(CDir *dir, bool notify_peer)
     if (notify_peer &&
        (!mds->is_cluster_degraded() ||
         mds->mdsmap->is_clientreplay_or_active_or_stopping(it->second.peer))) // tell them.
-      mds->send_message_mds(MExportDirCancel::create(dir->dirfrag(), it->second.tid), it->second.peer);
+      mds->send_message_mds(make_message<MExportDirCancel>(dir->dirfrag(),
+                                                          it->second.tid),
+                           it->second.peer);
     break;
 
     // NOTE: state order reversal, warning comes after prepping
@@ -325,7 +329,9 @@ void Migrator::export_try_cancel(CDir *dir, bool notify_peer)
     if (notify_peer &&
        (!mds->is_cluster_degraded() ||
         mds->mdsmap->is_clientreplay_or_active_or_stopping(it->second.peer))) // tell them.
-      mds->send_message_mds(MExportDirCancel::create(dir->dirfrag(), it->second.tid), it->second.peer);
+      mds->send_message_mds(make_message<MExportDirCancel>(dir->dirfrag(),
+                                                          it->second.tid),
+                           it->second.peer);
     break;
 
   case EXPORT_EXPORTING:
@@ -1097,8 +1103,9 @@ void Migrator::dispatch_export_dir(MDRequestRef& mdr, int count)
     // send ExportDirDiscover (ask target)
     filepath path;
     dir->inode->make_path(path);
-    auto discover = MExportDirDiscover::create(dir->dirfrag(), path,
-                                              mds->get_nodeid(), it->second.tid);
+    auto discover = make_message<MExportDirDiscover>(dir->dirfrag(), path,
+                                                    mds->get_nodeid(),
+                                                    it->second.tid);
     mds->send_message_mds(discover, dest);
     ceph_assert(g_conf()->mds_kill_export_at != 2);
 
@@ -1289,7 +1296,7 @@ void Migrator::export_frozen(CDir *dir, uint64_t tid)
   cache->get_subtree_bounds(dir, bounds);
 
   // generate prep message, log entry.
-  auto prep = MExportDirPrep::create(dir->dirfrag(), it->second.tid);
+  auto prep = make_message<MExportDirPrep>(dir->dirfrag(), it->second.tid);
 
   // include list of bystanders
   for (const auto &p : dir->get_replicas()) {
@@ -1476,7 +1483,7 @@ void Migrator::handle_export_prep_ack(const cref_t<MExportDirPrepAck> &m)
     it->second.warning_ack_waiting.insert(p.first);
     it->second.notify_ack_waiting.insert(p.first);  // we'll eventually get a notifyack, too!
 
-    auto notify = MExportDirNotify::create(dir->dirfrag(), it->second.tid, true,
+    auto notify = make_message<MExportDirNotify>(dir->dirfrag(), it->second.tid, true,
         mds_authority_t(mds->get_nodeid(),CDIR_AUTH_UNKNOWN),
         mds_authority_t(mds->get_nodeid(),it->second.peer));
     for (auto &cdir : bounds) {
@@ -1548,7 +1555,7 @@ void Migrator::export_go_synced(CDir *dir, uint64_t tid)
   mds->balancer->subtract_export(dir);
   
   // fill export message with cache data
-  auto req = MExportDir::create(dir->dirfrag(), it->second.tid);
+  auto req = make_message<MExportDir>(dir->dirfrag(), it->second.tid);
   map<client_t,entity_inst_t> exported_client_map;
   map<client_t,client_metadata_t> exported_client_metadata_map;
   uint64_t num_exported_inodes = encode_export_dir(req->export_data,
@@ -1643,9 +1650,9 @@ void Migrator::finish_export_inode_caps(CInode *in, mds_rank_t peer,
     const Capability *cap = &p.second;
     dout(7) << "finish_export_inode_caps telling client." << p.first
            << " exported caps on " << *in << dendl;
-    auto m = MClientCaps::create(CEPH_CAP_OP_EXPORT, in->ino(), 0,
-                                    cap->get_cap_id(), cap->get_mseq(), mds->get_osd_epoch_barrier());
-
+    auto m = make_message<MClientCaps>(CEPH_CAP_OP_EXPORT, in->ino(), 0,
+                                      cap->get_cap_id(), cap->get_mseq(),
+                                      mds->get_osd_epoch_barrier());
     map<client_t,Capability::Import>::iterator q = peer_imported.find(p.first);
     ceph_assert(q != peer_imported.end());
     m->set_cap_peer(q->second.cap_id, q->second.issue_seq, q->second.mseq,
@@ -1920,7 +1927,7 @@ void Migrator::export_notify_abort(CDir *dir, export_state_t& stat, set<CDir*>&
   for (set<mds_rank_t>::iterator p = stat.notify_ack_waiting.begin();
        p != stat.notify_ack_waiting.end();
        ++p) {
-    auto notify = MExportDirNotify::create(dir->dirfrag(), stat.tid, true,
+    auto notify = make_message<MExportDirNotify>(dir->dirfrag(), stat.tid, true,
         pair<int,int>(mds->get_nodeid(), stat.peer),
         pair<int,int>(mds->get_nodeid(), CDIR_AUTH_UNKNOWN));
     for (set<CDir*>::iterator i = bounds.begin(); i != bounds.end(); ++i)
@@ -2025,7 +2032,7 @@ void Migrator::export_logged_finish(CDir *dir)
   for (set<mds_rank_t>::iterator p = stat.notify_ack_waiting.begin();
        p != stat.notify_ack_waiting.end();
        ++p) {
-    auto notify = MExportDirNotify::create(dir->dirfrag(), stat.tid, true,
+    auto notify = make_message<MExportDirNotify>(dir->dirfrag(), stat.tid, true,
         pair<int,int>(mds->get_nodeid(), stat.peer),
         pair<int,int>(stat.peer, CDIR_AUTH_UNKNOWN));
 
@@ -2046,7 +2053,7 @@ void Migrator::export_logged_finish(CDir *dir)
     // notify peer to send cap import messages to clients
     if (!mds->is_cluster_degraded() ||
        mds->mdsmap->is_clientreplay_or_active_or_stopping(stat.peer)) {
-      mds->send_message_mds(MExportDirFinish::create(dir->dirfrag(), false, stat.tid), stat.peer);
+      mds->send_message_mds(make_message<MExportDirFinish>(dir->dirfrag(), false, stat.tid), stat.peer);
     } else {
       dout(7) << "not sending MExportDirFinish, dest has failed" << dendl;
     }
@@ -2128,7 +2135,7 @@ void Migrator::export_finish(CDir *dir)
   // send finish/commit to new auth
   if (!mds->is_cluster_degraded() ||
       mds->mdsmap->is_clientreplay_or_active_or_stopping(it->second.peer)) {
-    mds->send_message_mds(MExportDirFinish::create(dir->dirfrag(), true, it->second.tid), it->second.peer);
+    mds->send_message_mds(make_message<MExportDirFinish>(dir->dirfrag(), true, it->second.tid), it->second.peer);
   } else {
     dout(7) << "not sending MExportDirFinish last, dest has failed" << dendl;
   }
@@ -2245,7 +2252,7 @@ void Migrator::handle_export_discover(const cref_t<MExportDirDiscover> &m, bool
 
   if (!mds->is_active()) {
     dout(7) << " not active, send NACK " << dendl;
-    mds->send_message_mds(MExportDirDiscoverAck::create(df, m->get_tid(), false), from);
+    mds->send_message_mds(make_message<MExportDirDiscoverAck>(df, m->get_tid(), false), from);
     return;
   }
 
@@ -2307,7 +2314,7 @@ void Migrator::handle_export_discover(const cref_t<MExportDirDiscover> &m, bool
 
   // reply
   dout(7) << " sending export_discover_ack on " << *in << dendl;
-  mds->send_message_mds(MExportDirDiscoverAck::create(df, m->get_tid()), p_state->peer);
+  mds->send_message_mds(make_message<MExportDirDiscoverAck>(df, m->get_tid()), p_state->peer);
   assert (g_conf()->mds_kill_import_at != 2);
 }
 
@@ -2582,7 +2589,7 @@ void Migrator::handle_export_prep(const cref_t<MExportDirPrep> &m, bool did_assi
 
   // ok!
   dout(7) << " sending export_prep_ack on " << *dir << dendl;
-  mds->send_message(MExportDirPrepAck::create(dir->dirfrag(), success, m->get_tid()), m->get_connection());
+  mds->send_message(make_message<MExportDirPrepAck>(dir->dirfrag(), success, m->get_tid()), m->get_connection());
 
   ceph_assert(g_conf()->mds_kill_import_at != 4);
 }
@@ -2883,7 +2890,7 @@ void Migrator::import_notify_finish(CDir *dir, set<CDir*>& bounds)
   for (set<mds_rank_t>::iterator p = stat.bystanders.begin();
        p != stat.bystanders.end();
        ++p) {
-    auto notify = MExportDirNotify::create(dir->dirfrag(), stat.tid, false,
+    auto notify = make_message<MExportDirNotify>(dir->dirfrag(), stat.tid, false,
         pair<int,int>(stat.peer, mds->get_nodeid()),
         pair<int,int>(mds->get_nodeid(), CDIR_AUTH_UNKNOWN));
     for (set<CDir*>::iterator i = bounds.begin(); i != bounds.end(); ++i)
@@ -2905,7 +2912,7 @@ void Migrator::import_notify_abort(CDir *dir, set<CDir*>& bounds)
       stat.bystanders.erase(p++);
       continue;
     }
-    auto notify = MExportDirNotify::create(dir->dirfrag(), stat.tid, true,
+    auto notify = make_message<MExportDirNotify>(dir->dirfrag(), stat.tid, true,
         mds_authority_t(stat.peer, mds->get_nodeid()),
         mds_authority_t(stat.peer, CDIR_AUTH_UNKNOWN));
     for (set<CDir*>::iterator i = bounds.begin(); i != bounds.end(); ++i)
@@ -2996,7 +3003,7 @@ void Migrator::import_logged_start(dirfrag_t df, CDir *dir, mds_rank_t from,
   // test surviving observer of a failed migration that did not complete
   //assert(dir->replica_map.size() < 2 || mds->get_nodeid() != 0);
 
-  auto ack = MExportDirAck::create(dir->dirfrag(), it->second.tid);
+  auto ack = make_message<MExportDirAck>(dir->dirfrag(), it->second.tid);
   encode(imported_caps, ack->imported_caps);
 
   mds->send_message_mds(ack, from);
@@ -3426,7 +3433,7 @@ void Migrator::handle_export_notify(const cref_t<MExportDirNotify> &m)
   
   // send ack
   if (m->wants_ack()) {
-    mds->send_message_mds(MExportDirNotifyAck::create(m->get_dirfrag(), m->get_tid(), m->get_new_auth()), from);
+    mds->send_message_mds(make_message<MExportDirNotifyAck>(m->get_dirfrag(), m->get_tid(), m->get_new_auth()), from);
   } else {
     // aborted.  no ack.
     dout(7) << "handle_export_notify no ack requested" << dendl;
@@ -3444,7 +3451,7 @@ void Migrator::export_caps(CInode *in)
   ceph_assert(!in->is_ambiguous_auth());
   ceph_assert(!in->state_test(CInode::STATE_EXPORTINGCAPS));
 
-  auto ex = MExportCaps::create();
+  auto ex = make_message<MExportCaps>();
   ex->ino = in->ino();
 
   encode_export_inode_caps(in, false, ex->cap_bl, ex->client_map, ex->client_metadata_map);
@@ -3475,7 +3482,7 @@ void Migrator::handle_export_caps_ack(const cref_t<MExportCapsAck> &ack)
 
       dout(7) << __func__ << " telling client." << it.first
              << " exported caps on " << *in << dendl;
-      auto m = MClientCaps::create(CEPH_CAP_OP_EXPORT, in->ino(), 0,
+      auto m = make_message<MClientCaps>(CEPH_CAP_OP_EXPORT, in->ino(), 0,
                                       cap->get_cap_id(), cap->get_mseq(),
                                       mds->get_osd_epoch_barrier());
       m->set_cap_peer(it.second.cap_id, it.second.issue_seq, it.second.mseq, from, 0);
@@ -3575,7 +3582,7 @@ void Migrator::logged_import_caps(CInode *in,
   mds->locker->eval(in, CEPH_CAP_LOCKS, true);
 
   if (!imported_caps.empty()) {
-    auto ack = MExportCapsAck::create(in->ino());
+    auto ack = make_message<MExportCapsAck>(in->ino());
     map<client_t,uint64_t> peer_caps_ids;
     for (auto &p : imported_caps )
       peer_caps_ids[p.first] = it->second.at(p.first).cap_id;
index 112a48bf898d048c024a5d77040753d25f14c0e4..15f62cadde3c5688cbac9e4f0bb793cbb33ffec8 100644 (file)
@@ -332,7 +332,7 @@ void Server::reclaim_session(Session *session, const cref_t<MClientReclaim> &m)
     return;
   }
 
-  auto reply = MClientReclaimReply::create(0);
+  auto reply = make_message<MClientReclaimReply>(0);
   if (m->get_uuid().empty()) {
     dout(10) << __func__ << " invalid message (no uuid)" << dendl;
     reply->set_result(-EINVAL);
@@ -507,7 +507,7 @@ void Server::handle_client_session(const cref_t<MClientSession> &m)
       };
 
       auto send_reject_message = [this, &session, &log_session_status](std::string_view err_str) {
-       auto m = MClientSession::create(CEPH_SESSION_REJECT);
+       auto m = make_message<MClientSession>(CEPH_SESSION_REJECT);
        if (session->info.has_feature(CEPHFS_FEATURE_MIMIC))
          m->metadata["error_string"] = err_str;
        mds->send_message_client(m, session);
@@ -607,7 +607,7 @@ void Server::handle_client_session(const cref_t<MClientSession> &m)
        mds->locker->resume_stale_caps(session);
        mds->sessionmap.touch_session(session);
       }
-      auto reply = MClientSession::create(CEPH_SESSION_RENEWCAPS, m->get_seq());
+      auto reply = make_message<MClientSession>(CEPH_SESSION_RENEWCAPS, m->get_seq());
       mds->send_message_client(reply, session);
     } else {
       dout(10) << "ignoring renewcaps on non open|stale session (" << session->get_state_name() << ")" << dendl;
@@ -672,7 +672,7 @@ void Server::flush_session(Session *session, MDSGatherBuilder *gather) {
 
   version_t seq = session->wait_for_flush(gather->new_sub());
   mds->send_message_client(
-    MClientSession::create(CEPH_SESSION_FLUSHMSG, seq), session);
+    make_message<MClientSession>(CEPH_SESSION_FLUSHMSG, seq), session);
 }
 
 void Server::flush_client_sessions(set<client_t>& client_set, MDSGatherBuilder& gather)
@@ -717,12 +717,12 @@ void Server::_session_logged(Session *session, uint64_t state_seq, bool open, ve
     mds->sessionmap.set_state(session, Session::STATE_OPEN);
     mds->sessionmap.touch_session(session);
     ceph_assert(session->get_connection());
-    auto reply = MClientSession::create(CEPH_SESSION_OPEN);
+    auto reply = make_message<MClientSession>(CEPH_SESSION_OPEN);
     if (session->info.has_feature(CEPHFS_FEATURE_MIMIC))
       reply->supported_features = supported_features;
     mds->send_message_client(reply, session);
     if (mdcache->is_readonly()) {
-      auto m = MClientSession::create(CEPH_SESSION_FORCE_RO);
+      auto m = make_message<MClientSession>(CEPH_SESSION_FORCE_RO);
       mds->send_message_client(m, session);
     }
   } else if (session->is_closing() ||
@@ -769,7 +769,7 @@ void Server::_session_logged(Session *session, uint64_t state_seq, bool open, ve
       }
 
       // reset session
-      mds->send_message_client(MClientSession::create(CEPH_SESSION_CLOSE), session);
+      mds->send_message_client(make_message<MClientSession>(CEPH_SESSION_CLOSE), session);
       mds->sessionmap.set_state(session, Session::STATE_CLOSED);
       session->clear();
       mds->sessionmap.remove_session(session);
@@ -866,13 +866,13 @@ void Server::finish_force_open_sessions(const map<client_t,pair<Session*,uint64_
        mds->sessionmap.set_state(session, Session::STATE_OPEN);
        mds->sessionmap.touch_session(session);
 
-       auto reply = MClientSession::create(CEPH_SESSION_OPEN);
+       auto reply = make_message<MClientSession>(CEPH_SESSION_OPEN);
        if (session->info.has_feature(CEPHFS_FEATURE_MIMIC))
          reply->supported_features = supported_features;
        mds->send_message_client(reply, session);
 
        if (mdcache->is_readonly())
-         mds->send_message_client(MClientSession::create(CEPH_SESSION_FORCE_RO), session);
+         mds->send_message_client(make_message<MClientSession>(CEPH_SESSION_FORCE_RO), session);
       }
     } else {
       dout(10) << "force_open_sessions skipping already-open " << session->info.inst << dendl;
@@ -985,7 +985,7 @@ void Server::find_idle_sessions()
       mds->sessionmap.set_state(session, Session::STATE_STALE);
       mds->locker->revoke_stale_caps(session);
       mds->locker->remove_stale_leases(session);
-      mds->send_message_client(MClientSession::create(CEPH_SESSION_STALE, session->get_push_seq()), session);
+      mds->send_message_client(make_message<MClientSession>(CEPH_SESSION_STALE, session->get_push_seq()), session);
       finish_flush_session(session, session->get_push_seq());
     }
   }
@@ -1248,7 +1248,7 @@ void Server::handle_client_reconnect(const cref_t<MClientReconnect> &m)
   }
 
   if (deny) {
-    auto r = MClientSession::create(CEPH_SESSION_CLOSE);
+    auto r = make_message<MClientSession>(CEPH_SESSION_CLOSE);
     mds->send_message_client(r, session);
     if (session->is_open())
       kill_session(session, nullptr);
@@ -1257,7 +1257,7 @@ void Server::handle_client_reconnect(const cref_t<MClientReconnect> &m)
 
   if (!m->has_more()) {
     // notify client of success with an OPEN
-    auto reply = MClientSession::create(CEPH_SESSION_OPEN);
+    auto reply = make_message<MClientSession>(CEPH_SESSION_OPEN);
     if (session->info.has_feature(CEPHFS_FEATURE_MIMIC))
       reply->supported_features = supported_features;
     mds->send_message_client(reply, session);
@@ -1636,7 +1636,7 @@ std::pair<bool, uint64_t> Server::recall_client_state(MDSGatherBuilder* gather,
 
       dout(7) << "  recalling " << recall << " caps; session_recall_throttle = " << session_recall_throttle << "; global_recall_throttle = " << global_recall_throttle << dendl;
 
-      auto m = MClientSession::create(CEPH_SESSION_RECALL_STATE);
+      auto m = make_message<MClientSession>(CEPH_SESSION_RECALL_STATE);
       m->head.max_caps = newlim;
       mds->send_message_client(m, session);
       if (gather) {
@@ -1664,7 +1664,7 @@ void Server::force_clients_readonly()
     if (!session->info.inst.name.is_client() ||
        !(session->is_open() || session->is_stale()))
       continue;
-    mds->send_message_client(MClientSession::create(CEPH_SESSION_FORCE_RO), session);
+    mds->send_message_client(make_message<MClientSession>(CEPH_SESSION_FORCE_RO), session);
   }
 }
 
@@ -1719,7 +1719,7 @@ void Server::submit_mdlog_entry(LogEvent *le, MDSLogContextBase *fin, MDRequestR
 void Server::respond_to_request(MDRequestRef& mdr, int r)
 {
   if (mdr->client_request) {
-    reply_client_request(mdr, MClientReply::create(*mdr->client_request, r));
+    reply_client_request(mdr, make_message<MClientReply>(*mdr->client_request, r));
   } else if (mdr->internal_op > -1) {
     dout(10) << "respond_to_request on internal request " << mdr << dendl;
     if (!mdr->internal_op_finish)
@@ -1854,7 +1854,7 @@ void Server::early_reply(MDRequestRef& mdr, CInode *tracei, CDentry *tracedn)
   }
 
 
-  auto reply = MClientReply::create(*req, 0);
+  auto reply = make_message<MClientReply>(*req, 0);
   reply->set_unsafe();
 
   // mark xlocks "done", indicating that we are exposing uncommitted changes.
@@ -2146,7 +2146,7 @@ void Server::handle_client_request(const cref_t<MClientRequest> &req)
           req->get_op() != CEPH_MDS_OP_OPEN &&
           req->get_op() != CEPH_MDS_OP_CREATE)) {
        dout(5) << "already completed " << req->get_reqid() << dendl;
-        auto reply = MClientReply::create(*req, 0);
+        auto reply = make_message<MClientReply>(*req, 0);
        if (created != inodeno_t()) {
          bufferlist extra;
          encode(created, extra);
@@ -2415,7 +2415,7 @@ void Server::handle_slave_request(const cref_t<MMDSSlaveRequest> &m)
   // the purpose of rename notify is enforcing causal message ordering. making sure
   // bystanders have received all messages from rename srcdn's auth MDS.
   if (m->get_op() == MMDSSlaveRequest::OP_RENAMENOTIFY) {
-    auto reply = MMDSSlaveRequest::create(m->get_reqid(), m->get_attempt(), MMDSSlaveRequest::OP_RENAMENOTIFYACK);
+    auto reply = make_message<MMDSSlaveRequest>(m->get_reqid(), m->get_attempt(), MMDSSlaveRequest::OP_RENAMENOTIFYACK);
     mds->send_message(reply, m->get_connection());
     return;
   }
@@ -2645,7 +2645,7 @@ void Server::dispatch_slave_request(MDRequestRef& mdr)
          return;
        
        // ack
-       auto r = MMDSSlaveRequest::create(mdr->reqid, mdr->attempt, replycode);
+       auto r = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, replycode);
        r->set_lock_type(lock->get_type());
        lock->get_parent()->set_object_info(r->get_object_info());
        if (replycode == MMDSSlaveRequest::OP_XLOCKACK)
@@ -2808,7 +2808,7 @@ void Server::handle_slave_auth_pin(MDRequestRef& mdr)
   }
 
   // ack!
-  auto reply = MMDSSlaveRequest::create(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_AUTHPINACK);
+  auto reply = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_AUTHPINACK);
   
   // return list of my auth_pins (if any)
   for (const auto &p : mdr->auth_pins) {
@@ -5126,7 +5126,7 @@ void Server::create_quota_realm(CInode *in)
 {
   dout(10) << __func__ << " " << *in << dendl;
 
-  auto req = MClientRequest::create(CEPH_MDS_OP_SETXATTR);
+  auto req = make_message<MClientRequest>(CEPH_MDS_OP_SETXATTR);
   req->set_filepath(filepath(in->ino()));
   req->set_string2("ceph.quota");
   // empty vxattr value
@@ -6091,7 +6091,7 @@ void Server::_link_remote(MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targ
       op = MMDSSlaveRequest::OP_LINKPREP;
     else 
       op = MMDSSlaveRequest::OP_UNLINKPREP;
-    auto req = MMDSSlaveRequest::create(mdr->reqid, mdr->attempt, op);
+    auto req = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, op);
     targeti->set_object_info(req->get_object_info());
     req->op_stamp = mdr->get_op_stamp();
     if (auto& desti_srnode = mdr->more()->desti_srnode)
@@ -6338,7 +6338,7 @@ void Server::_logged_slave_link(MDRequestRef& mdr, CInode *targeti, bool adjust_
 
   // ack
   if (!mdr->aborted) {
-    auto reply = MMDSSlaveRequest::create(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_LINKPREPACK);
+    auto reply = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_LINKPREPACK);
     mds->send_message_mds(reply, mdr->slave_to_mds);
   } else {
     dout(10) << " abort flag set, finishing" << dendl;
@@ -6383,7 +6383,7 @@ void Server::_committed_slave(MDRequestRef& mdr)
 
   ceph_assert(g_conf()->mds_kill_link_at != 8);
 
-  auto req = MMDSSlaveRequest::create(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_COMMITTED);
+  auto req = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_COMMITTED);
   mds->send_message_mds(req, mdr->slave_to_mds);
   mdcache->request_finish(mdr);
 }
@@ -6899,7 +6899,7 @@ bool Server::_rmdir_prepare_witness(MDRequestRef& mdr, mds_rank_t who, vector<CD
   }
   
   dout(10) << "_rmdir_prepare_witness mds." << who << dendl;
-  auto req = MMDSSlaveRequest::create(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RMDIRPREP);
+  auto req = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RMDIRPREP);
   req->srcdnpath = filepath(trace.front()->get_dir()->ino());
   for (auto dn : trace)
     req->srcdnpath.push_dentry(dn->get_name());
@@ -7048,7 +7048,7 @@ void Server::_logged_slave_rmdir(MDRequestRef& mdr, CDentry *dn, CDentry *strayd
   mdr->straydn = 0;
 
   if (!mdr->aborted) {
-    auto reply = MMDSSlaveRequest::create(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RMDIRPREPACK);
+    auto reply = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RMDIRPREPACK);
     if (!mdr->more()->slave_update_journaled)
       reply->mark_not_journaled();
     mds->send_message_mds(reply, mdr->slave_to_mds);
@@ -7818,7 +7818,7 @@ bool Server::_rename_prepare_witness(MDRequestRef& mdr, mds_rank_t who, set<mds_
   }
 
   dout(10) << "_rename_prepare_witness mds." << who << dendl;
-  auto req = MMDSSlaveRequest::create(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RENAMEPREP);
+  auto req = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RENAMEPREP);
 
   req->srcdnpath = filepath(srctrace.front()->get_dir()->ino());
   for (auto dn : srctrace)
@@ -8488,7 +8488,7 @@ void Server::handle_slave_rename_prep(MDRequestRef& mdr)
 
   if (mdr->slave_request->is_interrupted()) {
     dout(10) << " slave request interrupted, sending noop reply" << dendl;
-    auto reply = MMDSSlaveRequest::create(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RENAMEPREPACK);
+    auto reply = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RENAMEPREPACK);
     reply->mark_interrupted();
     mds->send_message_mds(reply, mdr->slave_to_mds);
     mdr->reset_slave_request();
@@ -8592,7 +8592,7 @@ void Server::handle_slave_rename_prep(MDRequestRef& mdr)
            (mds->is_cluster_degraded() &&
             !mds->mdsmap->is_clientreplay_or_active_or_stopping(*p)))
          continue;
-       auto notify = MMDSSlaveRequest::create(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RENAMENOTIFY);
+       auto notify = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RENAMENOTIFY);
        mds->send_message_mds(notify, *p);
        mdr->more()->waiting_on_slave.insert(*p);
       }
@@ -8621,7 +8621,7 @@ void Server::handle_slave_rename_prep(MDRequestRef& mdr)
 
     if (reply_witness) {
       ceph_assert(!srcdnrep.empty());
-      auto reply = MMDSSlaveRequest::create(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RENAMEPREPACK);
+      auto reply = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RENAMEPREPACK);
       reply->witnesses.swap(srcdnrep);
       mds->send_message_mds(reply, mdr->slave_to_mds);
       mdr->reset_slave_request();
@@ -8724,7 +8724,7 @@ void Server::_logged_slave_rename(MDRequestRef& mdr,
   // prepare ack
   ref_t<MMDSSlaveRequest> reply;
   if (!mdr->aborted) {
-    reply = MMDSSlaveRequest::create(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RENAMEPREPACK);
+    reply = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RENAMEPREPACK);
     if (!mdr->more()->slave_update_journaled)
       reply->mark_not_journaled();
   }
index 99784d5f1110bd589b09fdfe71e8fbdf7732585d..7ddf1e7c8af650a59dd9926b9431d06c6cf7e20b 100644 (file)
@@ -115,7 +115,7 @@ void SnapClient::handle_notify_prep(const cref_t<MMDSTableRequest> &m)
 {
   dout(10) << __func__ << " " << *m << dendl;
   handle_query_result(m);
-  auto ack = MMDSTableRequest::create(table, TABLESERVER_OP_NOTIFY_ACK, 0, m->get_tid());
+  auto ack = make_message<MMDSTableRequest>(table, TABLESERVER_OP_NOTIFY_ACK, 0, m->get_tid());
   mds->send_message(ack, m->get_connection());
 }
 
@@ -153,7 +153,7 @@ void SnapClient::refresh(version_t want, MDSContext *onfinish)
     return;
 
   mds_rank_t ts = mds->mdsmap->get_tableserver();
-  auto req = MMDSTableRequest::create(table, TABLESERVER_OP_QUERY, ++last_reqid, 0);
+  auto req = make_message<MMDSTableRequest>(table, TABLESERVER_OP_QUERY, ++last_reqid, 0);
   using ceph::encode;
   char op = 'F';
   encode(op, req->bl);
index 51e0cbaf2f4dd393f424f09c8adad393a237b963..8b0f2b7b70966770977ba40d45138b5682c6190e 100644 (file)
@@ -266,7 +266,7 @@ bool SnapServer::_notify_prep(version_t tid)
   ceph_assert(version == tid);
 
   for (auto &p : active_clients) {
-    auto m = MMDSTableRequest::create(table, TABLESERVER_OP_NOTIFY_PREP, 0, version);
+    auto m = make_message<MMDSTableRequest>(table, TABLESERVER_OP_NOTIFY_PREP, 0, version);
     m->bl = bl;
     mds->send_message_mds(m, p);
   }
@@ -281,7 +281,7 @@ void SnapServer::handle_query(const cref_t<MMDSTableRequest> &req)
   auto p = req->bl.cbegin();
   decode(op, p);
 
-  auto reply = MMDSTableRequest::create(table, TABLESERVER_OP_QUERY_REPLY, req->reqid, version);
+  auto reply = make_message<MMDSTableRequest>(table, TABLESERVER_OP_QUERY_REPLY, req->reqid, version);
 
   switch (op) {
     case 'F': // full
@@ -353,7 +353,7 @@ void SnapServer::check_osd_map(bool force)
 
   if (!all_purge.empty()) {
     dout(10) << "requesting removal of " << all_purge << dendl;
-    auto m = MRemoveSnaps::create(all_purge);
+    auto m = make_message<MRemoveSnaps>(all_purge);
     mon_client->send_mon_message(m.detach());
   }
 
index 444e4ccc1ccb845980129002fabe83618de5cbb4..efc4fe352734d51a0bbf5e2a8f82d05deb91cc6e 100644 (file)
@@ -659,7 +659,7 @@ void StrayManager::reintegrate_stray(CDentry *straydn, CDentry *rdn)
   filepath dst;
   rdn->make_path(dst);
 
-  auto req = MClientRequest::create(CEPH_MDS_OP_RENAME);
+  auto req = make_message<MClientRequest>(CEPH_MDS_OP_RENAME);
   req->set_filepath(dst);
   req->set_filepath2(src);
   req->set_tid(mds->issue_tid());
@@ -688,7 +688,7 @@ void StrayManager::migrate_stray(CDentry *dn, mds_rank_t to)
   dst.push_dentry(src[0]);
   dst.push_dentry(src[1]);
 
-  auto req = MClientRequest::create(CEPH_MDS_OP_RENAME);
+  auto req = make_message<MClientRequest>(CEPH_MDS_OP_RENAME);
   req->set_filepath(dst);
   req->set_filepath2(src);
   req->set_tid(mds->issue_tid());
index 8fd28ff029e619952d1275264200cc3d69c7955f..c7067859c2568ab9e9a4bd03685a21355e5fba87 100644 (file)
 #include "msg/MessageRef.h"
 #include "messages/PaxosServiceMessage.h"
 
-class MAuth : public MessageInstance<MAuth, PaxosServiceMessage> {
+class MAuth : public PaxosServiceMessage {
 public:
-  friend factory;
-
   __u32 protocol;
   ceph::buffer::list auth_payload;
   epoch_t monmap_epoch;
 
   /* if protocol == 0, then auth_payload is a set<__u32> listing protocols the client supports */
 
-  MAuth() : MessageInstance(CEPH_MSG_AUTH, 0), protocol(0), monmap_epoch(0) { }
+  MAuth() : PaxosServiceMessage{CEPH_MSG_AUTH, 0}, protocol(0), monmap_epoch(0) { }
 private:
   ~MAuth() override {}
 
index ec47ff2001c47e41f122e1ff52c21dfa35d5b7d7..f50fab59ddbed7cec8a20112d70ab37a58ad5a5d 100644 (file)
 #include "msg/Message.h"
 #include "common/errno.h"
 
-class MAuthReply : public MessageInstance<MAuthReply> {
+class MAuthReply : public Message {
 public:
-  friend factory;
-
   __u32 protocol;
   errorcode32_t result;
   uint64_t global_id;      // if zero, meaningless
   std::string result_msg;
   ceph::buffer::list result_bl;
 
-  MAuthReply() : MessageInstance(CEPH_MSG_AUTH_REPLY), protocol(0), result(0), global_id(0) {}
+  MAuthReply() : Message(CEPH_MSG_AUTH_REPLY), protocol(0), result(0), global_id(0) {}
   MAuthReply(__u32 p, ceph::buffer::list *bl = NULL, int r = 0, uint64_t gid=0, const char *msg = "") :
-    MessageInstance(CEPH_MSG_AUTH_REPLY),
+    Message(CEPH_MSG_AUTH_REPLY),
     protocol(p), result(r), global_id(gid),
     result_msg(msg) {
     if (bl)
index ab571c49f6dd0cfd4af84187c998440bda4fa6f5..9f9d38bce0289c8756e1a83f7f8e5e3796cc8000 100644 (file)
@@ -18,9 +18,7 @@
 #include "msg/Message.h"
 #include "messages/MOSDPeeringOp.h"
 
-class MBackfillReserve : public MessageInstance<MBackfillReserve, MOSDPeeringOp> {
-public:
-  friend factory;
+class MBackfillReserve : public MOSDPeeringOp {
 private:
   static constexpr int HEAD_VERSION = 5;
   static constexpr int COMPAT_VERSION = 4;
@@ -94,7 +92,7 @@ public:
   }
 
   MBackfillReserve()
-    : MessageInstance(MSG_OSD_BACKFILL_RESERVE, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDPeeringOp{MSG_OSD_BACKFILL_RESERVE, HEAD_VERSION, COMPAT_VERSION},
       query_epoch(0), type(-1), priority(-1), primary_num_bytes(0),
       shard_num_bytes(0) {}
   MBackfillReserve(int type,
@@ -102,7 +100,7 @@ public:
                   epoch_t query_epoch, unsigned prio = -1,
                   int64_t primary_num_bytes = 0,
                    int64_t shard_num_bytes = 0)
-    : MessageInstance(MSG_OSD_BACKFILL_RESERVE, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDPeeringOp{MSG_OSD_BACKFILL_RESERVE, HEAD_VERSION, COMPAT_VERSION},
       pgid(pgid), query_epoch(query_epoch),
       type(type), priority(prio), primary_num_bytes(primary_num_bytes),
       shard_num_bytes(shard_num_bytes) {}
index d54bcaf5c1bc8a965af3e738a52e6646442cad45..dede4f3fefef400434e115deba64b2541658f940 100644 (file)
@@ -21,9 +21,7 @@
 
 #include "mds/mdstypes.h"
 
-class MCacheExpire : public MessageInstance<MCacheExpire> {
-public:
-  friend factory;
+class MCacheExpire : public Message {
 private:
   __s32 from;
 
@@ -68,9 +66,9 @@ public:
   int get_from() const { return from; }
 
 protected:
-  MCacheExpire() : MessageInstance(MSG_MDS_CACHEEXPIRE), from(-1) {}
+  MCacheExpire() : Message{MSG_MDS_CACHEEXPIRE}, from(-1) {}
   MCacheExpire(int f) : 
-    MessageInstance(MSG_MDS_CACHEEXPIRE),
+    Message{MSG_MDS_CACHEEXPIRE},
     from(f) { }
   ~MCacheExpire() override {}
 
@@ -106,6 +104,9 @@ public:
     encode(from, payload);
     encode(realms, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 WRITE_CLASS_ENCODER(MCacheExpire::realm)
index 403169bdc5ad72297367cd6e65915fc3a05a39d3..a5427bb74ce716a080aefc2d67320146a26a41c4 100644 (file)
 #include "msg/Message.h"
 
 
-class MClientCapRelease : public MessageInstance<MClientCapRelease> {
-public:
-  friend factory;
-
+class MClientCapRelease : public Message {
 private:
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
@@ -35,7 +32,7 @@ private:
   epoch_t osd_epoch_barrier;
 
   MClientCapRelease() : 
-    MessageInstance(CEPH_MSG_CLIENT_CAPRELEASE, HEAD_VERSION, COMPAT_VERSION),
+    Message{CEPH_MSG_CLIENT_CAPRELEASE, HEAD_VERSION, COMPAT_VERSION},
     osd_epoch_barrier(0)
   {
     memset(&head, 0, sizeof(head));
index fa069f1889431fec7300d9adc66dbb996d3b1aff..292eeeb1845dc521715cbaefe25126fc20205bb9 100644 (file)
@@ -19,9 +19,7 @@
 #include "mds/mdstypes.h"
 #include "include/ceph_features.h"
 
-class MClientCaps : public MessageInstance<MClientCaps> {
-public:
-  friend factory;
+class MClientCaps : public Message {
 private:
 
   static constexpr int HEAD_VERSION = 11;
@@ -131,7 +129,7 @@ private:
 
 protected:
   MClientCaps()
-    : MessageInstance(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION) {}
+    : Message{CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION} {}
   MClientCaps(int op,
              inodeno_t ino,
              inodeno_t realm,
@@ -142,7 +140,7 @@ protected:
              int dirty,
              int mseq,
               epoch_t oeb)
-    : MessageInstance(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION),
+    : Message{CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION},
       osd_epoch_barrier(oeb) {
     memset(&head, 0, sizeof(head));
     head.op = op;
@@ -159,7 +157,7 @@ protected:
   MClientCaps(int op,
              inodeno_t ino, inodeno_t realm,
              uint64_t id, int mseq, epoch_t oeb)
-    : MessageInstance(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION),
+    : Message{CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION},
       osd_epoch_barrier(oeb) {
     memset(&head, 0, sizeof(head));
     head.op = op;
@@ -331,6 +329,9 @@ public:
     encode(nfiles, payload);
     encode(nsubdirs, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 5c2bf84bb571adbbf62b69f92528fc4c033b1c3f..f75cd26915b340359451f3d5491fb14a859eae2c 100644 (file)
 
 #include "msg/Message.h"
 
-class MClientLease : public MessageInstance<MClientLease> {
+class MClientLease : public Message {
 public:
-  friend factory;
-
   struct ceph_mds_lease h;
   std::string dname;
   
@@ -35,13 +33,13 @@ public:
   snapid_t get_last() const { return snapid_t(h.last); }
 
 protected:
-  MClientLease() : MessageInstance(CEPH_MSG_CLIENT_LEASE) {}
+  MClientLease() : Message(CEPH_MSG_CLIENT_LEASE) {}
   MClientLease(const MClientLease& m) :
-    MessageInstance(CEPH_MSG_CLIENT_LEASE),
+    Message(CEPH_MSG_CLIENT_LEASE),
     h(m.h),
     dname(m.dname) {}
   MClientLease(int ac, ceph_seq_t seq, int m, uint64_t i, uint64_t sf, uint64_t sl) :
-    MessageInstance(CEPH_MSG_CLIENT_LEASE) {
+    Message(CEPH_MSG_CLIENT_LEASE) {
     h.action = ac;
     h.seq = seq;
     h.mask = m;
@@ -51,7 +49,7 @@ protected:
     h.duration_ms = 0;
   }
   MClientLease(int ac, ceph_seq_t seq, int m, uint64_t i, uint64_t sf, uint64_t sl, std::string_view d) :
-    MessageInstance(CEPH_MSG_CLIENT_LEASE),
+    Message(CEPH_MSG_CLIENT_LEASE),
     dname(d) {
     h.action = ac;
     h.seq = seq;
@@ -88,6 +86,9 @@ public:
     encode(dname, payload);
   }
 
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index b1aed00bf60432076cf8abcca967d54435030899..0042f37fbffb834ee6c9120cca4d5b7c29420f42 100644 (file)
@@ -3,17 +3,15 @@
 
 #include "msg/Message.h"
 
-class MClientQuota : public MessageInstance<MClientQuota> {
+class MClientQuota : public Message {
 public:
-  friend factory;
-
   inodeno_t ino;
   nest_info_t rstat;
   quota_info_t quota;
 
 protected:
   MClientQuota() :
-    MessageInstance(CEPH_MSG_CLIENT_QUOTA),
+    Message{CEPH_MSG_CLIENT_QUOTA},
     ino(0)
   {}
   ~MClientQuota() override {}
@@ -47,6 +45,9 @@ public:
     decode(quota, p);
     ceph_assert(p.end());
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index ffb7609c31b6e78e463b60feaea39bb5202fba3c..e98fee8e96099f28e2a4f940bdb1b15ffa85ee98 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "msg/Message.h"
 
-class MClientReclaim: public MessageInstance<MClientReclaim> {
+class MClientReclaim: public Message {
 public:
   static constexpr int HEAD_VERSION = 1;
   static constexpr int COMPAT_VERSION = 1;
@@ -48,17 +48,19 @@ public:
   }
 
 protected:
-  friend factory;
   MClientReclaim() :
-    MessageInstance(CEPH_MSG_CLIENT_RECLAIM, HEAD_VERSION, COMPAT_VERSION) {}
+    Message{CEPH_MSG_CLIENT_RECLAIM, HEAD_VERSION, COMPAT_VERSION} {}
   MClientReclaim(std::string_view _uuid, uint32_t _flags) :
-    MessageInstance(CEPH_MSG_CLIENT_RECLAIM, HEAD_VERSION, COMPAT_VERSION),
+    Message{CEPH_MSG_CLIENT_RECLAIM, HEAD_VERSION, COMPAT_VERSION},
     uuid(_uuid), flags(_flags) {}
 private:
   ~MClientReclaim() override {}
 
   std::string uuid;
   uint32_t flags = 0;
+
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 288b88686fbf09562f51474a6616b7265ee4d6a3..ef0b17de9e8387e28f06a742cdafe13cf32b7d6b 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "msg/Message.h"
 
-class MClientReclaimReply: public MessageInstance<MClientReclaimReply> {
+class MClientReclaimReply: public Message {
 public:
   static constexpr int HEAD_VERSION = 1;
   static constexpr int COMPAT_VERSION = 1;
@@ -51,11 +51,11 @@ public:
   }
 
 protected:
-  friend factory;
   MClientReclaimReply() :
-    MessageInstance(CEPH_MSG_CLIENT_RECLAIM_REPLY, HEAD_VERSION, COMPAT_VERSION) {}
+    MClientReclaimReply{0, 0}
+  {}
   MClientReclaimReply(int r, epoch_t e=0) :
-    MessageInstance(CEPH_MSG_CLIENT_RECLAIM_REPLY, HEAD_VERSION, COMPAT_VERSION),
+    Message{CEPH_MSG_CLIENT_RECLAIM_REPLY, HEAD_VERSION, COMPAT_VERSION},
     result(r), epoch(e) {}
 
 private:
@@ -64,6 +64,9 @@ private:
   int32_t result;
   epoch_t epoch;
   entity_addrvec_t addrs;
+
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index ba3b0fb2cdac385fdc07276f1baebea0ce3e4238..d631a697b579c77a09ba6587fa2195bd046b4fe2 100644 (file)
@@ -20,9 +20,7 @@
 #include "include/ceph_features.h"
 
 
-class MClientReconnect : public MessageInstance<MClientReconnect> {
-public:
-  friend factory;
+class MClientReconnect : public Message {
 private:
   static constexpr int HEAD_VERSION = 5;
   static constexpr int COMPAT_VERSION = 4;
@@ -32,9 +30,9 @@ public:
   vector<snaprealm_reconnect_t> realms;
   bool more = false;
 
-  MClientReconnect() :
-    MessageInstance(CEPH_MSG_CLIENT_RECONNECT, HEAD_VERSION, COMPAT_VERSION) {}
 private:
+  MClientReconnect() :
+    Message{CEPH_MSG_CLIENT_RECONNECT, HEAD_VERSION, COMPAT_VERSION} {}
   ~MClientReconnect() override {}
 
   size_t cap_size = 0;
@@ -168,6 +166,9 @@ public:
       }
     }
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 
index 4b10128154c0207dfe3a6a4d4133b87047561b0e..7754bae0723de9e44899519cc1f1cc5f5a565e84 100644 (file)
@@ -260,10 +260,8 @@ struct InodeStat {
 };
 
 
-class MClientReply : public MessageInstance<MClientReply> {
+class MClientReply : public Message {
 public:
-  friend factory;
-
   // reply data
   struct ceph_mds_reply_head head {};
   bufferlist trace_bl;
@@ -286,9 +284,9 @@ public:
   bool is_safe() const { return head.safe; }
 
 protected:
-  MClientReply() : MessageInstance(CEPH_MSG_CLIENT_REPLY) {}
+  MClientReply() : Message{CEPH_MSG_CLIENT_REPLY} {}
   MClientReply(const MClientRequest &req, int result = 0) :
-    MessageInstance(CEPH_MSG_CLIENT_REPLY) {
+    Message{CEPH_MSG_CLIENT_REPLY} {
     memset(&head, 0, sizeof(head));
     header.tid = req.get_tid();
     head.op = req.get_op();
@@ -353,6 +351,9 @@ public:
   const bufferlist& get_trace_bl() const {
     return trace_bl;
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 602eff1d15b6179c641ac837b3beb92d523c5bfb..20118cdd32a20fcce6e2f578d517c12ebce0bc86 100644 (file)
@@ -48,9 +48,7 @@
 
 // metadata ops.
 
-class MClientRequest : public MessageInstance<MClientRequest> {
-public:
-  friend factory;
+class MClientRequest : public Message {
 private:
   static constexpr int HEAD_VERSION = 4;
   static constexpr int COMPAT_VERSION = 1;
@@ -91,9 +89,9 @@ public:
 protected:
   // cons
   MClientRequest()
-    : MessageInstance(CEPH_MSG_CLIENT_REQUEST, HEAD_VERSION, COMPAT_VERSION) {}
+    : Message(CEPH_MSG_CLIENT_REQUEST, HEAD_VERSION, COMPAT_VERSION) {}
   MClientRequest(int op)
-    : MessageInstance(CEPH_MSG_CLIENT_REQUEST, HEAD_VERSION, COMPAT_VERSION) {
+    : Message(CEPH_MSG_CLIENT_REQUEST, HEAD_VERSION, COMPAT_VERSION) {
     memset(&head, 0, sizeof(head));
     head.op = op;
   }
@@ -281,7 +279,9 @@ public:
     out << '}'
        << ")";
   }
-
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 WRITE_CLASS_ENCODER(MClientRequest::Release)
index e3dc8071767f0097f96712093bb58b8fba524f42..b92c49329e74b51dd5c472d97b1718317011d7d5 100644 (file)
@@ -18,9 +18,7 @@
 
 #include "msg/Message.h"
 
-class MClientRequestForward : public MessageInstance<MClientRequestForward> {
-public:
-  friend factory;
+class MClientRequestForward : public Message {
 private:
   int32_t dest_mds;
   int32_t num_fwd;
@@ -28,10 +26,10 @@ private:
 
 protected:
   MClientRequestForward()
-    : MessageInstance(CEPH_MSG_CLIENT_REQUEST_FORWARD),
+    : Message{CEPH_MSG_CLIENT_REQUEST_FORWARD},
       dest_mds(-1), num_fwd(-1), client_must_resend(false) {}
   MClientRequestForward(ceph_tid_t t, int dm, int nf, bool cmr) :
-    MessageInstance(CEPH_MSG_CLIENT_REQUEST_FORWARD),
+    Message{CEPH_MSG_CLIENT_REQUEST_FORWARD},
     dest_mds(dm), num_fwd(nf), client_must_resend(cmr) {
     ceph_assert(client_must_resend);
     header.tid = t;
@@ -65,6 +63,9 @@ public:
     decode(num_fwd, p);
     decode(client_must_resend, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index c7a2a3b503d2c5810f8c3024ac57e28df783c125..f1d4191726c61be543976764bf3d2ed8f7fba6fa 100644 (file)
@@ -18,9 +18,7 @@
 #include "msg/Message.h"
 #include "mds/mdstypes.h"
 
-class MClientSession : public MessageInstance<MClientSession> {
-public:
-  friend factory;
+class MClientSession : public Message {
 private:
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 1;
@@ -38,15 +36,15 @@ public:
   int get_max_leases() const { return head.max_leases; }
 
 protected:
-  MClientSession() : MessageInstance(CEPH_MSG_CLIENT_SESSION, HEAD_VERSION, COMPAT_VERSION) { }
+  MClientSession() : Message{CEPH_MSG_CLIENT_SESSION, HEAD_VERSION, COMPAT_VERSION} { }
   MClientSession(int o, version_t s=0) : 
-    MessageInstance(CEPH_MSG_CLIENT_SESSION, HEAD_VERSION, COMPAT_VERSION) {
+    Message{CEPH_MSG_CLIENT_SESSION, HEAD_VERSION, COMPAT_VERSION} {
     memset(&head, 0, sizeof(head));
     head.op = o;
     head.seq = s;
   }
   MClientSession(int o, utime_t st) : 
-    MessageInstance(CEPH_MSG_CLIENT_SESSION, HEAD_VERSION, COMPAT_VERSION) {
+    Message{CEPH_MSG_CLIENT_SESSION, HEAD_VERSION, COMPAT_VERSION} {
     memset(&head, 0, sizeof(head));
     head.op = o;
     head.seq = 0;
@@ -87,6 +85,9 @@ public:
       encode(supported_features, payload);
     }
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index f0f96e4eb128914b0f5ef35fd44587f557ac6ed8..59f872fc1a38f80a732b60e264376c66546f91f0 100644 (file)
 
 #include "msg/Message.h"
 
-class MClientSnap : public MessageInstance<MClientSnap> {
+class MClientSnap : public Message {
 public:
-  friend factory;
-
   ceph_mds_snap_head head;
   bufferlist bl;
   
@@ -30,7 +28,7 @@ public:
 
 protected:
   MClientSnap(int o=0) : 
-    MessageInstance(CEPH_MSG_CLIENT_SNAP) {
+    Message{CEPH_MSG_CLIENT_SNAP} {
     memset(&head, 0, sizeof(head));
     head.op = o;
   }
@@ -64,7 +62,9 @@ public:
     decode_nohead(head.trace_len, bl, p);
     ceph_assert(p.end());
   }
-
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index ce8fde106ed8aa982474eb626d0c6644bd0ecba9..fb421049a5116e6f1092eedc3572182d52d1cc53 100644 (file)
 
 #include "msg/Message.h"
 
-class MCommand : public MessageInstance<MCommand> {
+class MCommand : public Message {
 public:
-  friend factory;
-
   uuid_d fsid;
   std::vector<std::string> cmd;
 
   MCommand()
-    : MessageInstance(MSG_COMMAND) {}
+    : Message{MSG_COMMAND} {}
   MCommand(const uuid_d &f)
-    : MessageInstance(MSG_COMMAND),
+    : Message{MSG_COMMAND},
       fsid(f) { }
 
 private:
index 09a6017d1951a8e9f07e09ca49167d5798983b4c..64594bb0664618cb136a84313f0b1961371ae23a 100644 (file)
 #include "msg/Message.h"
 #include "MCommand.h"
 
-class MCommandReply : public MessageInstance<MCommandReply> {
+class MCommandReply : public Message {
 public:
-  friend factory;
-
   errorcode32_t r;
   std::string rs;
   
   MCommandReply()
-    : MessageInstance(MSG_COMMAND_REPLY) {}
+    : Message{MSG_COMMAND_REPLY} {}
   MCommandReply(MCommand *m, int _r)
-    : MessageInstance(MSG_COMMAND_REPLY), r(_r) {
+    : Message{MSG_COMMAND_REPLY}, r(_r) {
     header.tid = m->get_tid();
   }
   MCommandReply(int _r, std::string_view s)
-    : MessageInstance(MSG_COMMAND_REPLY),
+    : Message{MSG_COMMAND_REPLY},
       r(_r), rs(s) { }
 private:
   ~MCommandReply() override {}
index 6ea8d85e49365de3efd7523ce6e5b75f27bf6023..c97c706406db487a073f5705faaf49dfde57e7a0 100644 (file)
@@ -5,22 +5,20 @@
 
 #include "msg/Message.h"
 
-class MConfig : public MessageInstance<MConfig> {
+class MConfig : public Message {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 1;
   static constexpr int COMPAT_VERSION = 1;
 
   // use transparent comparator so we can lookup in it by std::string_view keys
   std::map<std::string,std::string,std::less<>> config;
 
-  MConfig() : MessageInstance(MSG_CONFIG, HEAD_VERSION, COMPAT_VERSION) { }
+  MConfig() : Message{MSG_CONFIG, HEAD_VERSION, COMPAT_VERSION} { }
   MConfig(const std::map<std::string,std::string,std::less<>>& c)
-    : MessageInstance(MSG_CONFIG, HEAD_VERSION, COMPAT_VERSION),
+    : Message{MSG_CONFIG, HEAD_VERSION, COMPAT_VERSION},
       config{c} {}
   MConfig(std::map<std::string,std::string,std::less<>>&& c)
-    : MessageInstance(MSG_CONFIG, HEAD_VERSION, COMPAT_VERSION),
+    : Message{MSG_CONFIG, HEAD_VERSION, COMPAT_VERSION},
       config{std::move(c)} {}
 
   std::string_view get_type_name() const override {
index 75dea9baf457fce7fe7e2e6f6107031db08a26dd..293fe0d4c5c69ea189841bc513dd688d3f56d147 100644 (file)
@@ -20,9 +20,7 @@
 
 #include "msg/Message.h"
 
-class MDentryLink : public MessageInstance<MDentryLink> {
-public:
-  friend factory;
+class MDentryLink : public Message {
 private:
   dirfrag_t subtree;
   dirfrag_t dirfrag;
@@ -39,9 +37,9 @@ private:
 
 protected:
   MDentryLink() :
-    MessageInstance(MSG_MDS_DENTRYLINK) { }
+    Message{MSG_MDS_DENTRYLINK} { }
   MDentryLink(dirfrag_t r, dirfrag_t df, std::string_view n, bool p) :
-    MessageInstance(MSG_MDS_DENTRYLINK),
+    Message{MSG_MDS_DENTRYLINK},
     subtree(r),
     dirfrag(df),
     dn(n),
@@ -70,6 +68,9 @@ public:
     encode(is_primary, payload);
     encode(bl, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 1d3d9715dc3083c792a97354f1266b40d2a8024a..eed4ac47dbafcbc372fc53d877d00c2eb5a163d8 100644 (file)
 
 #include "msg/Message.h"
 
-class MDentryUnlink : public MessageInstance<MDentryUnlink> {
-public:
-  friend factory;
+class MDentryUnlink : public Message {
 private:
-
   dirfrag_t dirfrag;
   string dn;
 
@@ -37,9 +34,9 @@ private:
 
 protected:
   MDentryUnlink() :
-    MessageInstance(MSG_MDS_DENTRYUNLINK) { }
+    Message{MSG_MDS_DENTRYUNLINK} { }
   MDentryUnlink(dirfrag_t df, std::string_view n) :
-    MessageInstance(MSG_MDS_DENTRYUNLINK),
+    Message{MSG_MDS_DENTRYUNLINK},
     dirfrag(df),
     dn(n) {}
   ~MDentryUnlink() override {}
@@ -62,6 +59,9 @@ public:
     encode(dn, payload);
     encode(straybl, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index c1154ac78d6b50fbf0562040e02e890bd0c87695..729e76b79b45fbda7278dbd4a4374ac7cdd70450 100644 (file)
 
 #include "msg/Message.h"
 
-class MDirUpdate : public MessageInstance<MDirUpdate> {
+class MDirUpdate : public Message {
 public:
-  friend factory;
-
   mds_rank_t get_source_mds() const { return from_mds; }
   dirfrag_t get_dirfrag() const { return dirfrag; }
   int get_dir_rep() const { return dir_rep; }
@@ -59,19 +57,19 @@ public:
 
 protected:
   ~MDirUpdate() {}
-  MDirUpdate() : MessageInstance(MSG_MDS_DIRUPDATE) {}
+  MDirUpdate() : Message{MSG_MDS_DIRUPDATE} {}
   MDirUpdate(mds_rank_t f,
             dirfrag_t dirfrag,
              int dir_rep,
              const std::set<int32_t>& dir_rep_by,
              filepath& path,
              bool discover = false) :
-    MessageInstance(MSG_MDS_DIRUPDATE), from_mds(f), dirfrag(dirfrag),
+    Message{MSG_MDS_DIRUPDATE}, from_mds(f), dirfrag(dirfrag),
     dir_rep(dir_rep), dir_rep_by(dir_rep_by), path(path) {
     this->discover = discover ? 5 : 0;
   }
   MDirUpdate(const MDirUpdate& m)
-  : MessageInstance(MSG_MDS_DIRUPDATE),
+  : Message{MSG_MDS_DIRUPDATE},
     from_mds(m.from_mds),
     dirfrag(m.dirfrag),
     dir_rep(m.dir_rep),
@@ -88,6 +86,10 @@ protected:
   std::set<int32_t> dir_rep_by;
   filepath path;
   mutable int tried_discover = 0; // XXX HACK
+
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index f4418e615fc6ef6cae396f17102ff8f1c83cf898..3b0ac20214a81dff559498fe026a741c28151191 100644 (file)
 #include <string>
 
 
-class MDiscover : public MessageInstance<MDiscover> {
-public:
-  friend factory;
+class MDiscover : public Message {
 private:
-
   inodeno_t       base_ino;          // 1 -> root
   frag_t          base_dir_frag;
 
@@ -50,14 +47,14 @@ private:
   void set_base_dir_frag(frag_t f) { base_dir_frag = f; }
 
 protected:
-  MDiscover() : MessageInstance(MSG_MDS_DISCOVER) { }
+  MDiscover() : Message{MSG_MDS_DISCOVER} { }
   MDiscover(inodeno_t base_ino_,
            frag_t base_frag_,
            snapid_t s,
             filepath& want_path_,
             bool want_base_dir_ = true,
            bool discover_xlocks_ = false) :
-    MessageInstance(MSG_MDS_DISCOVER),
+    Message{MSG_MDS_DISCOVER},
     base_ino(base_ino_),
     base_dir_frag(base_frag_),
     snapid(s),
@@ -91,7 +88,9 @@ public:
     encode(want_base_dir, payload);
     encode(want_xlocked, payload);
   }
-
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index bd4f34754428413c487fcaf71b7048ffd1925ab8..978f1383e13efab9393e4c140eb8625d721c3e38 100644 (file)
@@ -63,9 +63,7 @@
  * 
  */
 
-class MDiscoverReply : public MessageInstance<MDiscoverReply> {
-public:
-  friend factory;
+class MDiscoverReply : public Message {
 private:
   static constexpr int HEAD_VERSION = 2;
 
@@ -111,9 +109,9 @@ private:
   void set_base_dir_frag(frag_t df) { base_dir_frag = df; }
 
 protected:
-  MDiscoverReply() : MessageInstance(MSG_MDS_DISCOVERREPLY, HEAD_VERSION) { }
+  MDiscoverReply() : Message{MSG_MDS_DISCOVERREPLY, HEAD_VERSION} { }
   MDiscoverReply(const MDiscover &dis) :
-    MessageInstance(MSG_MDS_DISCOVERREPLY, HEAD_VERSION),
+    Message{MSG_MDS_DISCOVERREPLY, HEAD_VERSION},
     base_ino(dis.get_base_ino()),
     base_dir_frag(dis.get_base_dir_frag()),
     wanted_base_dir(dis.wants_base_dir()),
@@ -128,7 +126,7 @@ protected:
     header.tid = dis.get_tid();
   }
   MDiscoverReply(dirfrag_t df) :
-    MessageInstance(MSG_MDS_DISCOVERREPLY, HEAD_VERSION),
+    Message{MSG_MDS_DISCOVERREPLY, HEAD_VERSION},
     base_ino(df.ino),
     base_dir_frag(df.frag),
     wanted_base_dir(false),
@@ -207,6 +205,9 @@ public:
     encode(starts_with, payload);
     encode(trace, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 93e53b0f66683d3a06a3ffa5e3be6410e2346d6a..641d31aa3e9992e420c64662ef49f952ecad21f1 100644 (file)
@@ -19,9 +19,7 @@
 #include "msg/Message.h"
 
 
-class MExportCaps : public MessageInstance<MExportCaps> {
-public:
-  friend factory;
+class MExportCaps : public Message {
 private:
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
@@ -33,7 +31,7 @@ public:
 
 protected:
   MExportCaps() :
-    MessageInstance(MSG_MDS_EXPORTCAPS, HEAD_VERSION, COMPAT_VERSION) {}
+    Message{MSG_MDS_EXPORTCAPS, HEAD_VERSION, COMPAT_VERSION} {}
   ~MExportCaps() override {}
 
 public:
@@ -57,7 +55,9 @@ public:
     if (header.version >= 2)
       decode(client_metadata_map, p);
   }
-
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index d159161eed09bc04551ae7c669279df464f23643..df7e9839f1ee37b19aba27583aac70158e2de081 100644 (file)
 #include "msg/Message.h"
 
 
-class MExportCapsAck : public MessageInstance<MExportCapsAck> {
+class MExportCapsAck : public Message {
 public:  
-  friend factory;
-
   inodeno_t ino;
   bufferlist cap_bl;
 
 protected:
   MExportCapsAck() :
-    MessageInstance(MSG_MDS_EXPORTCAPSACK) {}
+    Message{MSG_MDS_EXPORTCAPSACK} {}
   MExportCapsAck(inodeno_t i) :
-    MessageInstance(MSG_MDS_EXPORTCAPSACK), ino(i) {}
+    Message{MSG_MDS_EXPORTCAPSACK}, ino(i) {}
   ~MExportCapsAck() override {}
 
 public:
@@ -49,6 +47,9 @@ public:
     decode(ino, p);
     decode(cap_bl, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 8f509e03179398ad526be6459dcfb907f93ce2cf..3bd98a3387317dbceeb1c2519eab1215c54da3c9 100644 (file)
 #include "msg/Message.h"
 
 
-class MExportDir : public MessageInstance<MExportDir> {
+class MExportDir : public Message {
 public:
-  friend factory;
   dirfrag_t dirfrag;
   bufferlist export_data;
   vector<dirfrag_t> bounds;
   bufferlist client_map;
 
 protected:
-  MExportDir() : MessageInstance(MSG_MDS_EXPORTDIR) {}
+  MExportDir() : Message{MSG_MDS_EXPORTDIR} {}
   MExportDir(dirfrag_t df, uint64_t tid) :
-    MessageInstance(MSG_MDS_EXPORTDIR), dirfrag(df) {
+    Message{MSG_MDS_EXPORTDIR}, dirfrag(df) {
     set_tid(tid);
   }
   ~MExportDir() override {}
@@ -59,7 +58,9 @@ public:
     decode(export_data, p);
     decode(client_map, p);
   }
-
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index ff8be81637f92dc4b44d6e80bead2132b98e711a..d0ffd01b9c9a23c9aa7ab969938824a4702241db 100644 (file)
 #include "MExportDir.h"
 #include "msg/Message.h"
 
-class MExportDirAck : public MessageInstance<MExportDirAck> {
+class MExportDirAck : public Message {
 public:
-  friend factory;
-
   dirfrag_t dirfrag;
   bufferlist imported_caps;
 
   dirfrag_t get_dirfrag() const { return dirfrag; }
   
 protected:
-  MExportDirAck() : MessageInstance(MSG_MDS_EXPORTDIRACK) {}
+  MExportDirAck() : Message{MSG_MDS_EXPORTDIRACK} {}
   MExportDirAck(dirfrag_t df, uint64_t tid) :
-    MessageInstance(MSG_MDS_EXPORTDIRACK), dirfrag(df) {
+    Message{MSG_MDS_EXPORTDIRACK}, dirfrag(df) {
     set_tid(tid);
   }
   ~MExportDirAck() override {}
@@ -51,7 +49,9 @@ public:
     encode(dirfrag, payload);
     encode(imported_caps, payload);
   }
-
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 56f2c4d16ebfe9a865144ccb2668037d96929b02..c66cc1e4a0c422600755efda154d3e6aa646b49f 100644 (file)
@@ -18,9 +18,7 @@
 #include "msg/Message.h"
 #include "include/types.h"
 
-class MExportDirCancel : public MessageInstance<MExportDirCancel> {
-public:
-  friend factory;
+class MExportDirCancel : public Message {
 private:
   dirfrag_t dirfrag;
 
@@ -28,9 +26,9 @@ private:
   dirfrag_t get_dirfrag() const { return dirfrag; }
 
 protected:
-  MExportDirCancel() : MessageInstance(MSG_MDS_EXPORTDIRCANCEL) {}
+  MExportDirCancel() : Message{MSG_MDS_EXPORTDIRCANCEL} {}
   MExportDirCancel(dirfrag_t df, uint64_t tid) :
-    MessageInstance(MSG_MDS_EXPORTDIRCANCEL), dirfrag(df) {
+    Message{MSG_MDS_EXPORTDIRCANCEL}, dirfrag(df) {
     set_tid(tid);
   }
   ~MExportDirCancel() override {}
@@ -49,6 +47,9 @@ public:
     auto p = payload.cbegin();
     decode(dirfrag, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 74f298bc250015f6a2d7ea3b2d8bf5fb9ff02167..bd03fbb0f4dd9cc397bfbd25fd3fc57a464a9640 100644 (file)
@@ -18,9 +18,7 @@
 #include "msg/Message.h"
 #include "include/types.h"
 
-class MExportDirDiscover : public MessageInstance<MExportDirDiscover> {
-public:
-  friend factory;
+class MExportDirDiscover : public Message {
 private:
   mds_rank_t from = -1;
   dirfrag_t dirfrag;
@@ -36,10 +34,10 @@ private:
 
 protected:
   MExportDirDiscover() :     
-    MessageInstance(MSG_MDS_EXPORTDIRDISCOVER),
+    Message{MSG_MDS_EXPORTDIRDISCOVER},
     started(false) { }
   MExportDirDiscover(dirfrag_t df, filepath& p, mds_rank_t f, uint64_t tid) :
-    MessageInstance(MSG_MDS_EXPORTDIRDISCOVER),
+    Message{MSG_MDS_EXPORTDIRDISCOVER},
     from(f), dirfrag(df), path(p), started(false) {
     set_tid(tid);
   }
@@ -64,6 +62,9 @@ public:
     encode(dirfrag, payload);
     encode(path, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index ba8fda5653c447b9dde7f45d12081e80bdc76af0..4b0e5141e854b2d58c1956a3a58ec2257297e8dd 100644 (file)
@@ -18,9 +18,7 @@
 #include "msg/Message.h"
 #include "include/types.h"
 
-class MExportDirDiscoverAck : public MessageInstance<MExportDirDiscoverAck> {
-public:
-  friend factory;
+class MExportDirDiscoverAck : public Message {
 private:
   dirfrag_t dirfrag;
   bool success;
@@ -31,9 +29,9 @@ private:
   bool is_success() const { return success; }
 
 protected:
-  MExportDirDiscoverAck() : MessageInstance(MSG_MDS_EXPORTDIRDISCOVERACK) {}
+  MExportDirDiscoverAck() : Message{MSG_MDS_EXPORTDIRDISCOVERACK} {}
   MExportDirDiscoverAck(dirfrag_t df, uint64_t tid, bool s=true) :
-    MessageInstance(MSG_MDS_EXPORTDIRDISCOVERACK),
+    Message{MSG_MDS_EXPORTDIRDISCOVERACK},
     dirfrag(df), success(s) {
     set_tid(tid);
   }
@@ -59,6 +57,9 @@ public:
     encode(dirfrag, payload);
     encode(success, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 6cc35d0935f4a7f831494d814e161a72033d3d5f..9ed4f01064b87f8f11567d118f33d689e9fb9baf 100644 (file)
@@ -17,9 +17,7 @@
 
 #include "msg/Message.h"
 
-class MExportDirFinish : public MessageInstance<MExportDirFinish> {
-public:
-  friend factory;
+class MExportDirFinish : public Message {
 private:
   dirfrag_t dirfrag;
   bool last;
@@ -31,7 +29,7 @@ private:
 protected:
   MExportDirFinish() : last(false) {}
   MExportDirFinish(dirfrag_t df, bool l, uint64_t tid) :
-    MessageInstance(MSG_MDS_EXPORTDIRFINISH), dirfrag(df), last(l) {
+    Message{MSG_MDS_EXPORTDIRFINISH}, dirfrag(df), last(l) {
     set_tid(tid);
   }
   ~MExportDirFinish() override {}
@@ -52,7 +50,9 @@ public:
     decode(dirfrag, p);
     decode(last, p);
   }
-
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index fbb7a30b0c6d0b60575434fb9ab8cdabb2f2583c..03d8fc626eb7707506510b4d1670fc3f1e1c021a 100644 (file)
@@ -17,9 +17,7 @@
 
 #include "msg/Message.h"
 
-class MExportDirNotify : public MessageInstance<MExportDirNotify> {
-public:
-  friend factory;
+class MExportDirNotify : public Message {
 private:
   dirfrag_t base;
   bool ack;
@@ -37,7 +35,7 @@ private:
 protected:
   MExportDirNotify() {}
   MExportDirNotify(dirfrag_t i, uint64_t tid, bool a, pair<__s32,__s32> oa, pair<__s32,__s32> na) :
-    MessageInstance(MSG_MDS_EXPORTDIRNOTIFY),
+    Message{MSG_MDS_EXPORTDIRNOTIFY},
     base(i), ack(a), old_auth(oa), new_auth(na) {
     set_tid(tid);
   }
@@ -79,6 +77,9 @@ public:
     decode(new_auth, p);
     decode(bounds, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 05f771675c5dc5bba9d0c5ce4076d0c605f2c5c5..2db265495875e2c52095a35cb6229111754087bb 100644 (file)
@@ -17,9 +17,7 @@
 
 #include "msg/Message.h"
 
-class MExportDirNotifyAck : public MessageInstance<MExportDirNotifyAck> {
-public:
-  friend factory;
+class MExportDirNotifyAck : public Message {
 private:
   dirfrag_t dirfrag;
   pair<__s32,__s32> new_auth;
@@ -31,7 +29,7 @@ private:
 protected:
   MExportDirNotifyAck() {}
   MExportDirNotifyAck(dirfrag_t df, uint64_t tid, pair<__s32,__s32> na) :
-    MessageInstance(MSG_MDS_EXPORTDIRNOTIFYACK), dirfrag(df), new_auth(na) {
+    Message{MSG_MDS_EXPORTDIRNOTIFYACK}, dirfrag(df), new_auth(na) {
     set_tid(tid);
   }
   ~MExportDirNotifyAck() override {}
@@ -53,7 +51,9 @@ public:
     decode(dirfrag, p);
     decode(new_auth, p);
   }
-  
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);  
 };
 
 #endif
index e10d4f247a474dacd0df115a4a2ee08b18ff25ed..0061b9510d9ff30cc9a3c9325cbf1a406f694be6 100644 (file)
@@ -19,9 +19,7 @@
 #include "msg/Message.h"
 #include "include/types.h"
 
-class MExportDirPrep : public MessageInstance<MExportDirPrep> {
-public:
-  friend factory;
+class MExportDirPrep : public Message {
 private:
   dirfrag_t dirfrag;
  public:
@@ -30,7 +28,7 @@ private:
   list<bufferlist> traces;
 private:
   set<mds_rank_t> bystanders;
-  bool b_did_assim;
+  bool b_did_assim = false;
 
 public:
   dirfrag_t get_dirfrag() const { return dirfrag; }
@@ -41,12 +39,11 @@ public:
   void mark_assim() { b_did_assim = true; }
 
 protected:
-  MExportDirPrep() {
-    b_did_assim = false;
-  }
+  MExportDirPrep() = default;
   MExportDirPrep(dirfrag_t df, uint64_t tid) :
-    MessageInstance(MSG_MDS_EXPORTDIRPREP),
-    dirfrag(df), b_did_assim(false) {
+    Message{MSG_MDS_EXPORTDIRPREP},
+    dirfrag(df)
+  {
     set_tid(tid);
   }
   ~MExportDirPrep() override {}
@@ -85,6 +82,9 @@ public:
     encode(traces, payload);
     encode(bystanders, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 11e59a8d6a8a8d0a1ed7544d89adbcc11d1df6c6..02ada30534b6ed3807aaf12b810fbdadcca2588b 100644 (file)
@@ -18,9 +18,7 @@
 #include "msg/Message.h"
 #include "include/types.h"
 
-class MExportDirPrepAck : public MessageInstance<MExportDirPrepAck> {
-public:
-  friend factory;
+class MExportDirPrepAck : public Message {
 private:
   dirfrag_t dirfrag;
   bool success = false;
@@ -31,7 +29,7 @@ private:
 protected:
   MExportDirPrepAck() {}
   MExportDirPrepAck(dirfrag_t df, bool s, uint64_t tid) :
-    MessageInstance(MSG_MDS_EXPORTDIRPREPACK), dirfrag(df), success(s) {
+    Message{MSG_MDS_EXPORTDIRPREPACK}, dirfrag(df), success(s) {
     set_tid(tid);
   }
   ~MExportDirPrepAck() override {}
@@ -54,6 +52,9 @@ public:
     encode(dirfrag, payload);
     encode(success, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 99f241d53aeef844851d132cefb789c67d6517fa..8f77a41f8cbebb71949f9046416995866b3a4947 100644 (file)
 #include "mds/FSMap.h"
 #include "include/ceph_features.h"
 
-class MFSMap : public MessageInstance<MFSMap> {
+class MFSMap : public Message {
 public:
-  friend factory;
-
   epoch_t epoch;
   bufferlist encoded;
 
@@ -31,12 +29,12 @@ public:
   const FSMap& get_fsmap() const {return fsmap;}
 
   MFSMap() : 
-    MessageInstance(CEPH_MSG_FS_MAP), epoch(0) {}
+    Message{CEPH_MSG_FS_MAP}, epoch(0) {}
   MFSMap(const uuid_d &f, const FSMap &fsmap_) :
-    MessageInstance(CEPH_MSG_FS_MAP), epoch(fsmap_.get_epoch())
-  {
-    fsmap = fsmap_;
-  }
+    Message{CEPH_MSG_FS_MAP},
+    epoch(fsmap_.get_epoch()),
+    fsmap{fsmap_}
+  {}
 private:
   FSMap fsmap;
 
index 215b121164250a33d2d5364059240f28c607cea2..3b9cc34f8320cfc07ba2718e75a8a1a53d0e5048 100644 (file)
 #include "mds/FSMapUser.h"
 #include "include/ceph_features.h"
 
-class MFSMapUser : public MessageInstance<MFSMapUser> {
+class MFSMapUser : public Message {
 public:
-  friend factory;
-
   epoch_t epoch;
 
   version_t get_epoch() const { return epoch; }
   const FSMapUser& get_fsmap() const { return fsmap; }
 
   MFSMapUser() :
-    MessageInstance(CEPH_MSG_FS_MAP_USER), epoch(0) {}
+    Message{CEPH_MSG_FS_MAP_USER}, epoch(0) {}
   MFSMapUser(const uuid_d &f, const FSMapUser &fsmap_) :
-    MessageInstance(CEPH_MSG_FS_MAP_USER), epoch(fsmap_.epoch)
-  {
-    fsmap = fsmap_;
-  }
+    Message{CEPH_MSG_FS_MAP_USER},
+    epoch(fsmap_.epoch),
+    fsmap{fsmap_}
+  {}
 private:
   FSMapUser fsmap;
 
@@ -57,6 +55,9 @@ public:
     encode(epoch, payload);
     encode(fsmap, payload, features);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 7f552ca1d065cfd4daf439fe60505cf865237ce7..ac6aeba04f8a102c1e40cc1cf6dbe232eb652d24 100644 (file)
 #include "include/encoding.h"
 #include "include/stringify.h"
 
-class MForward : public MessageInstance<MForward> {
+class MForward : public Message {
 public:
-  friend factory;
-
   uint64_t tid;
   uint8_t client_type;
   entity_addrvec_t client_addrs;
@@ -42,11 +40,11 @@ public:
   static constexpr int HEAD_VERSION = 4;
   static constexpr int COMPAT_VERSION = 4;
 
-  MForward() : MessageInstance(MSG_FORWARD, HEAD_VERSION, COMPAT_VERSION),
+  MForward() : Message{MSG_FORWARD, HEAD_VERSION, COMPAT_VERSION},
                tid(0), con_features(0), msg(NULL) {}
   MForward(uint64_t t, PaxosServiceMessage *m, uint64_t feat,
            const MonCap& caps) :
-    MessageInstance(MSG_FORWARD, HEAD_VERSION, COMPAT_VERSION),
+    Message{MSG_FORWARD, HEAD_VERSION, COMPAT_VERSION},
     tid(t), client_caps(caps), msg(NULL) {
     client_type = m->get_source().type();
     client_addrs = m->get_source_addrs();
@@ -151,6 +149,9 @@ public:
       << " tid " << tid
       << " con_features " << con_features << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
   
 #endif
index fe8b4187c5539c1ddc4918cf8e3a3607e72d6145..24dd46b64f8d8ab2df5e15c5d920c6c8c81904f6 100644 (file)
@@ -4,16 +4,13 @@
 #include "msg/Message.h"
 
 
-class MGatherCaps : public MessageInstance<MGatherCaps> {
+class MGatherCaps : public Message {
 public:
-  friend factory;
-
-
   inodeno_t ino;
 
 protected:
   MGatherCaps() :
-    MessageInstance(MSG_MDS_GATHERCAPS) {}
+    Message{MSG_MDS_GATHERCAPS} {}
   ~MGatherCaps() override {}
 
 public:
@@ -31,7 +28,9 @@ public:
     auto p = payload.cbegin();
     decode(ino, p);
   }
-
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 49e906d6f0f58475e2381f652c09160d896472b6..32699728ada05d2abe3a83fe0e41fbc4193a66d8 100644 (file)
 
 #include "msg/Message.h"
 
-class MGenericMessage : public MessageInstance<MGenericMessage> {
-public:
-  friend factory;
+class MGenericMessage : public Message {
 private:
   char tname[20];
   //long pcid;
 
  public:
-  MGenericMessage(int t=0) : MessageInstance(t) { 
+  MGenericMessage(int t=0) : Message{t} {
     snprintf(tname, sizeof(tname), "generic%d", get_type());
   }
 
index aa8429fc74b237d4ab05d16d220391eb99742aee..2575aa4bce455498cdbfb0802a2138a6bbb4c183 100644 (file)
@@ -5,10 +5,8 @@
 
 #include "msg/Message.h"
 
-class MGetConfig : public MessageInstance<MGetConfig> {
+class MGetConfig : public Message {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 1;
   static constexpr int COMPAT_VERSION = 1;
 
@@ -16,9 +14,9 @@ public:
   std::string host;      ///< our hostname
   std::string device_class;
 
-  MGetConfig() : MessageInstance(MSG_GET_CONFIG, HEAD_VERSION, COMPAT_VERSION) { }
+  MGetConfig() : Message{MSG_GET_CONFIG, HEAD_VERSION, COMPAT_VERSION} { }
   MGetConfig(const EntityName& n, const std::string& h)
-    : MessageInstance(MSG_GET_CONFIG, HEAD_VERSION, COMPAT_VERSION),
+    : Message{MSG_GET_CONFIG, HEAD_VERSION, COMPAT_VERSION},
       name(n),
       host(h) {}
 
index 50e40c788b32623ded696dab88fe617253365a39..51bc134a21f7704bbd9fd2361fc5f86c3ddc870a 100644 (file)
 
 #include "messages/PaxosServiceMessage.h"
 
-class MGetPoolStats : public MessageInstance<MGetPoolStats, PaxosServiceMessage> {
+class MGetPoolStats : public PaxosServiceMessage {
 public:
-  friend factory;
-
   uuid_d fsid;
   std::list<std::string> pools;
 
-  MGetPoolStats() : MessageInstance(MSG_GETPOOLSTATS, 0) {}
+  MGetPoolStats() : PaxosServiceMessage{MSG_GETPOOLSTATS, 0} {}
   MGetPoolStats(const uuid_d& f, ceph_tid_t t, std::list<std::string>& ls, version_t l) :
-    MessageInstance(MSG_GETPOOLSTATS, l),
+    PaxosServiceMessage{MSG_GETPOOLSTATS, l},
     fsid(f), pools(ls) {
     set_tid(t);
   }
index 076f3fde3e7dabc86b117943369047bac43d4677..9a7ccb4cc4621f0c48098da347890ca1d10fb3f2 100644 (file)
 #ifndef CEPH_MGETPOOLSTATSREPLY_H
 #define CEPH_MGETPOOLSTATSREPLY_H
 
-class MGetPoolStatsReply : public MessageInstance<MGetPoolStatsReply, PaxosServiceMessage> {
+class MGetPoolStatsReply : public PaxosServiceMessage {
 public:
-  friend factory;
-
   uuid_d fsid;
   std::map<std::string,pool_stat_t> pool_stats;
 
-  MGetPoolStatsReply() : MessageInstance(MSG_GETPOOLSTATSREPLY, 0) {}
+  MGetPoolStatsReply() : PaxosServiceMessage{MSG_GETPOOLSTATSREPLY, 0} {}
   MGetPoolStatsReply(uuid_d& f, ceph_tid_t t, version_t v) :
-    MessageInstance(MSG_GETPOOLSTATSREPLY, v),
+    PaxosServiceMessage{MSG_GETPOOLSTATSREPLY, v},
     fsid(f) {
     set_tid(t);
   }
@@ -52,6 +50,9 @@ public:
     decode(fsid, p);
     decode(pool_stats, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 50259619e908c988737ed0b9239cdae2c6631b0f..0070fa39ecc75d4d6c389f09d7bf40f87d69fbdd 100644 (file)
@@ -20,9 +20,7 @@
 #include "msg/Message.h"
 #include "common/DecayCounter.h"
 
-class MHeartbeat : public MessageInstance<MHeartbeat> {
-public:
-  friend factory;
+class MHeartbeat : public Message {
 private:
   mds_load_t load;
   __s32        beat = 0;
@@ -36,12 +34,12 @@ private:
   map<mds_rank_t, float>& get_import_map() { return import_map; }
 
 protected:
-  MHeartbeat() : MessageInstance(MSG_MDS_HEARTBEAT), load(DecayRate()) {}
+  MHeartbeat() : Message(MSG_MDS_HEARTBEAT), load(DecayRate()) {}
   MHeartbeat(mds_load_t& load, int beat)
-    : MessageInstance(MSG_MDS_HEARTBEAT),
-      load(load) {
-    this->beat = beat;
-  }
+    : Message(MSG_MDS_HEARTBEAT),
+      load(load),
+      beat(beat)
+  {}
   ~MHeartbeat() override {}
 
 public:
@@ -59,7 +57,9 @@ public:
     decode(beat, p);
     decode(import_map, p);
   }
-
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 0d32dcd720f2e62c7c7b562175ede0976e468af3..6bd636bf47d6815566449e92f05bccc9a3e7c0f8 100644 (file)
@@ -18,9 +18,7 @@
 
 #include "msg/Message.h"
 
-class MInodeFileCaps : public MessageInstance<MInodeFileCaps> {
-public:
-  friend factory;
+class MInodeFileCaps : public Message {
 private:
   inodeno_t ino;
   __u32     caps = 0;
@@ -31,9 +29,9 @@ private:
   int       get_caps() const { return caps; }
 
 protected:
-  MInodeFileCaps() : MessageInstance(MSG_MDS_INODEFILECAPS) {}
+  MInodeFileCaps() : Message{MSG_MDS_INODEFILECAPS} {}
   MInodeFileCaps(inodeno_t ino, int caps) :
-    MessageInstance(MSG_MDS_INODEFILECAPS) {
+    Message{MSG_MDS_INODEFILECAPS} {
     this->ino = ino;
     this->caps = caps;
   }
@@ -56,6 +54,9 @@ public:
     decode(ino, p);
     decode(caps, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index decaabae7be7734a665fa460f05026770bcd10ca..cfa4b271985ed7bcf91399fb8b45f8bbe0a05877 100644 (file)
@@ -20,9 +20,7 @@
 #include "mds/locks.h"
 #include "mds/SimpleLock.h"
 
-class MLock : public MessageInstance<MLock> {
-public:
-  friend factory;
+class MLock : public Message {
 private:
   int32_t     action = 0;  // action type
   mds_rank_t  asker = 0;  // who is initiating this request
@@ -45,19 +43,19 @@ public:
   MDSCacheObjectInfo &get_object_info() { return object_info; }
 
 protected:
-  MLock() : MessageInstance(MSG_MDS_LOCK) {}
+  MLock() : Message{MSG_MDS_LOCK} {}
   MLock(int ac, mds_rank_t as) :
-    MessageInstance(MSG_MDS_LOCK),
+    Message{MSG_MDS_LOCK},
     action(ac), asker(as),
     lock_type(0) { }
   MLock(SimpleLock *lock, int ac, mds_rank_t as) :
-    MessageInstance(MSG_MDS_LOCK),
+    Message{MSG_MDS_LOCK},
     action(ac), asker(as),
     lock_type(lock->get_type()) {
     lock->get_parent()->set_object_info(object_info);
   }
   MLock(SimpleLock *lock, int ac, mds_rank_t as, bufferlist& bl) :
-    MessageInstance(MSG_MDS_LOCK),
+    Message{MSG_MDS_LOCK},
     action(ac), asker(as), lock_type(lock->get_type()) {
     lock->get_parent()->set_object_info(object_info);
     lockdata.claim(bl);
@@ -97,7 +95,9 @@ public:
     encode(object_info, payload);
     encode(lockdata, payload);
   }
-
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index d2c6e9e9914869cc9e9508dd89eaf95acc06fe03..0141bf2090b9c8ff409cb0641fa8f15eebd4b0f8 100644 (file)
 
 #include <deque>
 
-class MLog : public MessageInstance<MLog, PaxosServiceMessage> {
+class MLog : public PaxosServiceMessage {
 public:
-  friend factory;
-
   uuid_d fsid;
   std::deque<LogEntry> entries;
   
-  MLog() : MessageInstance(MSG_LOG, 0) {}
+  MLog() : PaxosServiceMessage{MSG_LOG, 0} {}
   MLog(const uuid_d& f, const std::deque<LogEntry>& e)
-    : MessageInstance(MSG_LOG, 0), fsid(f), entries(e) { }
-  MLog(const uuid_d& f) : MessageInstance(MSG_LOG, 0), fsid(f) { }
+    : PaxosServiceMessage{MSG_LOG, 0}, fsid(f), entries(e) { }
+  MLog(const uuid_d& f) : PaxosServiceMessage(MSG_LOG, 0), fsid(f) { }
 private:
   ~MLog() override {}
 
index ac819e184094298fe7f4ce7e8e5cc93949dd0397..977f909d01e5f5c6c84100024939b1fcfd2c9505 100644 (file)
 
 #include "msg/Message.h"
 
-class MLogAck : public MessageInstance<MLogAck> {
+class MLogAck : public Message {
 public:
-  friend factory;
-
   uuid_d fsid;
   version_t last = 0;
   std::string channel;
 
-  MLogAck() : MessageInstance(MSG_LOGACK) {}
-  MLogAck(uuid_d& f, version_t l) : MessageInstance(MSG_LOGACK), fsid(f), last(l) {}
+  MLogAck() : Message{MSG_LOGACK} {}
+  MLogAck(uuid_d& f, version_t l) : Message{MSG_LOGACK}, fsid(f), last(l) {}
 private:
   ~MLogAck() override {}
 
@@ -56,6 +54,9 @@ public:
     if (!p.end())
       decode(channel, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 318109a8697508b62eabf406a540a3ce91c636ad..bfd52cb4b91df97f340cec05573b40cb18ce8891 100644 (file)
@@ -179,9 +179,7 @@ struct MDSHealth
 WRITE_CLASS_ENCODER(MDSHealth)
 
 
-class MMDSBeacon : public MessageInstance<MMDSBeacon, PaxosServiceMessage> {
-public:
-  friend factory;
+class MMDSBeacon : public PaxosServiceMessage {
 private:
 
   static constexpr int HEAD_VERSION = 7;
@@ -203,12 +201,12 @@ private:
   uint64_t mds_features = 0;
 
 protected:
-  MMDSBeacon() : MessageInstance(MSG_MDS_BEACON, 0, HEAD_VERSION, COMPAT_VERSION)
+  MMDSBeacon() : PaxosServiceMessage(MSG_MDS_BEACON, 0, HEAD_VERSION, COMPAT_VERSION)
   {
     set_priority(CEPH_MSG_PRIO_HIGH);
   }
   MMDSBeacon(const uuid_d &f, mds_gid_t g, const string& n, epoch_t les, MDSMap::DaemonState st, version_t se, uint64_t feat) :
-    MessageInstance(MSG_MDS_BEACON, les, HEAD_VERSION, COMPAT_VERSION),
+    PaxosServiceMessage(MSG_MDS_BEACON, les, HEAD_VERSION, COMPAT_VERSION),
     fsid(f), global_id(g), name(n), state(st), seq(se),
     mds_features(feat) {
     set_priority(CEPH_MSG_PRIO_HIGH);
@@ -296,6 +294,9 @@ public:
       state = MDSMap::STATE_STANDBY;
     }
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 985adb524076c80f971b61dc45732d028d88ab89..61a9ea2622bad3e614e2de0d0e4723e545d04535 100644 (file)
 
 // sent from replica to auth
 
-class MMDSCacheRejoin : public MessageInstance<MMDSCacheRejoin> {
-public:
-  friend factory;
+class MMDSCacheRejoin : public Message {
 private:
-
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
 
@@ -216,10 +213,10 @@ private:
   
 protected:
   MMDSCacheRejoin() :
-    MessageInstance(MSG_MDS_CACHEREJOIN, HEAD_VERSION, COMPAT_VERSION),
-    op(0) {}
+    MMDSCacheRejoin{0}
+  {}
   MMDSCacheRejoin(int o) : 
-    MessageInstance(MSG_MDS_CACHEREJOIN, HEAD_VERSION, COMPAT_VERSION),
+    Message{MSG_MDS_CACHEREJOIN, HEAD_VERSION, COMPAT_VERSION},
     op(o) {}
   ~MMDSCacheRejoin() override {}
 
@@ -355,7 +352,9 @@ public:
     if (header.version >= 2)
       decode(client_metadata_map, p);
   }
-
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 WRITE_CLASS_ENCODER(MMDSCacheRejoin::inode_strong)
index a6d661b9471e9e47d884079f1eba5f0eedad6a22..e585d843e763314d07938580730b897d11401179 100644 (file)
 #include "msg/Message.h"
 #include "include/filepath.h"
 
-class MMDSFindIno : public MessageInstance<MMDSFindIno> {
+class MMDSFindIno : public Message {
 public:
-  friend factory;
-
   ceph_tid_t tid {0};
   inodeno_t ino;
 
 protected:
-  MMDSFindIno() : MessageInstance(MSG_MDS_FINDINO) {}
-  MMDSFindIno(ceph_tid_t t, inodeno_t i) : MessageInstance(MSG_MDS_FINDINO), tid(t), ino(i) {}
+  MMDSFindIno() : Message{MSG_MDS_FINDINO} {}
+  MMDSFindIno(ceph_tid_t t, inodeno_t i) : Message{MSG_MDS_FINDINO}, tid(t), ino(i) {}
   ~MMDSFindIno() override {}
 
 public:
@@ -46,6 +44,9 @@ public:
     decode(tid, p);
     decode(ino, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 10e003b3d14da5e74f0ec5b667ad12ec02c19e5e..f00cd933413e4469ec5c83b023befd76d24f4764 100644 (file)
 #include "msg/Message.h"
 #include "include/filepath.h"
 
-class MMDSFindInoReply : public MessageInstance<MMDSFindInoReply> {
+class MMDSFindInoReply : public Message {
 public:
-  friend factory;
-
   ceph_tid_t tid = 0;
   filepath path;
 
 protected:
-  MMDSFindInoReply() : MessageInstance(MSG_MDS_FINDINOREPLY) {}
-  MMDSFindInoReply(ceph_tid_t t) : MessageInstance(MSG_MDS_FINDINOREPLY), tid(t) {}
+  MMDSFindInoReply() : Message{MSG_MDS_FINDINOREPLY} {}
+  MMDSFindInoReply(ceph_tid_t t) : Message{MSG_MDS_FINDINOREPLY}, tid(t) {}
   ~MMDSFindInoReply() override {}
 
 public:
@@ -46,6 +44,9 @@ public:
     decode(tid, p);
     decode(path, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 0baa874f95cc32738ec91970af2f4d336a66503f..3a12ccb11e3e0b8d6a2d9987fc1b0bd316eba5c8 100644 (file)
@@ -17,9 +17,7 @@
 
 #include "msg/Message.h"
 
-class MMDSFragmentNotify : public MessageInstance<MMDSFragmentNotify> {
-public:
-  friend factory;
+class MMDSFragmentNotify : public Message {
 private:
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
@@ -40,9 +38,9 @@ private:
 
 protected:
   MMDSFragmentNotify() :
-    MessageInstance(MSG_MDS_FRAGMENTNOTIFY, HEAD_VERSION, COMPAT_VERSION) {}
+    Message{MSG_MDS_FRAGMENTNOTIFY, HEAD_VERSION, COMPAT_VERSION} {}
   MMDSFragmentNotify(dirfrag_t df, int b, uint64_t tid) :
-    MessageInstance(MSG_MDS_FRAGMENTNOTIFY, HEAD_VERSION, COMPAT_VERSION),
+    Message{MSG_MDS_FRAGMENTNOTIFY, HEAD_VERSION, COMPAT_VERSION},
     base_dirfrag(df), bits(b) {
     set_tid(tid);
   }
@@ -69,7 +67,9 @@ public:
     if (header.version >= 2)
       decode(ack_wanted, p);
   }
-  
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);  
 };
 
 #endif
index e20a3089ec2ff6c13421d62d60302ee4da3b4aff..a067dfc36d2e1f0ed2c71481ff05ff8c890b49d9 100644 (file)
@@ -17,9 +17,7 @@
 
 #include "msg/Message.h"
 
-class MMDSFragmentNotifyAck : public MessageInstance<MMDSFragmentNotifyAck> {
-public:
-  friend factory;
+class MMDSFragmentNotifyAck : public Message {
 private:
   dirfrag_t base_dirfrag;
   int8_t bits = 0;
@@ -31,9 +29,9 @@ private:
   bufferlist basebl;
 
 protected:
-  MMDSFragmentNotifyAck() : MessageInstance(MSG_MDS_FRAGMENTNOTIFYACK) {}
+  MMDSFragmentNotifyAck() : Message{MSG_MDS_FRAGMENTNOTIFYACK} {}
   MMDSFragmentNotifyAck(dirfrag_t df, int b, uint64_t tid) :
-    MessageInstance(MSG_MDS_FRAGMENTNOTIFYACK),
+    Message{MSG_MDS_FRAGMENTNOTIFYACK},
     base_dirfrag(df), bits(b) {
     set_tid(tid);
   }
@@ -55,6 +53,9 @@ public:
     decode(base_dirfrag, p);
     decode(bits, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 98d845de3b870b4afe656480f4cb86d7c5da9be2..eb9edf21459bd0610a9e981e1ca9b0712e5f7603 100644 (file)
 #include <map>
 using std::map;
 
-class MMDSLoadTargets : public MessageInstance<MMDSLoadTargets, PaxosServiceMessage> {
+class MMDSLoadTargets : public PaxosServiceMessage {
 public:
-  friend factory;
-
   mds_gid_t global_id;
   set<mds_rank_t> targets;
 
 protected:
-  MMDSLoadTargets() : MessageInstance(MSG_MDS_OFFLOAD_TARGETS, 0) {}
+  MMDSLoadTargets() : PaxosServiceMessage(MSG_MDS_OFFLOAD_TARGETS, 0) {}
   MMDSLoadTargets(mds_gid_t g, set<mds_rank_t>& mds_targets) :
-    MessageInstance(MSG_MDS_OFFLOAD_TARGETS, 0),
+    PaxosServiceMessage(MSG_MDS_OFFLOAD_TARGETS, 0),
     global_id(g), targets(mds_targets) {}
   ~MMDSLoadTargets() override {}
 
@@ -57,6 +55,9 @@ public:
     encode(global_id, payload);
     encode(targets, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 726cfac52ef0a7568f8d0578f7054f72d78d27c2..ed10459ef62b7d74207d5accab05ef6a91b6a37b 100644 (file)
@@ -20,9 +20,7 @@
 #include "mds/MDSMap.h"
 #include "include/ceph_features.h"
 
-class MMDSMap : public MessageInstance<MMDSMap> {
-public:
-  friend factory;
+class MMDSMap : public Message {
 private:
   static constexpr int HEAD_VERSION = 1;
   static constexpr int COMPAT_VERSION = 1;
@@ -36,9 +34,9 @@ public:
 
 protected:
   MMDSMap() : 
-    MessageInstance(CEPH_MSG_MDS_MAP, HEAD_VERSION, COMPAT_VERSION) {}
+    Message{CEPH_MSG_MDS_MAP, HEAD_VERSION, COMPAT_VERSION} {}
   MMDSMap(const uuid_d &f, const MDSMap &mm) :
-    MessageInstance(CEPH_MSG_MDS_MAP, HEAD_VERSION, COMPAT_VERSION),
+    Message{CEPH_MSG_MDS_MAP, HEAD_VERSION, COMPAT_VERSION},
     fsid(f) {
     epoch = mm.get_epoch();
     mm.encode(encoded, -1);  // we will reencode with fewer features as necessary
@@ -74,6 +72,9 @@ public:
     }
     encode(encoded, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index b9a068bed32dfa1f65eca0d53f37c7c702f53ea2..23605225ad245c99d928087899d95552d7137f17 100644 (file)
 
 #include "msg/Message.h"
 
-class MMDSOpenIno : public MessageInstance<MMDSOpenIno> {
+class MMDSOpenIno : public Message {
 public:
-  friend factory;
-
   inodeno_t ino;
   vector<inode_backpointer_t> ancestors;
 
 protected:
-  MMDSOpenIno() : MessageInstance(MSG_MDS_OPENINO) {}
+  MMDSOpenIno() : Message{MSG_MDS_OPENINO} {}
   MMDSOpenIno(ceph_tid_t t, inodeno_t i, vector<inode_backpointer_t>* pa) :
-    MessageInstance(MSG_MDS_OPENINO), ino(i) {
+    Message{MSG_MDS_OPENINO}, ino(i) {
     header.tid = t;
     if (pa)
       ancestors = *pa;
@@ -50,6 +48,9 @@ public:
     decode(ino, p);
     decode(ancestors, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 6f87e6a90e5547eea1eb600119831c7644a5d5d2..4cfca9aecb1fd38264f4b388ecb8302e98534ddd 100644 (file)
 
 #include "msg/Message.h"
 
-class MMDSOpenInoReply : public MessageInstance<MMDSOpenInoReply> {
+class MMDSOpenInoReply : public Message {
 public:
-  friend factory;
-
   inodeno_t ino;
   vector<inode_backpointer_t> ancestors;
   mds_rank_t hint;
   int32_t error;
 
 protected:
-  MMDSOpenInoReply() : MessageInstance(MSG_MDS_OPENINOREPLY), error(0) {}
+  MMDSOpenInoReply() : Message{MSG_MDS_OPENINOREPLY}, error(0) {}
   MMDSOpenInoReply(ceph_tid_t t, inodeno_t i, mds_rank_t h=MDS_RANK_NONE, int e=0) :
-    MessageInstance(MSG_MDS_OPENINOREPLY), ino(i), hint(h), error(e) {
+    Message{MSG_MDS_OPENINOREPLY}, ino(i), hint(h), error(e) {
     header.tid = t;
   }
 
@@ -55,6 +53,9 @@ public:
     decode(hint, p);
     decode(error, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 52fad12e7cd58ff2029026eda0957c32787c3405..68b9d4a218d659c250c8a3b3a1f9ed9c738f4b7b 100644 (file)
 
 #include "include/types.h"
 
-class MMDSResolve : public MessageInstance<MMDSResolve> {
+class MMDSResolve : public Message {
 public:
-  friend factory;
-
   map<dirfrag_t, vector<dirfrag_t> > subtrees;
   map<dirfrag_t, vector<dirfrag_t> > ambiguous_imports;
 
@@ -68,7 +66,8 @@ public:
   list<table_client> table_clients;
 
 protected:
-  MMDSResolve() : MessageInstance(MSG_MDS_RESOLVE) {}
+  MMDSResolve() : Message{MSG_MDS_RESOLVE}
+ {}
   ~MMDSResolve() override {}
 
 public:
@@ -118,6 +117,9 @@ public:
     decode(slave_requests, p);
     decode(table_clients, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 inline ostream& operator<<(ostream& out, const MMDSResolve::slave_request&) {
index 4269883433331923d36cc78d7ff6b18e1fd2bf0b..a754b3ca153ae244d6da70fb8b4ee4334c4a9c61 100644 (file)
 #include "include/types.h"
 
 
-class MMDSResolveAck : public MessageInstance<MMDSResolveAck> {
+class MMDSResolveAck : public Message {
 public:
-  friend factory;
-
   map<metareqid_t, bufferlist> commit;
   vector<metareqid_t> abort;
 
 protected:
-  MMDSResolveAck() : MessageInstance(MSG_MDS_RESOLVEACK) {}
+  MMDSResolveAck() : Message{MSG_MDS_RESOLVEACK} {}
   ~MMDSResolveAck() override {}
 
 public:
@@ -58,6 +56,9 @@ public:
     decode(commit, p);
     decode(abort, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index f9be3af824f52020e1048b8420cfd837d7561732..3bdec7a095cff7d9fce2fa9036aa8825741f6f5d 100644 (file)
 #include "msg/Message.h"
 #include "mds/mdstypes.h"
 
-class MMDSSlaveRequest : public MessageInstance<MMDSSlaveRequest> {
+class MMDSSlaveRequest : public Message {
 public:
-  friend factory;
-
   static constexpr int OP_XLOCK =       1;
   static constexpr int OP_XLOCKACK =   -1;
   static constexpr int OP_UNXLOCK =     2;
@@ -158,9 +156,9 @@ public:
   bufferlist& get_lock_data() { return inode_export; }
 
 protected:
-  MMDSSlaveRequest() : MessageInstance(MSG_MDS_SLAVE_REQUEST) { }
+  MMDSSlaveRequest() : Message{MSG_MDS_SLAVE_REQUEST} { }
   MMDSSlaveRequest(metareqid_t ri, __u32 att, int o) : 
-    MessageInstance(MSG_MDS_SLAVE_REQUEST),
+    Message{MSG_MDS_SLAVE_REQUEST},
     reqid(ri), attempt(att), op(o), flags(0), lock_type(0),
     inode_export_v(0), srcdn_auth(MDS_RANK_NONE) { }
   ~MMDSSlaveRequest() override {}
@@ -214,7 +212,9 @@ public:
        << " " << get_opname(op) 
        << ")";
   }  
-       
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);   
 };
 
 #endif
index 06872cdc153b80f227bcbe3c89382422ed85c002..d63f1a55cc15661cf1cf702d2099745f518d0caa 100644 (file)
 
 #include "msg/Message.h"
 
-class MMDSSnapUpdate : public MessageInstance<MMDSSnapUpdate> {
-public:
-  friend factory;
+class MMDSSnapUpdate : public Message {
 private:
-
   inodeno_t ino;
   __s16 snap_op;
 
@@ -32,9 +29,9 @@ public:
   bufferlist snap_blob;
 
 protected:
-  MMDSSnapUpdate() : MessageInstance(MSG_MDS_SNAPUPDATE) {}
+  MMDSSnapUpdate() : Message{MSG_MDS_SNAPUPDATE} {}
   MMDSSnapUpdate(inodeno_t i, version_t tid, int op) :
-    MessageInstance(MSG_MDS_SNAPUPDATE), ino(i), snap_op(op) {
+    Message{MSG_MDS_SNAPUPDATE}, ino(i), snap_op(op) {
       set_tid(tid);
     }
   ~MMDSSnapUpdate() override {}
@@ -58,6 +55,9 @@ public:
     decode(snap_op, p);
     decode(snap_blob, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 4a6e2ca97e48e0b9e2d1633e66f2da109fb9ff03..0d929f7961a2769953643b741b4f242c6c9e42c6 100644 (file)
 #include "msg/Message.h"
 #include "mds/mds_table_types.h"
 
-class MMDSTableRequest : public MessageInstance<MMDSTableRequest> {
+class MMDSTableRequest : public Message {
 public:
-  friend factory;
-
   __u16 table = 0;
   __s16 op = 0;
   uint64_t reqid = 0;
   bufferlist bl;
 
 protected:
-  MMDSTableRequest() : MessageInstance(MSG_MDS_TABLE_REQUEST) {}
+  MMDSTableRequest() : Message{MSG_MDS_TABLE_REQUEST} {}
   MMDSTableRequest(int tab, int o, uint64_t r, version_t v=0) : 
-    MessageInstance(MSG_MDS_TABLE_REQUEST),
+    Message{MSG_MDS_TABLE_REQUEST},
     table(tab), op(o), reqid(r) {
     set_tid(v);
   }
@@ -63,6 +61,9 @@ public:
     encode(reqid, payload);
     encode(bl, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index f3bb8384c1d36eb52b7bfe4de60d363ff3534a65..bf93b54ab0e0e564d4a29fa52353163c2a57bab4 100644 (file)
 #include "include/types.h"
 
 
-class MMgrBeacon : public MessageInstance<MMgrBeacon, PaxosServiceMessage> {
-public:
-  friend factory;
+class MMgrBeacon : public PaxosServiceMessage {
 private:
-
   static constexpr int HEAD_VERSION = 8;
   static constexpr int COMPAT_VERSION = 8;
 
@@ -50,16 +47,15 @@ protected:
 
 public:
   MMgrBeacon()
-    : MessageInstance(MSG_MGR_BEACON, 0, HEAD_VERSION, COMPAT_VERSION),
+    : PaxosServiceMessage{MSG_MGR_BEACON, 0, HEAD_VERSION, COMPAT_VERSION},
       gid(0), available(false)
-  {
-  }
+  {}
 
   MMgrBeacon(const uuid_d& fsid_, uint64_t gid_, const std::string &name_,
              entity_addrvec_t server_addrs_, bool available_,
             std::vector<MgrMap::ModuleInfo>&& modules_,
             map<string,string>&& metadata_)
-    : MessageInstance(MSG_MGR_BEACON, 0, HEAD_VERSION, COMPAT_VERSION),
+    : PaxosServiceMessage{MSG_MGR_BEACON, 0, HEAD_VERSION, COMPAT_VERSION},
       gid(gid_), server_addrs(server_addrs_), available(available_), name(name_),
       fsid(fsid_), modules(std::move(modules_)), metadata(std::move(metadata_))
   {
@@ -179,6 +175,9 @@ public:
       decode(modules, p);
     }
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 
index 47943d08f75c1a0103cd2472c47a46a51c015676..680ce273c13753acf85334a83c8a9037799c74d5 100644 (file)
@@ -5,9 +5,7 @@
 
 #include "msg/Message.h"
 
-class MMgrClose : public MessageInstance<MMgrClose> {
-public:
-  friend factory;
+class MMgrClose : public Message {
 private:
 
   static constexpr int HEAD_VERSION = 1;
@@ -44,6 +42,10 @@ public:
   }
 
   MMgrClose()
-    : MessageInstance(MSG_MGR_CLOSE, HEAD_VERSION, COMPAT_VERSION)
+    : Message{MSG_MGR_CLOSE, HEAD_VERSION, COMPAT_VERSION}
   {}
+
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
index 9e9f1af5908f469be0d1818a9955a26dd253b856..55f8869954f4698baade04a9934015f4f7aba357 100644 (file)
  * This message is sent from ceph-mgr to MgrClient, instructing it
  * it about what data to send back to ceph-mgr at what frequency.
  */
-class MMgrConfigure : public MessageInstance<MMgrConfigure> {
-public:
-  friend factory;
+class MMgrConfigure : public Message {
 private:
-
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 1;
 
@@ -64,9 +61,12 @@ public:
                           << ", threshold=" << stats_threshold << ")";
   }
 
+private:
   MMgrConfigure()
-    : MessageInstance(MSG_MGR_CONFIGURE, HEAD_VERSION, COMPAT_VERSION)
+    : Message{MSG_MGR_CONFIGURE, HEAD_VERSION, COMPAT_VERSION}
   {}
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index ec4800d4ab692f111ecc37481fc012c74ed88169..b92a8c291e4fead5d392a39227f67ea6fb00c0bf 100644 (file)
  * The mgr digest is a way for the mgr to subscribe to things
  * other than the cluster maps, which are needed by 
  */
-class MMgrDigest : public MessageInstance<MMgrDigest> {
+class MMgrDigest : public Message {
 public:
-  friend factory;
-
   bufferlist mon_status_json;
   bufferlist health_json;
 
-  MMgrDigest() : 
-    MessageInstance(MSG_MGR_DIGEST) {}
-
   std::string_view get_type_name() const override { return "mgrdigest"; }
   void print(ostream& out) const override {
     out << get_type_name();
@@ -49,8 +44,12 @@ public:
   }
 
 private:
+  MMgrDigest() :
+    Message{MSG_MGR_DIGEST} {}
   ~MMgrDigest() override {}
 
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index a0b63a7d46c42db0dc8aa93c8e871963a5534e5f..46c52ca9deb0d3f5c0c089f81e73a89db041b4f2 100644 (file)
 #include "msg/Message.h"
 #include "mon/MgrMap.h"
 
-class MMgrMap : public MessageInstance<MMgrMap> {
-public:
-  friend factory;
-
+class MMgrMap : public Message {
 protected:
   MgrMap map;
 
 public:
   const MgrMap & get_map() {return map;}
 
+private:
   MMgrMap() : 
-    MessageInstance(MSG_MGR_MAP) {}
+    Message{MSG_MGR_MAP} {}
   MMgrMap(const MgrMap &map_) :
-    MessageInstance(MSG_MGR_MAP), map(map_)
-  {
-  }
-
-private:
+    Message{MSG_MGR_MAP}, map(map_)
+  {}
   ~MMgrMap() override {}
 
 public:
@@ -53,6 +48,9 @@ public:
     using ceph::encode;
     encode(map, payload, features);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 5d5983abe80f3b527122d53deb62426b3be8d298..a55ebaa7661f31a3e2768d184f02636962184327 100644 (file)
 
 #include "msg/Message.h"
 
-class MMgrOpen : public MessageInstance<MMgrOpen> {
-public:
-  friend factory;
+class MMgrOpen : public Message {
 private:
-
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 1;
 
@@ -87,9 +84,12 @@ public:
     out << ")";
   }
 
+private:
   MMgrOpen()
-    : MessageInstance(MSG_MGR_OPEN, HEAD_VERSION, COMPAT_VERSION)
+    : Message{MSG_MGR_OPEN, HEAD_VERSION, COMPAT_VERSION}
   {}
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index b203c449ed26d14cfef6beb462eff00e45253aea..3de4720a9a9afa764e222649bdb3403d12fde4ac 100644 (file)
@@ -71,11 +71,8 @@ public:
 };
 WRITE_CLASS_ENCODER(PerfCounterType)
 
-class MMgrReport : public MessageInstance<MMgrReport> {
-public:
-  friend factory;
+class MMgrReport : public Message {
 private:
-
   static constexpr int HEAD_VERSION = 7;
   static constexpr int COMPAT_VERSION = 1;
 
@@ -168,8 +165,11 @@ public:
   }
 
   MMgrReport()
-    : MessageInstance(MSG_MGR_REPORT, HEAD_VERSION, COMPAT_VERSION)
+    : Message{MSG_MGR_REPORT, HEAD_VERSION, COMPAT_VERSION}
   {}
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index e652f24a32fbe4505ac10752b62e81dcf6b4b0ef..8b4c1af9e43cd957241bac45bf30eeebde8d2bf8 100644 (file)
 #include <vector>
 #include <string>
 
-class MMonCommand : public MessageInstance<MMonCommand, PaxosServiceMessage> {
+class MMonCommand : public PaxosServiceMessage {
 public:
-  friend factory;
-
   uuid_d fsid;
   std::vector<std::string> cmd;
 
-  MMonCommand() : MessageInstance(MSG_MON_COMMAND, 0) {}
+  MMonCommand() : PaxosServiceMessage{MSG_MON_COMMAND, 0} {}
   MMonCommand(const uuid_d &f)
-    : MessageInstance(MSG_MON_COMMAND, 0),
+    : PaxosServiceMessage{MSG_MON_COMMAND, 0},
       fsid(f)
   { }
 
@@ -60,6 +58,9 @@ public:
     decode(fsid, p);
     decode(cmd, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 9ea4035583e9314df3c0ff2ce740e6c414d5825d..0eea4d26cb7d544b84eb44f744ee8399d2ec08be 100644 (file)
 
 #include "messages/PaxosServiceMessage.h"
 
-class MMonCommandAck : public MessageInstance<MMonCommandAck, PaxosServiceMessage> {
+class MMonCommandAck : public PaxosServiceMessage {
 public:
-  friend factory;
-
   std::vector<std::string> cmd;
   errorcode32_t r;
   std::string rs;
 
-  MMonCommandAck() : MessageInstance(MSG_MON_COMMAND_ACK, 0) {}
+  MMonCommandAck() : PaxosServiceMessage{MSG_MON_COMMAND_ACK, 0} {}
   MMonCommandAck(std::vector<std::string>& c, int _r, std::string s, version_t v) : 
-    MessageInstance(MSG_MON_COMMAND_ACK, v),
+    PaxosServiceMessage{MSG_MON_COMMAND_ACK, v},
     cmd(c), r(_r), rs(s) { }
 private:
   ~MMonCommandAck() override {}
@@ -53,6 +51,9 @@ public:
     decode(rs, p);
     decode(cmd, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 0114ea12e7715ee39ed41607530a93148b2e9098..869b2360fb4a41611dfd11708eb314bb3844d926 100644 (file)
 #include "mon/MonMap.h"
 #include "mon/mon_types.h"
 
-class MMonElection : public MessageInstance<MMonElection> {
-public:
-  friend factory;
-
+class MMonElection : public Message {
 private:
   static constexpr int HEAD_VERSION = 8;
   static constexpr int COMPAT_VERSION = 5;
@@ -54,14 +51,14 @@ public:
   bufferlist sharing_bl;
   map<string,string> metadata;
   
-  MMonElection() : MessageInstance(MSG_MON_ELECTION, HEAD_VERSION, COMPAT_VERSION),
+  MMonElection() : Message{MSG_MON_ELECTION, HEAD_VERSION, COMPAT_VERSION},
     op(0), epoch(0),
     quorum_features(0),
     mon_features(0)
   { }
 
   MMonElection(int o, epoch_t e, MonMap *m)
-    : MessageInstance(MSG_MON_ELECTION, HEAD_VERSION, COMPAT_VERSION),
+    : Message{MSG_MON_ELECTION, HEAD_VERSION, COMPAT_VERSION},
       fsid(m->fsid), op(o), epoch(e),
       quorum_features(0),
       mon_features(0)
@@ -126,7 +123,9 @@ public:
     else
       mon_release = infer_ceph_release_from_mon_features(mon_features);
   }
-  
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);  
 };
 
 #endif
index 99950ef4aa4d68ca9e292b9da91f74840a0b1447..5b81d1dc92e84199f200df10f388257cc5c88223 100644 (file)
 
 #include "include/types.h"
 
-class MMonGetMap : public MessageInstance<MMonGetMap> {
+class MMonGetMap : public Message {
 public:
-  friend factory;
-
-  MMonGetMap() : MessageInstance(CEPH_MSG_MON_GET_MAP) { }
+  MMonGetMap() : Message{CEPH_MSG_MON_GET_MAP} { }
 private:
   ~MMonGetMap() override {}
 
@@ -32,6 +30,10 @@ public:
   
   void encode_payload(uint64_t features) override { }
   void decode_payload() override { }
+
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index c842c619ad5cca6ca66b127f3980ddf173bd0602..a9c8cbfa3ca761bfd55a03f99399908c528126b0 100644 (file)
 
 #include "include/types.h"
 
-class MMonGetOSDMap : public MessageInstance<MMonGetOSDMap, PaxosServiceMessage> {
-public:
-  friend factory;
+class MMonGetOSDMap : public PaxosServiceMessage {
 private:
-
   epoch_t full_first, full_last;
   epoch_t inc_first, inc_last;
 
 public:
   MMonGetOSDMap()
-    : MessageInstance(CEPH_MSG_MON_GET_OSDMAP, 0),
+    : PaxosServiceMessage{CEPH_MSG_MON_GET_OSDMAP, 0},
       full_first(0),
       full_last(0),
       inc_first(0),
@@ -92,6 +89,9 @@ public:
     decode(inc_first, p);
     decode(inc_last, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 8768f47156bee99c199ddb41537bc5c2316d3a0d..bd454cf0bc3930812408343d79d96e9eb963218d 100644 (file)
  * can be used to determine whether a pool actually does not exist, or
  * if it may have been created but the map was not received yet.
  */
-class MMonGetVersion : public MessageInstance<MMonGetVersion> {
+class MMonGetVersion : public Message {
 public:
-  friend factory;
-
-  MMonGetVersion() : MessageInstance(CEPH_MSG_MON_GET_VERSION) {}
+  MMonGetVersion() : Message{CEPH_MSG_MON_GET_VERSION} {}
 
   std::string_view get_type_name() const override {
     return "mon_get_version";
index 1187e8bfcf28c82a94bd35757cc789be1ea1832d..1f4dd7e43b113b33472ecaa4d08d0462176d862b 100644 (file)
  * MMonGetVersion. The latest version of the requested thing is sent
  * back.
  */
-class MMonGetVersionReply : public MessageInstance<MMonGetVersionReply> {
-public:
-  friend factory;
+class MMonGetVersionReply : public Message {
 private:
   static constexpr int HEAD_VERSION = 2;
 
 public:
-  MMonGetVersionReply() : MessageInstance(CEPH_MSG_MON_GET_VERSION_REPLY, HEAD_VERSION) { }
+  MMonGetVersionReply() : Message{CEPH_MSG_MON_GET_VERSION_REPLY, HEAD_VERSION} { }
 
   std::string_view get_type_name() const override {
     return "mon_get_version_reply";
index 79535a6b7d84618dca79414d1e8400fd65cf58eb..dde000e7947997486735d195b4308d98670d0b98 100644 (file)
 
 #include "messages/PaxosServiceMessage.h"
 
-class MMonGlobalID : public MessageInstance<MMonGlobalID, PaxosServiceMessage> {
+class MMonGlobalID : public PaxosServiceMessage {
 public:
-  friend factory;
-
-  uint64_t old_max_id;
-  MMonGlobalID() : MessageInstance(MSG_MON_GLOBAL_ID, 0), old_max_id(0) { }
+  uint64_t old_max_id = 0;
+  MMonGlobalID() : PaxosServiceMessage{MSG_MON_GLOBAL_ID, 0}
+  {}
 private:
   ~MMonGlobalID() override {}
 
@@ -42,6 +41,9 @@ public:
     paxos_encode();
     encode(old_max_id, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 1d8371842be771667c6545696a44e0fcfa41fa51..1d4fd73174cf0a4be83e836ba3afbed996a04fa3 100644 (file)
 #include "messages/MMonQuorumService.h"
 #include "mon/mon_types.h"
 
-class MMonHealth : public MessageInstance<MMonHealth, MMonQuorumService> {
+class MMonHealth : public MMonQuorumService {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 1;
 
   int service_type = 0;
@@ -30,7 +28,7 @@ public:
   // service specific data
   DataStats data_stats;
 
-  MMonHealth() : MessageInstance(MSG_MON_HEALTH, HEAD_VERSION) { }
+  MMonHealth() : MMonQuorumService{MSG_MON_HEALTH, HEAD_VERSION} { }
 
 private:
   ~MMonHealth() override { }
@@ -59,7 +57,6 @@ public:
     encode(service_op, payload);
     encode(data_stats, payload);
   }
-
 };
 
 #endif /* CEPH_MMON_HEALTH_H */
index e9e611b1d4f45d07e55a5343d45870cf7be1bfc3..86a4fa0c9208651cc207489e55c1896f1a91d87a 100644 (file)
@@ -7,22 +7,20 @@
 #include "messages/PaxosServiceMessage.h"
 #include "mon/health_check.h"
 
-class MMonHealthChecks : public MessageInstance<MMonHealthChecks, PaxosServiceMessage> {
+class MMonHealthChecks : public PaxosServiceMessage {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 1;
   static constexpr int COMPAT_VERSION = 1;
 
   health_check_map_t health_checks;
 
   MMonHealthChecks()
-    : MessageInstance(MSG_MON_HEALTH_CHECKS, HEAD_VERSION, COMPAT_VERSION) {
+    : PaxosServiceMessage{MSG_MON_HEALTH_CHECKS, HEAD_VERSION, COMPAT_VERSION} {
   }
   MMonHealthChecks(health_check_map_t& m)
-    : MessageInstance(MSG_MON_HEALTH_CHECKS, HEAD_VERSION, COMPAT_VERSION),
-      health_checks(m) {
-  }
+    : PaxosServiceMessage{MSG_MON_HEALTH_CHECKS, HEAD_VERSION, COMPAT_VERSION},
+      health_checks(m)
+  {}
 
 private:
   ~MMonHealthChecks() override { }
@@ -44,7 +42,9 @@ public:
     paxos_encode();
     encode(health_checks, payload);
   }
-
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 15d8ac94a9d57f45c3082c5f819aec3f9b758da3..c5aaa9e7f04e43bbb2bbf0f72bbdf6a4ef8aa169 100644 (file)
 #include <vector>
 using std::vector;
 
-class MMonJoin : public MessageInstance<MMonJoin, PaxosServiceMessage> {
+class MMonJoin : public PaxosServiceMessage {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 2;
 
@@ -31,9 +29,9 @@ public:
   string name;
   entity_addrvec_t addrs;
 
-  MMonJoin() : MessageInstance(MSG_MON_JOIN, 0, HEAD_VERSION, COMPAT_VERSION) {}
+  MMonJoin() : PaxosServiceMessage{MSG_MON_JOIN, 0, HEAD_VERSION, COMPAT_VERSION} {}
   MMonJoin(uuid_d &f, string n, const entity_addrvec_t& av)
-    : MessageInstance(MSG_MON_JOIN, 0, HEAD_VERSION, COMPAT_VERSION),
+    : PaxosServiceMessage{MSG_MON_JOIN, 0, HEAD_VERSION, COMPAT_VERSION},
       fsid(f), name(n), addrs(av)
   { }
   
index 5f0f5eba4e29dc05cf8cd1417261f7f03499af77..e06eabc2500ba22f54ed1ff4cd99cda1eaa89f47 100644 (file)
 #include "msg/MessageRef.h"
 #include "mon/MonMap.h"
 
-class MMonMap : public MessageInstance<MMonMap> {
+class MMonMap : public Message {
 public:
-  friend factory;
-
   ceph::buffer::list monmapbl;
 
-  MMonMap() : MessageInstance(CEPH_MSG_MON_MAP) { }
-  explicit MMonMap(ceph::buffer::list &bl) : MessageInstance(CEPH_MSG_MON_MAP) { 
+  MMonMap() : Message{CEPH_MSG_MON_MAP} { }
+  explicit MMonMap(ceph::buffer::list &bl) : Message{CEPH_MSG_MON_MAP} {
     monmapbl.claim(bl);
   }
 private:
@@ -56,6 +54,9 @@ public:
     auto p = payload.cbegin();
     decode(monmapbl, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 70c517b42c5e5b93442f1e9826bb074f6d7c7f7f..3edc3e464c2f89d4b41756f56607b480234eb746 100644 (file)
 #include "mon/mon_types.h"
 #include "msg/Message.h"
 
-class MMonMetadata : public MessageInstance<MMonMetadata> {
+class MMonMetadata : public Message {
 public:
-  friend factory;
-
   Metadata data;
 
 private:
@@ -30,10 +28,10 @@ private:
 
 public:
   MMonMetadata() :
-    MessageInstance(CEPH_MSG_MON_METADATA)
+    Message{CEPH_MSG_MON_METADATA}
   {}
   MMonMetadata(const Metadata& metadata) :
-    MessageInstance(CEPH_MSG_MON_METADATA, HEAD_VERSION),
+    Message{CEPH_MSG_MON_METADATA, HEAD_VERSION},
     data(metadata)
   {}
 
@@ -50,6 +48,9 @@ public:
     auto p = payload.cbegin();
     decode(data, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 097fa0145377c13b456bd67dd08c58e048906e4a..f695b78c7afba53c6a01dd0fea4aaa5c5778fa13 100644 (file)
 #include "mon/health_check.h"
 #include "mon/PGMap.h"
 
-class MMonMgrReport
-  : public MessageInstance<MMonMgrReport, PaxosServiceMessage> {
-public:
-  friend factory;
+class MMonMgrReport : public PaxosServiceMessage {
 private:
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
@@ -36,7 +33,7 @@ public:
   std::map<std::string,ProgressEvent> progress_events;
 
   MMonMgrReport()
-    : MessageInstance(MSG_MON_MGR_REPORT, 0, HEAD_VERSION, COMPAT_VERSION)
+    : PaxosServiceMessage{MSG_MON_MGR_REPORT, 0, HEAD_VERSION, COMPAT_VERSION}
   {}
 private:
   ~MMonMgrReport() override {}
@@ -82,6 +79,9 @@ public:
       decode(progress_events, p);
     }
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index b0fc1f705852c2f4e4828bb6cba265fd4063ddee..3452482c64827a88911cb7cad1aca1d37620ae2e 100644 (file)
@@ -20,9 +20,7 @@
 #include "mon/mon_types.h"
 #include "include/ceph_features.h"
 
-class MMonPaxos : public MessageInstance<MMonPaxos> {
-public:
-  friend factory;
+class MMonPaxos : public Message {
 private:
   static constexpr int HEAD_VERSION = 4;
   static constexpr int COMPAT_VERSION = 3;
@@ -67,9 +65,9 @@ private:
 
   bufferlist feature_map;
 
-  MMonPaxos() : MessageInstance(MSG_MON_PAXOS, HEAD_VERSION, COMPAT_VERSION) { }
+  MMonPaxos() : Message{MSG_MON_PAXOS, HEAD_VERSION, COMPAT_VERSION} { }
   MMonPaxos(epoch_t e, int o, utime_t now) : 
-    MessageInstance(MSG_MON_PAXOS, HEAD_VERSION, COMPAT_VERSION),
+    Message{MSG_MON_PAXOS, HEAD_VERSION, COMPAT_VERSION},
     epoch(e),
     op(o),
     first_committed(0), last_committed(0), pn_from(0), pn(0), uncommitted_pn(0),
@@ -128,6 +126,9 @@ public:
       decode(feature_map, p);
     }
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 8b878dfda043d440bfcb06924011a17d8f2e4a6f..bc4f2dcfa768aaa66610613e9ddf28315c7ea51f 100644 (file)
 #include "msg/Message.h"
 #include "mon/MonMap.h"
 
-class MMonProbe : public MessageInstance<MMonProbe> {
+class MMonProbe : public Message {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 7;
   static constexpr int COMPAT_VERSION = 5;
 
@@ -60,9 +58,9 @@ public:
   uint8_t mon_release = 0;
 
   MMonProbe()
-    : MessageInstance(MSG_MON_PROBE, HEAD_VERSION, COMPAT_VERSION) {}
+    : Message{MSG_MON_PROBE, HEAD_VERSION, COMPAT_VERSION} {}
   MMonProbe(const uuid_d& f, int o, const string& n, bool hej, uint8_t mr)
-    : MessageInstance(MSG_MON_PROBE, HEAD_VERSION, COMPAT_VERSION),
+    : Message{MSG_MON_PROBE, HEAD_VERSION, COMPAT_VERSION},
       fsid(f),
       op(o),
       name(n),
@@ -137,6 +135,9 @@ public:
     else
       mon_release = 0;
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 8924bad9ff7fbf6c42b6eac581974b44746cfde4..967588fd2620ae082345c44ac0294334fc99f4af 100644 (file)
@@ -16,9 +16,7 @@
 #include "msg/Message.h"
 #include "mon/mon_types.h"
 
-class MMonScrub : public MessageInstance<MMonScrub> {
-public:
-  friend factory;
+class MMonScrub : public Message {
 private:
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 2;
@@ -44,12 +42,12 @@ public:
   pair<string,string> key;
 
   MMonScrub()
-    : MessageInstance(MSG_MON_SCRUB, HEAD_VERSION, COMPAT_VERSION),
+    : Message{MSG_MON_SCRUB, HEAD_VERSION, COMPAT_VERSION},
       num_keys(-1)
   { }
 
   MMonScrub(op_type_t op, version_t v, int32_t num_keys)
-    : MessageInstance(MSG_MON_SCRUB, HEAD_VERSION, COMPAT_VERSION),
+    : Message{MSG_MON_SCRUB, HEAD_VERSION, COMPAT_VERSION},
       op(op), version(v), num_keys(num_keys)
   { }
 
@@ -85,6 +83,9 @@ public:
     decode(num_keys, p);
     decode(key, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif /* CEPH_MMONSCRUB_H */
index c57ab5e8474145c63ab1deff02419d91a7677d28..2872c0b46e11626c1a2ed56d4c8b2100e5223ed7 100644 (file)
@@ -29,17 +29,15 @@ struct ceph_mon_subscribe_item_old {
 WRITE_RAW_ENCODER(ceph_mon_subscribe_item_old)
 
 
-class MMonSubscribe : public MessageInstance<MMonSubscribe> {
+class MMonSubscribe : public Message {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 1;
 
   std::string hostname;
   std::map<std::string, ceph_mon_subscribe_item> what;
 
-  MMonSubscribe() : MessageInstance(CEPH_MSG_MON_SUBSCRIBE, HEAD_VERSION, COMPAT_VERSION) { }
+  MMonSubscribe() : Message{CEPH_MSG_MON_SUBSCRIBE, HEAD_VERSION, COMPAT_VERSION} { }
 private:
   ~MMonSubscribe() override {}
 
@@ -97,6 +95,9 @@ public:
     encode(what, payload);
     encode(hostname, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 3a68c15888837daee0a6f0c7635e08895de9bc13..9aa2db0500f656daf604fea12dfa2555ccd387fb 100644 (file)
 
 #include "msg/Message.h"
 
-class MMonSubscribeAck : public MessageInstance<MMonSubscribeAck> {
+class MMonSubscribeAck : public Message {
 public:
-  friend factory;
-
   __u32 interval;
   uuid_d fsid;
   
-  MMonSubscribeAck() : MessageInstance(CEPH_MSG_MON_SUBSCRIBE_ACK),
+  MMonSubscribeAck() : Message{CEPH_MSG_MON_SUBSCRIBE_ACK},
                       interval(0) {
   }
-  MMonSubscribeAck(uuid_d& f, int i) : MessageInstance(CEPH_MSG_MON_SUBSCRIBE_ACK),
+  MMonSubscribeAck(uuid_d& f, int i) : Message{CEPH_MSG_MON_SUBSCRIBE_ACK},
                                       interval(i), fsid(f) { }
 private:
   ~MMonSubscribeAck() override {}
@@ -49,6 +47,9 @@ public:
     encode(interval, payload);
     encode(fsid, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index a4f8220790c2c6c5b5d1e08b89826e313c288490..41832366f9ee8011c015ab873586c3c619d456d0 100644 (file)
@@ -15,9 +15,7 @@
 
 #include "msg/Message.h"
 
-class MMonSync : public MessageInstance<MMonSync> {
-public:
-  friend factory;
+class MMonSync : public Message {
 private:
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 2;
@@ -63,11 +61,11 @@ public:
   entity_inst_t reply_to;
 
   MMonSync()
-    : MessageInstance(MSG_MON_SYNC, HEAD_VERSION, COMPAT_VERSION)
+    : Message{MSG_MON_SYNC, HEAD_VERSION, COMPAT_VERSION}
   { }
 
   MMonSync(uint32_t op, uint64_t c = 0)
-    : MessageInstance(MSG_MON_SYNC, HEAD_VERSION, COMPAT_VERSION),
+    : Message{MSG_MON_SYNC, HEAD_VERSION, COMPAT_VERSION},
       op(op),
       cookie(c),
       last_committed(0)
@@ -109,6 +107,9 @@ public:
     decode(chunk_bl, p);
     decode(reply_to, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif /* CEPH_MMONSYNC_H */
index 47ed5f2a2451ba28d8ce2503329714531771801f..7b82d4fd1729e8998081cc4f4864aea5353aa571 100644 (file)
 
 #include "messages/PaxosServiceMessage.h"
 
-class MOSDAlive : public MessageInstance<MOSDAlive, PaxosServiceMessage> {
+class MOSDAlive : public PaxosServiceMessage {
 public:
-  friend factory;
-
   epoch_t want = 0;
 
-  MOSDAlive(epoch_t h, epoch_t w) : MessageInstance(MSG_OSD_ALIVE, h), want(w) { }
-  MOSDAlive() : MessageInstance(MSG_OSD_ALIVE, 0) {}
+  MOSDAlive(epoch_t h, epoch_t w) : PaxosServiceMessage{MSG_OSD_ALIVE, h}, want(w) {}
+  MOSDAlive() : MOSDAlive{0, 0} {}
 private:
   ~MOSDAlive() override {}
 
@@ -46,7 +44,9 @@ public:
   void print(ostream &out) const override {
     out << "osd_alive(want up_thru " << want << " have " << version << ")";
   }
-  
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 25b7096619fc50d7517262170ad02f1bae4d11e9..82218d2fa435e4787479c6f7dc561b05afd1465b 100644 (file)
 #include "MOSDFastDispatchOp.h"
 #include "osd/osd_types.h"
 
-class MOSDBackoff : public MessageInstance<MOSDBackoff, MOSDFastDispatchOp> {
+class MOSDBackoff : public MOSDFastDispatchOp {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 1;
   static constexpr int COMPAT_VERSION = 1;
 
@@ -40,10 +38,10 @@ public:
   }
 
   MOSDBackoff()
-    : MessageInstance(CEPH_MSG_OSD_BACKOFF, HEAD_VERSION, COMPAT_VERSION) {}
+    : MOSDFastDispatchOp{CEPH_MSG_OSD_BACKOFF, HEAD_VERSION, COMPAT_VERSION} {}
   MOSDBackoff(spg_t pgid_, epoch_t ep, uint8_t op_, uint64_t id_,
              hobject_t begin_, hobject_t end_)
-    : MessageInstance(CEPH_MSG_OSD_BACKOFF, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDFastDispatchOp{CEPH_MSG_OSD_BACKOFF, HEAD_VERSION, COMPAT_VERSION},
       pgid(pgid_),
       map_epoch(ep),
       op(op_),
@@ -80,6 +78,9 @@ public:
        << " [" << begin << "," << end << ")"
        << " e" << map_epoch << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 7614011968ae5e0f4e4cda8992f6392c510677db..068858cbf9685478ee43ba89e9f18710d6ca42dc 100644 (file)
@@ -5,18 +5,16 @@
 
 #include "PaxosServiceMessage.h"
 
-class MOSDBeacon : public MessageInstance<MOSDBeacon, PaxosServiceMessage> {
+class MOSDBeacon : public PaxosServiceMessage {
 public:
-  friend factory;
-
   std::vector<pg_t> pgs;
   epoch_t min_last_epoch_clean = 0;
 
   MOSDBeacon()
-    : MessageInstance(MSG_OSD_BEACON, 0)
+    : PaxosServiceMessage{MSG_OSD_BEACON, 0}
   {}
   MOSDBeacon(epoch_t e, epoch_t min_lec)
-    : MessageInstance(MSG_OSD_BEACON, e),
+    : PaxosServiceMessage{MSG_OSD_BEACON, e},
       min_last_epoch_clean(min_lec)
   {}
   void encode_payload(uint64_t features) override {
@@ -38,4 +36,7 @@ public:
         << " lec " << min_last_epoch_clean
         << " v" << version << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
index ccd499918a5f2e2209a02bf31a003b9183a49f53..4e2cdf0bd49dadc852c8ab33232749469375bb6c 100644 (file)
@@ -21,9 +21,7 @@
 #include "include/types.h"
 #include "osd/osd_types.h"
 
-class MOSDBoot : public MessageInstance<MOSDBoot, PaxosServiceMessage> {
-public:
-  friend factory;
+class MOSDBoot : public PaxosServiceMessage {
 private:
   static constexpr int HEAD_VERSION = 7;
   static constexpr int COMPAT_VERSION = 7;
@@ -37,7 +35,7 @@ private:
   uint64_t osd_features;
 
   MOSDBoot()
-    : MessageInstance(MSG_OSD_BOOT, 0, HEAD_VERSION, COMPAT_VERSION),
+    : PaxosServiceMessage{MSG_OSD_BOOT, 0, HEAD_VERSION, COMPAT_VERSION},
       boot_epoch(0), osd_features(0)
   { }
   MOSDBoot(OSDSuperblock& s, epoch_t e, epoch_t be,
@@ -45,7 +43,7 @@ private:
           const entity_addrvec_t& hb_front_addr_ref,
            const entity_addrvec_t& cluster_addr_ref,
           uint64_t feat)
-    : MessageInstance(MSG_OSD_BOOT, e, HEAD_VERSION, COMPAT_VERSION),
+    : PaxosServiceMessage{MSG_OSD_BOOT, e, HEAD_VERSION, COMPAT_VERSION},
       sb(s),
       hb_back_addrs(hb_back_addr_ref),
       hb_front_addrs(hb_front_addr_ref),
@@ -115,6 +113,9 @@ public:
     decode(metadata, p);
     decode(osd_features, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index c006a85c2eda522d1bbab0b0904a25bfb63da13e..ec97de62a27b165d32daccfe0fa4e3af1faabc87 100644 (file)
@@ -18,9 +18,7 @@
 #include "MOSDFastDispatchOp.h"
 #include "osd/ECMsgTypes.h"
 
-class MOSDECSubOpRead : public MessageInstance<MOSDECSubOpRead, MOSDFastDispatchOp> {
-public:
-  friend factory;
+class MOSDECSubOpRead : public MOSDFastDispatchOp {
 private:
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 1;
@@ -44,7 +42,7 @@ public:
   }
 
   MOSDECSubOpRead()
-    : MessageInstance(MSG_OSD_EC_READ, HEAD_VERSION, COMPAT_VERSION)
+    : MOSDFastDispatchOp{MSG_OSD_EC_READ, HEAD_VERSION, COMPAT_VERSION}
     {}
 
   void decode_payload() override {
@@ -77,6 +75,9 @@ public:
        << " " << op;
     out << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 091e53910edfcd1199b8cf65d935c3d0d8e82967..fb5e80112271a0ea162d1f3a6c5ac1a9db088bc4 100644 (file)
@@ -18,9 +18,7 @@
 #include "MOSDFastDispatchOp.h"
 #include "osd/ECMsgTypes.h"
 
-class MOSDECSubOpReadReply : public MessageInstance<MOSDECSubOpReadReply, MOSDFastDispatchOp> {
-public:
-  friend factory;
+class MOSDECSubOpReadReply : public MOSDFastDispatchOp {
 private:
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
@@ -44,7 +42,7 @@ public:
   }
 
   MOSDECSubOpReadReply()
-    : MessageInstance(MSG_OSD_EC_READ_REPLY, HEAD_VERSION, COMPAT_VERSION)
+    : MOSDFastDispatchOp{MSG_OSD_EC_READ_REPLY, HEAD_VERSION, COMPAT_VERSION}
     {}
 
   void decode_payload() override {
@@ -77,6 +75,9 @@ public:
        << " " << op;
     out << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 5b286cffb77ab0680f52adc6b41be3cebcf343a9..f5ccf652306d79387f561cb9129227eaa6b430cf 100644 (file)
@@ -18,9 +18,7 @@
 #include "MOSDFastDispatchOp.h"
 #include "osd/ECMsgTypes.h"
 
-class MOSDECSubOpWrite : public MessageInstance<MOSDECSubOpWrite, MOSDFastDispatchOp> {
-public:
-  friend factory;
+class MOSDECSubOpWrite : public MOSDFastDispatchOp {
 private:
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
@@ -44,10 +42,10 @@ public:
   }
 
   MOSDECSubOpWrite()
-    : MessageInstance(MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION)
+    : MOSDFastDispatchOp{MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION}
     {}
   MOSDECSubOpWrite(ECSubWrite &in_op)
-    : MessageInstance(MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION) {
+    : MOSDFastDispatchOp{MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION} {
     op.claim(in_op);
   }
 
@@ -86,6 +84,9 @@ public:
     op.t = ObjectStore::Transaction();
     op.log_entries.clear();
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index dfcaf9ae36a88ac28bd1d0cdd34dffe714c8669d..743180abe4d5a11108a84c49c8c8bd5d2b757c67 100644 (file)
@@ -18,9 +18,7 @@
 #include "MOSDFastDispatchOp.h"
 #include "osd/ECMsgTypes.h"
 
-class MOSDECSubOpWriteReply : public MessageInstance<MOSDECSubOpWriteReply, MOSDFastDispatchOp> {
-public:
-  friend factory;
+class MOSDECSubOpWriteReply : public MOSDFastDispatchOp {
 private:
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
@@ -44,8 +42,8 @@ public:
   }
 
   MOSDECSubOpWriteReply()
-    : MessageInstance(MSG_OSD_EC_WRITE_REPLY, HEAD_VERSION, COMPAT_VERSION)
-    {}
+    : MOSDFastDispatchOp{MSG_OSD_EC_WRITE_REPLY, HEAD_VERSION, COMPAT_VERSION}
+  {}
 
   void decode_payload() override {
     auto p = payload.cbegin();
@@ -77,6 +75,9 @@ public:
        << " " << op;
     out << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 27888dd45ae026434ca6fcc9aac4d7b06f79fe74..0702034bd7b1ee23193e33fd45ab53c4f45a9f77 100644 (file)
@@ -19,9 +19,7 @@
 #include "messages/PaxosServiceMessage.h"
 
 
-class MOSDFailure : public MessageInstance<MOSDFailure, PaxosServiceMessage> {
-public:
-  friend factory;
+class MOSDFailure : public PaxosServiceMessage {
 private:
   static constexpr int HEAD_VERSION = 4;
   static constexpr int COMPAT_VERSION = 4;
@@ -40,10 +38,10 @@ private:
   epoch_t epoch = 0;
   int32_t failed_for = 0;  // known to be failed since at least this long
 
-  MOSDFailure() : MessageInstance(MSG_OSD_FAILURE, 0, HEAD_VERSION) { }
+  MOSDFailure() : PaxosServiceMessage(MSG_OSD_FAILURE, 0, HEAD_VERSION) { }
   MOSDFailure(const uuid_d &fs, int osd, const entity_addrvec_t& av,
              int duration, epoch_t e)
-    : MessageInstance(MSG_OSD_FAILURE, e, HEAD_VERSION, COMPAT_VERSION),
+    : PaxosServiceMessage(MSG_OSD_FAILURE, e, HEAD_VERSION, COMPAT_VERSION),
       fsid(fs),
       target_osd(osd),
       target_addrs(av),
@@ -52,7 +50,7 @@ private:
   MOSDFailure(const uuid_d &fs, int osd, const entity_addrvec_t& av,
              int duration,
               epoch_t e, __u8 extra_flags)
-    : MessageInstance(MSG_OSD_FAILURE, e, HEAD_VERSION, COMPAT_VERSION),
+    : PaxosServiceMessage(MSG_OSD_FAILURE, e, HEAD_VERSION, COMPAT_VERSION),
       fsid(fs),
       target_osd(osd),
       target_addrs(av),
@@ -123,6 +121,9 @@ public:
        << " for " << failed_for << "sec e" << epoch
        << " v" << version << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 9ee824a16e3b55d4f563e642f950d60a1ce9c91b..9e86c3320bde894c3d1c0847c3b91cfc4bdc4d10 100644 (file)
@@ -31,10 +31,8 @@ static const int OFR_BACKFILL = 2;
 // cancel priority boost, requeue if necessary
 static const int OFR_CANCEL = 4;
 
-class MOSDForceRecovery : public MessageInstance<MOSDForceRecovery> {
+class MOSDForceRecovery : public Message {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 2;
 
@@ -42,12 +40,12 @@ public:
   vector<spg_t> forced_pgs;
   uint8_t options = 0;
 
-  MOSDForceRecovery() : MessageInstance(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION) {}
+  MOSDForceRecovery() : Message{MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION} {}
   MOSDForceRecovery(const uuid_d& f, char opts) :
-    MessageInstance(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION),
+    Message{MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION},
     fsid(f), options(opts) {}
   MOSDForceRecovery(const uuid_d& f, vector<spg_t>& pgs, char opts) :
-    MessageInstance(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION),
+    Message{MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION},
     fsid(f), forced_pgs(pgs), options(opts) {}
 private:
   ~MOSDForceRecovery() {}
@@ -107,6 +105,9 @@ public:
     decode(forced_pgs, p);
     decode(options, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif /* CEPH_MOSDFORCERECOVERY_H_ */
index bfe0c24e4cbe22fb0d51394990e86926c346df46..bf6bd35c71c784ef0a28b474d02124ccf27df105 100644 (file)
 // future this message could be generalized to other state bits, but
 // for now name it for its sole application.
 
-class MOSDFull : public MessageInstance<MOSDFull, PaxosServiceMessage> {
+class MOSDFull : public PaxosServiceMessage {
 public:
-  friend factory;
-
   epoch_t map_epoch = 0;
   uint32_t state = 0;
 
@@ -23,9 +21,9 @@ private:
 
 public:
   MOSDFull(epoch_t e, unsigned s)
-    : MessageInstance(MSG_OSD_FULL, e), map_epoch(e), state(s) { }
+    : PaxosServiceMessage{MSG_OSD_FULL, e}, map_epoch(e), state(s) { }
   MOSDFull()
-    : MessageInstance(MSG_OSD_FULL, 0) {}
+    : PaxosServiceMessage{MSG_OSD_FULL, 0} {}
 
 public:
   void encode_payload(uint64_t features) {
@@ -47,7 +45,9 @@ public:
     OSDMap::calc_state_set(state, states);
     out << "osd_full(e" << map_epoch << " " << states << " v" << version << ")";
   }
-
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 3c2ef510a91798aea0c5c10285dec43c4cd7b0f5..370de67df0d414c14f451fcb7bd958360d28775a 100644 (file)
 #include "osd/OSDMap.h"
 #include "include/ceph_features.h"
 
-class MOSDMap : public MessageInstance<MOSDMap> {
-public:
-  friend factory;
+class MOSDMap : public Message {
 private:
   static constexpr int HEAD_VERSION = 4;
   static constexpr int COMPAT_VERSION = 3;
 
- public:
+public:
   uuid_d fsid;
   uint64_t encode_features = 0;
   std::map<epoch_t, ceph::buffer::list> maps;
@@ -65,9 +63,9 @@ private:
   }
 
 
-  MOSDMap() : MessageInstance(CEPH_MSG_OSD_MAP, HEAD_VERSION, COMPAT_VERSION) { }
+  MOSDMap() : Message{CEPH_MSG_OSD_MAP, HEAD_VERSION, COMPAT_VERSION} { }
   MOSDMap(const uuid_d &f, const uint64_t features)
-    : MessageInstance(CEPH_MSG_OSD_MAP, HEAD_VERSION, COMPAT_VERSION),
+    : Message{CEPH_MSG_OSD_MAP, HEAD_VERSION, COMPAT_VERSION},
       fsid(f), encode_features(features),
       oldest_map(0), newest_map(0) { }
 private:
@@ -165,6 +163,9 @@ public:
       out << " +gap_removed_snaps";
     out << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 89c3d75cefd3501c8a33cf9c992ceec40cc67e42..b99008318c5b528e44914c155813801c58813355 100644 (file)
@@ -17,9 +17,7 @@
 
 #include "messages/PaxosServiceMessage.h"
 
-class MOSDMarkMeDown : public MessageInstance<MOSDMarkMeDown, PaxosServiceMessage> {
-public:
-  friend factory;
+class MOSDMarkMeDown : public PaxosServiceMessage {
 private:
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 3;
@@ -32,12 +30,12 @@ private:
   bool request_ack = false;          // ack requested
 
   MOSDMarkMeDown()
-    : MessageInstance(MSG_OSD_MARK_ME_DOWN, 0,
-                         HEAD_VERSION, COMPAT_VERSION) { }
+    : PaxosServiceMessage{MSG_OSD_MARK_ME_DOWN, 0,
+                         HEAD_VERSION, COMPAT_VERSION} { }
   MOSDMarkMeDown(const uuid_d &fs, int osd, const entity_addrvec_t& av,
                 epoch_t e, bool request_ack)
-    : MessageInstance(MSG_OSD_MARK_ME_DOWN, e,
-                         HEAD_VERSION, COMPAT_VERSION),
+    : PaxosServiceMessage{MSG_OSD_MARK_ME_DOWN, e,
+                         HEAD_VERSION, COMPAT_VERSION},
       fsid(fs), target_osd(osd), target_addrs(av),
       epoch(e), request_ack(request_ack) {}
  private:
@@ -98,6 +96,9 @@ public:
        << ", fsid=" << fsid
        << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index b7f59390151227dd697c649c017839748e6669df..ad3a75a67ec827ccbe182547b101f21220aa13da 100644 (file)
@@ -32,9 +32,7 @@
 
 class OSD;
 
-class MOSDOp : public MessageInstance<MOSDOp, MOSDFastDispatchOp> {
-public:
-  friend factory;
+class MOSDOp : public MOSDFastDispatchOp {
 private:
   static constexpr int HEAD_VERSION = 8;
   static constexpr int COMPAT_VERSION = 3;
@@ -170,14 +168,14 @@ public:
   }
 
   MOSDOp()
-    : MessageInstance(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDFastDispatchOp(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION),
       partial_decode_needed(true),
       final_decode_needed(true),
       bdata_encode(false) { }
   MOSDOp(int inc, long tid, const hobject_t& ho, spg_t& _pgid,
         epoch_t _osdmap_epoch,
         int _flags, uint64_t feat)
-    : MessageInstance(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDFastDispatchOp(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION),
       client_inc(inc),
       osdmap_epoch(_osdmap_epoch), flags(_flags), retry_attempt(-1),
       hobj(ho),
@@ -595,6 +593,10 @@ struct ceph_osd_request_head {
     }
     out << ")";
   }
+
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 
index f14bd35e093a476f27c3ab42452718f431c842ef..c35b7ace671d996c1ab50a3a4bc8a61eeb2cf106 100644 (file)
@@ -29,9 +29,7 @@
  *
  */
 
-class MOSDOpReply : public MessageInstance<MOSDOpReply> {
-public:
-  friend factory;
+class MOSDOpReply : public Message {
 private:
   static constexpr int HEAD_VERSION = 8;
   static constexpr int COMPAT_VERSION = 2;
@@ -128,13 +126,13 @@ public:
 
 public:
   MOSDOpReply()
-    : MessageInstance(CEPH_MSG_OSD_OPREPLY, HEAD_VERSION, COMPAT_VERSION),
+    : Message{CEPH_MSG_OSD_OPREPLY, HEAD_VERSION, COMPAT_VERSION},
     bdata_encode(false) {
     do_redirect = false;
   }
   MOSDOpReply(const MOSDOp *req, int r, epoch_t e, int acktype,
              bool ignore_out_data)
-    : MessageInstance(CEPH_MSG_OSD_OPREPLY, HEAD_VERSION, COMPAT_VERSION),
+    : Message{CEPH_MSG_OSD_OPREPLY, HEAD_VERSION, COMPAT_VERSION},
       oid(req->hobj.oid), pgid(req->pgid.pgid), ops(req->ops),
       bdata_encode(false) {
 
@@ -334,6 +332,9 @@ public:
     out << ")";
   }
 
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 
index 47d25b0c67419f57bc92a98079585a6a29b288dd..ee2eb82fe86b8697e137f3850ab40e8504e49d7d 100644 (file)
@@ -17,9 +17,7 @@
 
 #include "MOSDFastDispatchOp.h"
 
-class MOSDPGBackfill : public MessageInstance<MOSDPGBackfill, MOSDFastDispatchOp> {
-public:
-  friend factory;
+class MOSDPGBackfill : public MOSDFastDispatchOp {
 private:
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 3;
@@ -91,9 +89,9 @@ public:
   }
 
   MOSDPGBackfill()
-    : MessageInstance(MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION) {}
+    : MOSDFastDispatchOp{MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION} {}
   MOSDPGBackfill(__u32 o, epoch_t e, epoch_t qe, spg_t p)
-    : MessageInstance(MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDFastDispatchOp{MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION},
       op(o),
       map_epoch(e), query_epoch(e),
       pgid(p) {}
@@ -109,6 +107,10 @@ public:
        << " lb " << last_backfill
        << ")";
   }
+
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 359145183e6d37c88dfcf59f4f54914b59f362e2..5c70c386f3d4adbb1f6dbe8405829151696fbe2f 100644 (file)
  * instruct non-primary to remove some objects during backfill
  */
 
-class MOSDPGBackfillRemove : public MessageInstance<MOSDPGBackfillRemove, MOSDFastDispatchOp> {
+class MOSDPGBackfillRemove : public MOSDFastDispatchOp {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 1;
   static constexpr int COMPAT_VERSION = 1;
 
@@ -40,12 +38,13 @@ public:
   }
 
   MOSDPGBackfillRemove()
-    : MessageInstance(MSG_OSD_PG_BACKFILL_REMOVE, HEAD_VERSION,
-                       COMPAT_VERSION) {}
+    : MOSDFastDispatchOp{MSG_OSD_PG_BACKFILL_REMOVE, HEAD_VERSION,
+                        COMPAT_VERSION}
+  {}
 
   MOSDPGBackfillRemove(spg_t pgid, epoch_t map_epoch)
-    : MessageInstance(MSG_OSD_PG_BACKFILL_REMOVE, HEAD_VERSION,
-                        COMPAT_VERSION),
+    : MOSDFastDispatchOp{MSG_OSD_PG_BACKFILL_REMOVE, HEAD_VERSION,
+                        COMPAT_VERSION},
       pgid(pgid),
       map_epoch(map_epoch) {}
 
@@ -71,8 +70,10 @@ public:
     decode(map_epoch, p);
     decode(ls, p);
   }
-};
-
 
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
+};
 
 #endif
index eef056ab860b60f12c8c00e3e9ea623c087c15fe..09aa2e9c2e3f82d74a74ea0fcc850aba61ac68c0 100644 (file)
  * PGCreate - instruct an OSD to create a pg, if it doesn't already exist
  */
 
-class MOSDPGCreate : public MessageInstance<MOSDPGCreate> {
+class MOSDPGCreate : public Message {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 3;
 
@@ -35,10 +33,12 @@ public:
   map<pg_t,utime_t> ctimes;
 
   MOSDPGCreate()
-    : MessageInstance(MSG_OSD_PG_CREATE, HEAD_VERSION, COMPAT_VERSION) {}
+    : MOSDPGCreate{0}
+  {}
   MOSDPGCreate(epoch_t e)
-    : MessageInstance(MSG_OSD_PG_CREATE, HEAD_VERSION, COMPAT_VERSION),
-      epoch(e) { }
+    : Message{MSG_OSD_PG_CREATE, HEAD_VERSION, COMPAT_VERSION},
+      epoch(e)
+  {}
 private:
   ~MOSDPGCreate() override {}
 
@@ -57,7 +57,6 @@ public:
     decode(mkpg, p);
     decode(ctimes, p);
   }
-
   void print(ostream& out) const override {
     out << "osd_pg_create(e" << epoch;
     for (map<pg_t,pg_create_t>::const_iterator i = mkpg.begin();
@@ -67,6 +66,9 @@ public:
     }
     out << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index f232483f007ef8dab063deee131026e5d21fe194..e2c6800e3b7f2137f4e0f8592450e11b37c29b0d 100644 (file)
  * PGCreate2 - instruct an OSD to create some pgs
  */
 
-class MOSDPGCreate2 : public MessageInstance<MOSDPGCreate2> {
+class MOSDPGCreate2 : public Message {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 1;
   static constexpr int COMPAT_VERSION = 1;
 
@@ -21,9 +19,9 @@ public:
   map<spg_t,pair<epoch_t,utime_t>> pgs;
 
   MOSDPGCreate2()
-    : MessageInstance(MSG_OSD_PG_CREATE2, HEAD_VERSION, COMPAT_VERSION) {}
+    : Message{MSG_OSD_PG_CREATE2, HEAD_VERSION, COMPAT_VERSION} {}
   MOSDPGCreate2(epoch_t e)
-    : MessageInstance(MSG_OSD_PG_CREATE2, HEAD_VERSION, COMPAT_VERSION),
+    : Message{MSG_OSD_PG_CREATE2, HEAD_VERSION, COMPAT_VERSION},
       epoch(e) { }
 private:
   ~MOSDPGCreate2() override {}
@@ -47,4 +45,7 @@ public:
     decode(epoch, p);
     decode(pgs, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
index 6ccb9f9789f5dde36243f9f9a058d96d2d86c0a7..7ec6c34dc163c6db987b51c67e31a46b0ca9d423 100644 (file)
@@ -6,16 +6,14 @@
 #include "osd/osd_types.h"
 #include "messages/PaxosServiceMessage.h"
 
-class MOSDPGCreated : public MessageInstance<MOSDPGCreated, PaxosServiceMessage> {
+class MOSDPGCreated : public PaxosServiceMessage {
 public:
-  friend factory;
-
   pg_t pgid;
   MOSDPGCreated()
-    : MessageInstance(MSG_OSD_PG_CREATED, 0)
+    : PaxosServiceMessage{MSG_OSD_PG_CREATED, 0}
   {}
   MOSDPGCreated(pg_t pgid)
-    : MessageInstance(MSG_OSD_PG_CREATED, 0),
+    : PaxosServiceMessage{MSG_OSD_PG_CREATED, 0},
       pgid(pgid)
   {}
   std::string_view get_type_name() const override { return "pg_created"; }
@@ -32,4 +30,7 @@ public:
     paxos_decode(p);
     decode(pgid, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
index f7ba4aedf9fccc56b25e4c0d1312ba67613d6ac1..0a4d92b5d63f8228de25f13715f627583bb6dec0 100644 (file)
@@ -19,9 +19,7 @@
 #include "msg/Message.h"
 #include "osd/osd_types.h"
 
-class MOSDPGInfo : public MessageInstance<MOSDPGInfo> {
-public:
-  friend factory;
+class MOSDPGInfo : public Message {
 private:
   static constexpr int HEAD_VERSION = 5;
   static constexpr int COMPAT_VERSION = 5;
@@ -41,7 +39,7 @@ public:
     : MOSDPGInfo(mv, {})
   {}
   MOSDPGInfo(epoch_t mv, pg_list_t&& l)
-    : MessageInstance(MSG_OSD_PG_INFO, HEAD_VERSION, COMPAT_VERSION),
+    : Message{MSG_OSD_PG_INFO, HEAD_VERSION, COMPAT_VERSION},
       epoch{mv},
       pg_list{std::move(l)}
   {
@@ -75,6 +73,9 @@ public:
     decode(epoch, p);
     decode(pg_list, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index e391183a268091b3d8d85bcb180dd27dc9f2ce97..8e3fd6ee00eb3cdda58cdf3f4442c96adf78a3f5 100644 (file)
@@ -18,9 +18,7 @@
 
 #include "messages/MOSDPeeringOp.h"
 
-class MOSDPGLog : public MessageInstance<MOSDPGLog, MOSDPeeringOp> {
-public:
-  friend factory;
+class MOSDPGLog : public MOSDPeeringOp {
 private:
   static constexpr int HEAD_VERSION = 5;
   static constexpr int COMPAT_VERSION = 5;
@@ -68,12 +66,12 @@ public:
        false));
   }
 
-  MOSDPGLog() : MessageInstance(MSG_OSD_PG_LOG, HEAD_VERSION, COMPAT_VERSION) {
+  MOSDPGLog() : MOSDPeeringOp{MSG_OSD_PG_LOG, HEAD_VERSION, COMPAT_VERSION} {
     set_priority(CEPH_MSG_PRIO_HIGH); 
   }
   MOSDPGLog(shard_id_t to, shard_id_t from,
            version_t mv, const pg_info_t& i, epoch_t query_epoch)
-    : MessageInstance(MSG_OSD_PG_LOG, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDPeeringOp{MSG_OSD_PG_LOG, HEAD_VERSION, COMPAT_VERSION},
       epoch(mv), query_epoch(query_epoch),
       to(to), from(from),
       info(i)  {
@@ -120,6 +118,9 @@ public:
     decode(to, p);
     decode(from, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 6ec25020556a8ebc6cd558e6ced27ce6f6eb077b..dd1f49ce281d39a40c2ff3f49c37aedcd916319f 100644 (file)
@@ -23,9 +23,7 @@
  * PGNotify - notify primary of my PGs and versions.
  */
 
-class MOSDPGNotify : public MessageInstance<MOSDPGNotify> {
-public:
-  friend factory;
+class MOSDPGNotify : public Message {
 private:
   static constexpr int HEAD_VERSION = 6;
   static constexpr int COMPAT_VERSION = 6;
@@ -48,7 +46,7 @@ private:
     : MOSDPGNotify(0, {})
   {}
   MOSDPGNotify(epoch_t e, pg_list_t&& l)
-    : MessageInstance(MSG_OSD_PG_NOTIFY, HEAD_VERSION, COMPAT_VERSION),
+    : Message{MSG_OSD_PG_NOTIFY, HEAD_VERSION, COMPAT_VERSION},
       epoch(e),
       pg_list(std::move(l)) {
     set_priority(CEPH_MSG_PRIO_HIGH);
@@ -82,6 +80,9 @@ public:
     out << " epoch " << epoch
        << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 16eeca7ef74a22e8300fe7bcb28676761d976860..8611e10bb6b3e4c9157b63877f356d49d661bb73 100644 (file)
@@ -17,9 +17,7 @@
 
 #include "MOSDFastDispatchOp.h"
 
-class MOSDPGPull : public MessageInstance<MOSDPGPull, MOSDFastDispatchOp> {
-public:
-  friend factory;
+class MOSDPGPull : public MOSDFastDispatchOp {
 private:
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 2;
@@ -30,7 +28,7 @@ public:
   pg_shard_t from;
   spg_t pgid;
   epoch_t map_epoch = 0, min_epoch = 0;
-  uint64_t cost;
+  uint64_t cost = 0;
 
   epoch_t get_map_epoch() const override {
     return map_epoch;
@@ -50,9 +48,8 @@ public:
   }
 
   MOSDPGPull()
-    : MessageInstance(MSG_OSD_PG_PULL, HEAD_VERSION, COMPAT_VERSION),
-      cost(0)
-    {}
+    : MOSDFastDispatchOp{MSG_OSD_PG_PULL, HEAD_VERSION, COMPAT_VERSION}
+  {}
 
   void compute_cost(CephContext *cct) {
     cost = 0;
@@ -101,6 +98,10 @@ public:
        << " cost " << cost
        << ")";
   }
+
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 3960ad70ea387208e780a33e61d5c4de319fbaba..01df5b81f064284de4544e1bea39058b02ceee9d 100644 (file)
@@ -17,9 +17,7 @@
 
 #include "MOSDFastDispatchOp.h"
 
-class MOSDPGPush : public MessageInstance<MOSDPGPush, MOSDFastDispatchOp> {
-public:
-  friend factory;
+class MOSDPGPush : public MOSDFastDispatchOp {
 private:
   static constexpr int HEAD_VERSION = 4;
   static constexpr int COMPAT_VERSION = 2;
@@ -32,7 +30,7 @@ public:
   bool is_repair = false;
 
 private:
-  uint64_t cost;
+  uint64_t cost = 0;
 
 public:
   void compute_cost(CephContext *cct) {
@@ -63,9 +61,8 @@ public:
   }
 
   MOSDPGPush()
-    : MessageInstance(MSG_OSD_PG_PUSH, HEAD_VERSION, COMPAT_VERSION),
-      cost(0)
-    {}
+    : MOSDFastDispatchOp{MSG_OSD_PG_PUSH, HEAD_VERSION, COMPAT_VERSION}
+  {}
 
   void decode_payload() override {
     auto p = payload.cbegin();
@@ -107,6 +104,10 @@ public:
        << " " << pushes;
     out << ")";
   }
+
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index b9b7687e8eb20df9658927fda54751b2249e2c20..f95555b7f4116e38da1a6be090321f6b7a0ceb47 100644 (file)
@@ -17,9 +17,7 @@
 
 #include "MOSDFastDispatchOp.h"
 
-class MOSDPGPushReply : public MessageInstance<MOSDPGPushReply, MOSDFastDispatchOp> {
-public:
-  friend factory;
+class MOSDPGPushReply : public MOSDFastDispatchOp {
 private:
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 2;
@@ -29,7 +27,7 @@ public:
   spg_t pgid;
   epoch_t map_epoch = 0, min_epoch = 0;
   vector<PushReplyOp> replies;
-  uint64_t cost;
+  uint64_t cost = 0;
 
   epoch_t get_map_epoch() const override {
     return map_epoch;
@@ -42,8 +40,7 @@ public:
   }
 
   MOSDPGPushReply()
-    : MessageInstance(MSG_OSD_PG_PUSH_REPLY, HEAD_VERSION, COMPAT_VERSION),
-      cost(0)
+    : MOSDFastDispatchOp{MSG_OSD_PG_PUSH_REPLY, HEAD_VERSION, COMPAT_VERSION}
     {}
 
   void compute_cost(CephContext *cct) {
index c9f3f8e4e70430b7d0fda04ec2ed6899994d54b4..9d78e61ab9013e4692f3ebdce4388f4e55898d43 100644 (file)
@@ -23,9 +23,7 @@
  * PGQuery - query another OSD as to the contents of their PGs
  */
 
-class MOSDPGQuery : public MessageInstance<MOSDPGQuery> {
-public:
-  friend factory;
+class MOSDPGQuery : public Message {
 private:
   static constexpr int HEAD_VERSION = 4;
   static constexpr int COMPAT_VERSION = 4;
@@ -37,15 +35,15 @@ private:
   using pg_list_t = std::map<spg_t, pg_query_t>;
   pg_list_t pg_list;
 
-  MOSDPGQuery() : MessageInstance(MSG_OSD_PG_QUERY,
+  MOSDPGQuery() : Message{MSG_OSD_PG_QUERY,
                          HEAD_VERSION,
-                         COMPAT_VERSION) {
+                         COMPAT_VERSION} {
     set_priority(CEPH_MSG_PRIO_HIGH);
   }
   MOSDPGQuery(epoch_t e, pg_list_t&& ls) :
-    MessageInstance(MSG_OSD_PG_QUERY,
+    Message{MSG_OSD_PG_QUERY,
            HEAD_VERSION,
-           COMPAT_VERSION),
+           COMPAT_VERSION},
     epoch(e),
     pg_list(std::move(ls)) {
     set_priority(CEPH_MSG_PRIO_HIGH);
@@ -76,6 +74,9 @@ public:
     decode(epoch, p);
     decode(pg_list, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index b8c180956758ee5e9b7203269efff70bcb3a9973..e8f3b81bb88c53e69898ad5134ccf070f3a47cbd 100644 (file)
@@ -3,8 +3,7 @@
 
 #pragma once
 
-class MOSDPGReadyToMerge
-  : public MessageInstance<MOSDPGReadyToMerge, PaxosServiceMessage> {
+class MOSDPGReadyToMerge : public PaxosServiceMessage {
 public:
   pg_t pgid;
   eversion_t source_version, target_version;
@@ -13,11 +12,11 @@ public:
   bool ready = true;
 
   MOSDPGReadyToMerge()
-    : MessageInstance(MSG_OSD_PG_READY_TO_MERGE, 0)
+    : PaxosServiceMessage{MSG_OSD_PG_READY_TO_MERGE, 0}
   {}
   MOSDPGReadyToMerge(pg_t p, eversion_t sv, eversion_t tv,
                     epoch_t les, epoch_t lec, bool r, epoch_t v)
-    : MessageInstance(MSG_OSD_PG_READY_TO_MERGE, v),
+    : PaxosServiceMessage{MSG_OSD_PG_READY_TO_MERGE, v},
       pgid(p),
       source_version(sv),
       target_version(tv),
@@ -55,4 +54,7 @@ public:
        << (ready ? " ready" : " NOT READY")
         << " v" << version << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
index c6fa13669163e1c844a660f8335ce952c206660a..88f82a6f5ab1d8c1174e248382e10adaea635e28 100644 (file)
  * instruct non-primary to remove some objects during recovery
  */
 
-class MOSDPGRecoveryDelete : public MessageInstance<MOSDPGRecoveryDelete, MOSDFastDispatchOp> {
+class MOSDPGRecoveryDelete : public MOSDFastDispatchOp {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
 
@@ -23,7 +21,7 @@ public:
   list<pair<hobject_t, eversion_t> > objects;    ///< objects to remove
 
 private:
-  uint64_t cost;
+  uint64_t cost = 0;
 
 public:
   int get_cost() const override {
@@ -45,18 +43,19 @@ public:
   }
 
   MOSDPGRecoveryDelete()
-    : MessageInstance(MSG_OSD_PG_RECOVERY_DELETE, HEAD_VERSION,
-                        COMPAT_VERSION), cost(0) {}
+    : MOSDFastDispatchOp{MSG_OSD_PG_RECOVERY_DELETE, HEAD_VERSION,
+                        COMPAT_VERSION}
+  {}
 
   MOSDPGRecoveryDelete(pg_shard_t from, spg_t pgid, epoch_t map_epoch,
                       epoch_t min_epoch)
-    : MessageInstance(MSG_OSD_PG_RECOVERY_DELETE, HEAD_VERSION,
-                        COMPAT_VERSION),
+    : MOSDFastDispatchOp{MSG_OSD_PG_RECOVERY_DELETE, HEAD_VERSION,
+                        COMPAT_VERSION},
       from(from),
       pgid(pgid),
       map_epoch(map_epoch),
-      min_epoch(min_epoch),
-      cost(0) {}
+      min_epoch(min_epoch)
+  {}
 
 private:
   ~MOSDPGRecoveryDelete() {}
@@ -86,8 +85,9 @@ public:
     decode(cost, p);
     decode(objects, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
-
-
 #endif
index e64017741678243ba95265bd83c2be88481b61e6..e870e587f8445464a858666ede04267afbb76dea 100644 (file)
@@ -6,16 +6,15 @@
 
 #include "MOSDFastDispatchOp.h"
 
-class MOSDPGRecoveryDeleteReply : public MessageInstance<MOSDPGRecoveryDeleteReply, MOSDFastDispatchOp> {
+class MOSDPGRecoveryDeleteReply : public MOSDFastDispatchOp {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
 
   pg_shard_t from;
   spg_t pgid;
-  epoch_t map_epoch, min_epoch;
+  epoch_t map_epoch = 0;
+  epoch_t min_epoch = 0;
   list<pair<hobject_t, eversion_t> > objects;
 
   epoch_t get_map_epoch() const override {
@@ -29,9 +28,8 @@ public:
   }
 
   MOSDPGRecoveryDeleteReply()
-    : MessageInstance(MSG_OSD_PG_RECOVERY_DELETE_REPLY, HEAD_VERSION, COMPAT_VERSION),
-      map_epoch(0), min_epoch(0)
-    {}
+    : MOSDFastDispatchOp{MSG_OSD_PG_RECOVERY_DELETE_REPLY, HEAD_VERSION, COMPAT_VERSION}
+  {}
 
   void decode_payload() override {
     auto p = payload.cbegin();
@@ -59,6 +57,10 @@ public:
   }
 
   std::string_view get_type_name() const override { return "recovery_delete_reply"; }
+
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 94e9885e9d94fdd11a7c6a3ae7c8491bc840ed5f..b91c423a96c1cb004338ff99fc0d608d928e8e74 100644 (file)
@@ -20,9 +20,7 @@
 #include "msg/Message.h"
 
 
-class MOSDPGRemove : public MessageInstance<MOSDPGRemove> {
-public:
-  friend factory;
+class MOSDPGRemove : public Message {
 private:
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 3;
@@ -35,9 +33,9 @@ private:
   epoch_t get_epoch() const { return epoch; }
 
   MOSDPGRemove() :
-    MessageInstance(MSG_OSD_PG_REMOVE, HEAD_VERSION, COMPAT_VERSION) {}
+    Message{MSG_OSD_PG_REMOVE, HEAD_VERSION, COMPAT_VERSION} {}
   MOSDPGRemove(epoch_t e, vector<spg_t>& l) :
-    MessageInstance(MSG_OSD_PG_REMOVE, HEAD_VERSION, COMPAT_VERSION) {
+    Message{MSG_OSD_PG_REMOVE, HEAD_VERSION, COMPAT_VERSION} {
     this->epoch = e;
     pg_list.swap(l);
   }
@@ -66,6 +64,9 @@ public:
     }
     out << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 99f0b0bdd3fd4ebdfb1e7db4b7e9154a970630ed..9ed058e064322c2d85ce525b0a50b4a790429eb6 100644 (file)
@@ -17,9 +17,7 @@
 
 #include "MOSDFastDispatchOp.h"
 
-class MOSDPGScan : public MessageInstance<MOSDPGScan, MOSDFastDispatchOp> {
-public:
-  friend factory;
+class MOSDPGScan : public MOSDFastDispatchOp {
 private:
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 2;
@@ -90,10 +88,10 @@ public:
   }
 
   MOSDPGScan()
-    : MessageInstance(MSG_OSD_PG_SCAN, HEAD_VERSION, COMPAT_VERSION) {}
+    : MOSDFastDispatchOp{MSG_OSD_PG_SCAN, HEAD_VERSION, COMPAT_VERSION} {}
   MOSDPGScan(__u32 o, pg_shard_t from,
             epoch_t e, epoch_t qe, spg_t p, hobject_t be, hobject_t en)
-    : MessageInstance(MSG_OSD_PG_SCAN, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDFastDispatchOp{MSG_OSD_PG_SCAN, HEAD_VERSION, COMPAT_VERSION},
       op(o),
       map_epoch(e), query_epoch(qe),
       from(from),
@@ -112,6 +110,9 @@ public:
        << " e " << map_epoch << "/" << query_epoch
        << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 22a8602b2f253f291770243ab48dc27dc712aa72..3a247bd090c263c9301ad29c974f90cfbb8db6e3 100644 (file)
 
 #include "messages/PaxosServiceMessage.h"
 
-class MOSDPGTemp : public MessageInstance<MOSDPGTemp, PaxosServiceMessage> {
+class MOSDPGTemp : public PaxosServiceMessage {
 public:
-  friend factory;
-
   epoch_t map_epoch = 0;
   map<pg_t, vector<int32_t> > pg_temp;
   bool forced = false;
 
   MOSDPGTemp(epoch_t e)
-    : MessageInstance(MSG_OSD_PGTEMP, e, HEAD_VERSION, COMPAT_VERSION),
+    : PaxosServiceMessage{MSG_OSD_PGTEMP, e, HEAD_VERSION, COMPAT_VERSION},
       map_epoch(e)
   {}
   MOSDPGTemp()
@@ -62,6 +60,9 @@ public:
 private:
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
+
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index e596d12bde732d796b09f3496a31cd885d49d781..22abef8ffb810232fc8edaa1500f21c18b73e04a 100644 (file)
@@ -18,9 +18,7 @@
 #include "msg/Message.h"
 #include "messages/MOSDPeeringOp.h"
 
-class MOSDPGTrim : public MessageInstance<MOSDPGTrim, MOSDPeeringOp> {
-public:
-  friend factory;
+class MOSDPGTrim : public MOSDPeeringOp {
 private:
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 2;
@@ -47,9 +45,9 @@ public:
       MTrim(epoch, get_source().num(), pgid.shard, trim_to));
   }
 
-  MOSDPGTrim() : MessageInstance(MSG_OSD_PG_TRIM, HEAD_VERSION, COMPAT_VERSION) {}
+  MOSDPGTrim() : MOSDPeeringOp{MSG_OSD_PG_TRIM, HEAD_VERSION, COMPAT_VERSION} {}
   MOSDPGTrim(version_t mv, spg_t p, eversion_t tt) :
-    MessageInstance(MSG_OSD_PG_TRIM, HEAD_VERSION, COMPAT_VERSION),
+    MOSDPeeringOp{MSG_OSD_PG_TRIM, HEAD_VERSION, COMPAT_VERSION},
     epoch(mv), pgid(p), trim_to(tt) { }
 private:
   ~MOSDPGTrim() override {}
@@ -74,6 +72,9 @@ public:
     decode(trim_to, p);
     decode(pgid.shard, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index cbf9485e9154f8fe8925d9a129b4a4ea4463754c..b661e414cef05b81f2f4254eabe766b0f7a53a59 100644 (file)
 
 #include "MOSDFastDispatchOp.h"
 
-class MOSDPGUpdateLogMissing : public MessageInstance<MOSDPGUpdateLogMissing, MOSDFastDispatchOp> {
-public:
-  friend factory;
+class MOSDPGUpdateLogMissing : public MOSDFastDispatchOp {
 private:
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 1;
 
-
 public:
   epoch_t map_epoch = 0, min_epoch = 0;
   spg_t pgid;
@@ -52,8 +49,8 @@ public:
   }
 
   MOSDPGUpdateLogMissing()
-    : MessageInstance(MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION,
-                        COMPAT_VERSION) { }
+    : MOSDFastDispatchOp{MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION,
+                        COMPAT_VERSION} {}
   MOSDPGUpdateLogMissing(
     const mempool::osd_pglog::list<pg_log_entry_t> &entries,
     spg_t pgid,
@@ -63,8 +60,8 @@ public:
     ceph_tid_t rep_tid,
     eversion_t pg_trim_to,
     eversion_t pg_roll_forward_to)
-    : MessageInstance(MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION,
-                        COMPAT_VERSION),
+    : MOSDFastDispatchOp{MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION,
+                        COMPAT_VERSION},
       map_epoch(epoch),
       min_epoch(min_epoch),
       pgid(pgid),
@@ -118,6 +115,9 @@ public:
       decode(pg_roll_forward_to, p);
     }
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 8d7050f2a568ee83df990fea76c277d650e3336b..1aa4fb6ab156b367cfc63f16cb63e3d14589be12 100644 (file)
@@ -18,9 +18,7 @@
 
 #include "MOSDFastDispatchOp.h"
 
-class MOSDPGUpdateLogMissingReply : public MessageInstance<MOSDPGUpdateLogMissingReply, MOSDFastDispatchOp> {
-public:
-  friend factory;
+class MOSDPGUpdateLogMissingReply : public MOSDFastDispatchOp {
 private:
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 1;
@@ -52,11 +50,9 @@ public:
   }
 
   MOSDPGUpdateLogMissingReply()
-    : MessageInstance(
-      MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY,
-      HEAD_VERSION,
-      COMPAT_VERSION)
-      {}
+    : MOSDFastDispatchOp{MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY, HEAD_VERSION,
+                        COMPAT_VERSION}
+  {}
   MOSDPGUpdateLogMissingReply(
     spg_t pgid,
     shard_id_t from,
@@ -64,10 +60,8 @@ public:
     epoch_t min_epoch,
     ceph_tid_t rep_tid,
     eversion_t last_complete_ondisk)
-    : MessageInstance(
-        MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY,
-        HEAD_VERSION,
-        COMPAT_VERSION),
+    : MOSDFastDispatchOp{MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY, HEAD_VERSION,
+                        COMPAT_VERSION},
       map_epoch(epoch),
       min_epoch(min_epoch),
       pgid(pgid),
@@ -112,6 +106,9 @@ public:
       decode(last_complete_ondisk, p);
     }
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 6a2693a0df2e0dd5711e12811966575ed3dd31a9..520f2416bebc0ebea26851eb268852780c039379 100644 (file)
@@ -32,9 +32,7 @@
 #include "osd/osd_types.h"
 
 
-class MOSDPing : public MessageInstance<MOSDPing> {
-public:
-  friend factory;
+class MOSDPing : public Message {
 private:
   static constexpr int HEAD_VERSION = 4;
   static constexpr int COMPAT_VERSION = 4;
@@ -64,14 +62,14 @@ private:
   epoch_t map_epoch = 0;
   __u8 op = 0;
   utime_t stamp;
-  uint32_t min_message_size;
+  uint32_t min_message_size = 0;
 
   MOSDPing(const uuid_d& f, epoch_t e, __u8 o, utime_t s, uint32_t min_message)
-    : MessageInstance(MSG_OSD_PING, HEAD_VERSION, COMPAT_VERSION),
+    : Message{MSG_OSD_PING, HEAD_VERSION, COMPAT_VERSION},
       fsid(f), map_epoch(e), op(o), stamp(s), min_message_size(min_message)
   { }
   MOSDPing()
-    : MessageInstance(MSG_OSD_PING, HEAD_VERSION, COMPAT_VERSION), min_message_size(0)
+    : Message{MSG_OSD_PING, HEAD_VERSION, COMPAT_VERSION}
   {}
 private:
   ~MOSDPing() override {}
@@ -125,6 +123,9 @@ public:
        << " stamp " << stamp
        << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 94fca67b0041beafb3abd75874ca634ea47ec246..bafee6faac09a301887920d92ae0273540a8fcb9 100644 (file)
@@ -22,9 +22,7 @@
  * OSD sub op - for internal ops on pobjects between primary and replicas(/stripes/whatever)
  */
 
-class MOSDRepOp : public MessageInstance<MOSDRepOp, MOSDFastDispatchOp> {
-public:
-  friend factory;
+class MOSDRepOp : public MOSDFastDispatchOp {
 private:
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
@@ -143,13 +141,13 @@ public:
   }
 
   MOSDRepOp()
-    : MessageInstance(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDFastDispatchOp{MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION},
       map_epoch(0),
       final_decode_needed(true), acks_wanted (0) {}
   MOSDRepOp(osd_reqid_t r, pg_shard_t from,
            spg_t p, const hobject_t& po, int aw,
            epoch_t mape, epoch_t min_epoch, ceph_tid_t rtid, eversion_t v)
-    : MessageInstance(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDFastDispatchOp{MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION},
       map_epoch(mape),
       min_epoch(min_epoch),
       reqid(r),
@@ -176,7 +174,9 @@ public:
     }
     out << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
-
 #endif
index 3265dcb10f3a366ba12c09ce96b3d778c7fd34cb..ddd90346cc0dbde0bc22fb22b1a7cef8566b21c1 100644 (file)
@@ -26,9 +26,7 @@
  *
  */
 
-class MOSDRepOpReply : public MessageInstance<MOSDRepOpReply, MOSDFastDispatchOp> {
-public:
-  friend factory;
+class MOSDRepOpReply : public MOSDFastDispatchOp {
 private:
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
@@ -119,7 +117,7 @@ public:
   MOSDRepOpReply(
     const MOSDRepOp *req, pg_shard_t from, int result_, epoch_t e, epoch_t mine,
     int at) :
-    MessageInstance(MSG_OSD_REPOPREPLY, HEAD_VERSION, COMPAT_VERSION),
+    MOSDFastDispatchOp{MSG_OSD_REPOPREPLY, HEAD_VERSION, COMPAT_VERSION},
     map_epoch(e),
     min_epoch(mine),
     reqid(req->reqid),
@@ -131,7 +129,7 @@ public:
     set_tid(req->get_tid());
   }
   MOSDRepOpReply() 
-    : MessageInstance(MSG_OSD_REPOPREPLY, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDFastDispatchOp{MSG_OSD_REPOPREPLY, HEAD_VERSION, COMPAT_VERSION},
       map_epoch(0),
       min_epoch(0),
       ack_type(0), result(0),
@@ -157,7 +155,9 @@ public:
     out << ")";
   }
 
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
-
 #endif
index 40867bedc662bf7a8c36cbdb4415baa6d3e9827e..6afbd4eb693fff7cb0b92afecf2c714ed980912f 100644 (file)
  * instruct an OSD initiate a replica scrub on a specific PG
  */
 
-class MOSDRepScrub : public MessageInstance<MOSDRepScrub, MOSDFastDispatchOp> {
+class MOSDRepScrub : public MOSDFastDispatchOp {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 9;
   static constexpr int COMPAT_VERSION = 6;
 
@@ -52,14 +50,14 @@ public:
   }
 
   MOSDRepScrub()
-    : MessageInstance(MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDFastDispatchOp{MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION},
       chunky(false),
       deep(false) { }
 
   MOSDRepScrub(spg_t pgid, eversion_t scrub_to, epoch_t map_epoch, epoch_t min_epoch,
                hobject_t start, hobject_t end, bool deep,
               bool preemption, int prio, bool highprio)
-    : MessageInstance(MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDFastDispatchOp{MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION},
       pgid(pgid),
       scrub_to(scrub_to),
       map_epoch(map_epoch),
index 984ebb4ffa6432852f9b2f77b70f344818fa615e..4e46672102ab2978caf6ada6091fbb4b0c3bd65d 100644 (file)
  * pass a ScrubMap from a shard back to the primary
  */
 
-class MOSDRepScrubMap : public MessageInstance<MOSDRepScrubMap, MOSDFastDispatchOp> {
+class MOSDRepScrubMap : public MOSDFastDispatchOp {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
 
@@ -42,10 +40,10 @@ public:
   }
 
   MOSDRepScrubMap()
-    : MessageInstance(MSG_OSD_REP_SCRUBMAP, HEAD_VERSION, COMPAT_VERSION) {}
+    : MOSDFastDispatchOp{MSG_OSD_REP_SCRUBMAP, HEAD_VERSION, COMPAT_VERSION} {}
 
   MOSDRepScrubMap(spg_t pgid, epoch_t map_epoch, pg_shard_t from)
-    : MessageInstance(MSG_OSD_REP_SCRUBMAP, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDFastDispatchOp{MSG_OSD_REP_SCRUBMAP, HEAD_VERSION, COMPAT_VERSION},
       pgid(pgid),
       map_epoch(map_epoch),
       from(from) {}
@@ -77,7 +75,9 @@ public:
       decode(preempted, p);
     }
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
-
 #endif
index 8df546701ead8d0dd09e95801aae82764d2589fd..646e5e33f52d390096f9309e7456668858da6c53 100644 (file)
  * instruct an OSD to scrub some or all pg(s)
  */
 
-class MOSDScrub : public MessageInstance<MOSDScrub> {
+class MOSDScrub : public Message {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 2;
 
@@ -34,12 +32,12 @@ public:
   bool repair = false;
   bool deep = false;
 
-  MOSDScrub() : MessageInstance(MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION) {}
+  MOSDScrub() : Message{MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION} {}
   MOSDScrub(const uuid_d& f, bool r, bool d) :
-    MessageInstance(MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION),
+    Message{MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION},
     fsid(f), repair(r), deep(d) {}
   MOSDScrub(const uuid_d& f, vector<pg_t>& pgs, bool r, bool d) :
-    MessageInstance(MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION),
+    Message{MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION},
     fsid(f), scrub_pgs(pgs), repair(r), deep(d) {}
 private:
   ~MOSDScrub() override {}
@@ -73,6 +71,9 @@ public:
     decode(repair, p);
     decode(deep, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 98fb0f31a1de90650279b53a86169898076b41fb..d5156110629fa07d87fb30dcdd9eb78c9ad72474 100644 (file)
@@ -9,10 +9,8 @@
  * instruct an OSD to scrub some or all pg(s)
  */
 
-class MOSDScrub2 : public MessageInstance<MOSDScrub2> {
+class MOSDScrub2 : public Message {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 1;
   static constexpr int COMPAT_VERSION = 1;
 
@@ -22,9 +20,9 @@ public:
   bool repair = false;
   bool deep = false;
 
-  MOSDScrub2() : MessageInstance(MSG_OSD_SCRUB2, HEAD_VERSION, COMPAT_VERSION) {}
+  MOSDScrub2() : Message{MSG_OSD_SCRUB2, HEAD_VERSION, COMPAT_VERSION} {}
   MOSDScrub2(const uuid_d& f, epoch_t e, vector<spg_t>& pgs, bool r, bool d) :
-    MessageInstance(MSG_OSD_SCRUB2, HEAD_VERSION, COMPAT_VERSION),
+    Message{MSG_OSD_SCRUB2, HEAD_VERSION, COMPAT_VERSION},
     fsid(f), epoch(e), scrub_pgs(pgs), repair(r), deep(d) {}
 private:
   ~MOSDScrub2() override {}
@@ -56,4 +54,7 @@ public:
     decode(repair, p);
     decode(deep, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
index a75796f9ae8aac09e320ba00b4058398124711db..7f3eb64f1f4de2a8f812b1e7b8433edec1e6e209 100644 (file)
@@ -17,9 +17,7 @@
 
 #include "MOSDFastDispatchOp.h"
 
-class MOSDScrubReserve : public MessageInstance<MOSDScrubReserve, MOSDFastDispatchOp> {
-public:
-  friend factory;
+class MOSDScrubReserve : public MOSDFastDispatchOp {
 private:
   static constexpr int HEAD_VERSION = 1;
   static constexpr int COMPAT_VERSION = 1;
@@ -43,13 +41,13 @@ public:
   }
 
   MOSDScrubReserve()
-    : MessageInstance(MSG_OSD_SCRUB_RESERVE, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDFastDispatchOp{MSG_OSD_SCRUB_RESERVE, HEAD_VERSION, COMPAT_VERSION},
       map_epoch(0), type(-1) {}
   MOSDScrubReserve(spg_t pgid,
                   epoch_t map_epoch,
                   int type,
                   pg_shard_t from)
-    : MessageInstance(MSG_OSD_SCRUB_RESERVE, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDFastDispatchOp{MSG_OSD_SCRUB_RESERVE, HEAD_VERSION, COMPAT_VERSION},
       pgid(pgid), map_epoch(map_epoch),
       type(type), from(from) {}
 
@@ -92,6 +90,9 @@ public:
     encode(type, payload);
     encode(from, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index dc4bd0a9c71fac02f3971511806ba6011dc37493..a605c95dcd8958eb919e40bfba6fb16abb8dbe93 100644 (file)
 #include "osd/osd_types.h"
 #include "messages/PaxosServiceMessage.h"
 
-class MPGStats : public MessageInstance<MPGStats, PaxosServiceMessage> {
+class MPGStats : public PaxosServiceMessage {
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
-public:
-  friend factory;
 
+public:
   uuid_d fsid;
   std::map<pg_t, pg_stat_t> pg_stat;
   osd_stat_t osd_stat;
   std::map<int64_t, store_statfs_t> pool_stat;
   epoch_t epoch = 0;
 
-  MPGStats() : MessageInstance(MSG_PGSTATS, 0, HEAD_VERSION, COMPAT_VERSION) {}
+  MPGStats() : PaxosServiceMessage{MSG_PGSTATS, 0, HEAD_VERSION, COMPAT_VERSION} {}
   MPGStats(const uuid_d& f, epoch_t e)
-    : MessageInstance(MSG_PGSTATS, 0, HEAD_VERSION, COMPAT_VERSION),
+    : PaxosServiceMessage{MSG_PGSTATS, 0, HEAD_VERSION, COMPAT_VERSION},
       fsid(f),
       epoch(e)
   {}
index 5fe78bfc00ef257b77590bc44f43e77668ebcfde..5afbab580dd1f0c41f8bc475f56008eae1f5e399 100644 (file)
 
 #include "osd/osd_types.h"
 
-class MPGStatsAck : public MessageInstance<MPGStatsAck> {
+class MPGStatsAck : public Message {
 public:
-  friend factory;
-
   map<pg_t,pair<version_t,epoch_t> > pg_stat;
   
-  MPGStatsAck() : MessageInstance(MSG_PGSTATSACK) {}
+  MPGStatsAck() : Message{MSG_PGSTATSACK} {}
 
 private:
   ~MPGStatsAck() override {}
@@ -42,6 +40,9 @@ public:
     auto p = payload.cbegin();
     decode(pg_stat, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 4175a1d51fbd32c28d10d1c5a22747509ade6328..82730095cc4b6ae88c555b2d06c0fd8dc40b662e 100644 (file)
 
 #include "msg/Message.h"
 
-class MPing : public MessageInstance<MPing> {
+class MPing : public Message {
 public:
-  friend factory;
-
-  MPing() : MessageInstance(CEPH_MSG_PING) {}
+  MPing() : Message{CEPH_MSG_PING} {}
 private:
   ~MPing() override {}
 
index 6fddc2638ec241ff6cbb3da3c201bb37debd736f..bc46f93d1ff651e1ac98fec8cb3e73ac9f4512d5 100644 (file)
@@ -18,9 +18,7 @@
 #include "messages/PaxosServiceMessage.h"
 
 
-class MPoolOp : public MessageInstance<MPoolOp, PaxosServiceMessage> {
-public:
-  friend factory;
+class MPoolOp : public PaxosServiceMessage {
 private:
   static constexpr int HEAD_VERSION = 4;
   static constexpr int COMPAT_VERSION = 2;
@@ -34,9 +32,9 @@ public:
   __s16 crush_rule = 0;
 
   MPoolOp()
-    : MessageInstance(CEPH_MSG_POOLOP, 0, HEAD_VERSION, COMPAT_VERSION) { }
+    : PaxosServiceMessage{CEPH_MSG_POOLOP, 0, HEAD_VERSION, COMPAT_VERSION} {}
   MPoolOp(const uuid_d& f, ceph_tid_t t, int p, std::string& n, int o, version_t v)
-    : MessageInstance(CEPH_MSG_POOLOP, v, HEAD_VERSION, COMPAT_VERSION),
+    : PaxosServiceMessage{CEPH_MSG_POOLOP, v, HEAD_VERSION, COMPAT_VERSION},
       fsid(f), pool(p), name(n), op(o),
       snapid(0), crush_rule(0) {
     set_tid(t);
@@ -92,6 +90,9 @@ public:
     } else
       crush_rule = -1;
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index f4584e1d2f427ce1d575e73d923af53953139e0f..df06525db78165db3107ed37e560538eb85db482 100644 (file)
 
 #include "common/errno.h"
 
-class MPoolOpReply : public MessageInstance<MPoolOpReply, PaxosServiceMessage> {
+class MPoolOpReply : public PaxosServiceMessage {
 public:
-  friend factory;
-
   uuid_d fsid;
   __u32 replyCode = 0;
   epoch_t epoch = 0;
   ceph::buffer::list response_data;
 
-  MPoolOpReply() : MessageInstance(CEPH_MSG_POOLOP_REPLY, 0)
+  MPoolOpReply() : PaxosServiceMessage{CEPH_MSG_POOLOP_REPLY, 0}
   {}
   MPoolOpReply( uuid_d& f, ceph_tid_t t, int rc, int e, version_t v) :
-    MessageInstance(CEPH_MSG_POOLOP_REPLY, v),
+    PaxosServiceMessage{CEPH_MSG_POOLOP_REPLY, v},
     fsid(f),
     replyCode(rc),
     epoch(e) {
@@ -37,7 +35,7 @@ public:
   }
   MPoolOpReply(uuid_d& f, ceph_tid_t t, int rc, int e, version_t v,
               ceph::buffer::list *blp) :
-    MessageInstance(CEPH_MSG_POOLOP_REPLY, v),
+    PaxosServiceMessage{CEPH_MSG_POOLOP_REPLY, v},
     fsid(f),
     replyCode(rc),
     epoch(e) {
@@ -79,6 +77,9 @@ public:
       decode(response_data, p);
     }
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 2dc7d6c37c4c9bb463683900ed8b1c632d7c5418..5c375601ba975dfe99c37bb209d9e65130e80077 100644 (file)
@@ -18,9 +18,7 @@
 #include "msg/Message.h"
 #include "messages/MOSDPeeringOp.h"
 
-class MRecoveryReserve : public MessageInstance<MRecoveryReserve, MOSDPeeringOp> {
-public:
-  friend factory;
+class MRecoveryReserve : public MOSDPeeringOp {
 private:
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 2;
@@ -74,13 +72,13 @@ public:
   }
 
   MRecoveryReserve()
-    : MessageInstance(MSG_OSD_RECOVERY_RESERVE, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDPeeringOp{MSG_OSD_RECOVERY_RESERVE, HEAD_VERSION, COMPAT_VERSION},
       query_epoch(0), type(-1) {}
   MRecoveryReserve(int type,
                   spg_t pgid,
                   epoch_t query_epoch,
                   unsigned prio = 0)
-    : MessageInstance(MSG_OSD_RECOVERY_RESERVE, HEAD_VERSION, COMPAT_VERSION),
+    : MOSDPeeringOp{MSG_OSD_RECOVERY_RESERVE, HEAD_VERSION, COMPAT_VERSION},
       pgid(pgid), query_epoch(query_epoch),
       type(type), priority(prio) {}
 
@@ -125,6 +123,9 @@ public:
     encode(pgid.shard, payload);
     encode(priority, payload);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 96f1f2df7228a2bb50e30bc20bdb757002446d54..c70aaf653a510417bb739185b74595a5be83ee46 100644 (file)
 
 #include "messages/PaxosServiceMessage.h"
 
-class MRemoveSnaps : public MessageInstance<MRemoveSnaps, PaxosServiceMessage> {
+class MRemoveSnaps : public PaxosServiceMessage {
 public:
-  friend factory;
-
   map<int, vector<snapid_t> > snaps;
   
 protected:
   MRemoveSnaps() : 
-    MessageInstance(MSG_REMOVE_SNAPS, 0) { }
+    PaxosServiceMessage{MSG_REMOVE_SNAPS, 0} { }
   MRemoveSnaps(map<int, vector<snapid_t> >& s) : 
-    MessageInstance(MSG_REMOVE_SNAPS, 0) {
+    PaxosServiceMessage{MSG_REMOVE_SNAPS, 0} {
     snaps.swap(s);
   }
   ~MRemoveSnaps() override {}
@@ -49,7 +47,9 @@ public:
     decode(snaps, p);
     ceph_assert(p.end());
   }
-
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index d0cf441e33937725ff01997ae75a497c320badd1..90f36ef49c5fb76fd41f603ca12978ef36261fca 100644 (file)
 #include "msg/Message.h"
 #include "include/encoding.h"
 
-class MRoute : public MessageInstance<MRoute> {
+class MRoute : public Message {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 3;
 
@@ -31,12 +29,12 @@ public:
   Message *msg;
   epoch_t send_osdmap_first;
   
-  MRoute() : MessageInstance(MSG_ROUTE, HEAD_VERSION, COMPAT_VERSION),
+  MRoute() : Message{MSG_ROUTE, HEAD_VERSION, COMPAT_VERSION},
             session_mon_tid(0),
             msg(NULL),
             send_osdmap_first(0) {}
   MRoute(uint64_t t, Message *m)
-    : MessageInstance(MSG_ROUTE, HEAD_VERSION, COMPAT_VERSION),
+    : Message{MSG_ROUTE, HEAD_VERSION, COMPAT_VERSION},
       session_mon_tid(t),
       msg(m),
       send_osdmap_first(0) {}
@@ -83,6 +81,9 @@ public:
     else
       o << " tid (none)";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 275acfcd34206d1eb9ad46884b599461abc1e00b..45d50b67b699a25631bb9628fcfe73ee15a8082c 100644 (file)
@@ -6,15 +6,13 @@
 #include "msg/Message.h"
 #include "mgr/ServiceMap.h"
 
-class MServiceMap : public MessageInstance<MServiceMap> {
+class MServiceMap : public Message {
 public:
-  friend factory;
-
   ServiceMap service_map;
 
-  MServiceMap() : MessageInstance(MSG_SERVICE_MAP) { }
+  MServiceMap() : Message{MSG_SERVICE_MAP} { }
   explicit MServiceMap(const ServiceMap& sm)
-    : MessageInstance(MSG_SERVICE_MAP),
+    : Message{MSG_SERVICE_MAP},
       service_map(sm) {
   }
 private:
@@ -34,4 +32,7 @@ public:
     auto p = payload.cbegin();
     decode(service_map, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
index f7b060bdd5bdeda262c903fb070e42884e148c27..bb5810fd0a80ce10f1b6fac1bb87b9619504abf0 100644 (file)
@@ -19,9 +19,7 @@
 #include <sys/statvfs.h>    /* or <sys/statfs.h> */
 #include "messages/PaxosServiceMessage.h"
 
-class MStatfs : public MessageInstance<MStatfs, PaxosServiceMessage> {
-public:
-  friend factory;
+class MStatfs : public PaxosServiceMessage {
 private:
   static constexpr int HEAD_VERSION = 2;
   static constexpr int COMPAT_VERSION = 1;
@@ -30,11 +28,11 @@ public:
   uuid_d fsid;
   boost::optional<int64_t> data_pool;
 
-  MStatfs() : MessageInstance(CEPH_MSG_STATFS, 0, HEAD_VERSION, COMPAT_VERSION) {}
+  MStatfs() : PaxosServiceMessage{CEPH_MSG_STATFS, 0, HEAD_VERSION, COMPAT_VERSION} {}
   MStatfs(const uuid_d& f, ceph_tid_t t, boost::optional<int64_t> _data_pool,
-             version_t v) : MessageInstance(CEPH_MSG_STATFS, v,
-                                            HEAD_VERSION, COMPAT_VERSION),
-                                                fsid(f), data_pool(_data_pool) {
+         version_t v)
+    : PaxosServiceMessage{CEPH_MSG_STATFS, v, HEAD_VERSION, COMPAT_VERSION},
+      fsid(f), data_pool(_data_pool) {
     set_tid(t);
   }
 
@@ -65,6 +63,9 @@ public:
       data_pool = boost::optional<int64_t> ();
     }
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 181c2c64cc6220c17be0e5f2ef5b94674a017169..3bdcfe0a75cc00f8351dc7e30db00343323d20f3 100644 (file)
 #ifndef CEPH_MSTATFSREPLY_H
 #define CEPH_MSTATFSREPLY_H
 
-class MStatfsReply : public MessageInstance<MStatfsReply> {
+class MStatfsReply : public Message {
 public:
-  friend factory;
-
   struct ceph_mon_statfs_reply h{};
 
-  MStatfsReply() : MessageInstance(CEPH_MSG_STATFS_REPLY) {}
-  MStatfsReply(uuid_d &f, ceph_tid_t t, epoch_t epoch) : MessageInstance(CEPH_MSG_STATFS_REPLY) {
+  MStatfsReply() : Message{CEPH_MSG_STATFS_REPLY} {}
+  MStatfsReply(uuid_d &f, ceph_tid_t t, epoch_t epoch)
+    : Message{CEPH_MSG_STATFS_REPLY} {
     memcpy(&h.fsid, f.bytes(), sizeof(h.fsid));
     header.tid = t;
     h.version = epoch;
@@ -42,6 +41,9 @@ public:
     auto p = payload.cbegin();
     decode(h, p);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 994c6dd8bb57d4e6c7b13817186ce0ed6e205d7b..fe96f5a0f1193b8818fcd8755b75f4d3f24a530c 100644 (file)
 #ifndef CEPH_MTIMECHECK_H
 #define CEPH_MTIMECHECK_H
 
-class MTimeCheck : public MessageInstance<MTimeCheck> {
+class MTimeCheck : public Message {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 1;
 
   enum {
@@ -35,14 +33,14 @@ public:
   map<entity_inst_t, double> skews;
   map<entity_inst_t, double> latencies;
 
-  MTimeCheck() : MessageInstance(MSG_TIMECHECK, HEAD_VERSION) { }
+  MTimeCheck() : Message{MSG_TIMECHECK, HEAD_VERSION} {}
   MTimeCheck(int op) :
-    MessageInstance(MSG_TIMECHECK, HEAD_VERSION),
+    Message{MSG_TIMECHECK, HEAD_VERSION},
     op(op)
-  { }
+  {}
 
 private:
-  ~MTimeCheck() override { }
+  ~MTimeCheck() override {}
 
 public:
   std::string_view get_type_name() const override { return "time_check"; }
@@ -85,6 +83,9 @@ public:
     encode(skews, payload, features);
     encode(latencies, payload, features);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif /* CEPH_MTIMECHECK_H */
index 1d93fcc916cd68e02492c5570abd0d2eaf96ea88..32f089c09267622e2bf5650643dcf018dd1cded7 100644 (file)
 
 #pragma once
 
-class MTimeCheck2 : public MessageInstance<MTimeCheck2> {
+class MTimeCheck2 : public Message {
 public:
-  friend factory;
-
   static constexpr int HEAD_VERSION = 1;
   static constexpr int COMPAT_VERSION = 1;
 
@@ -35,9 +33,9 @@ public:
   map<int, double> skews;
   map<int, double> latencies;
 
-  MTimeCheck2() : MessageInstance(MSG_TIMECHECK2, HEAD_VERSION, COMPAT_VERSION) { }
+  MTimeCheck2() : Message{MSG_TIMECHECK2, HEAD_VERSION, COMPAT_VERSION} { }
   MTimeCheck2(int op) :
-    MessageInstance(MSG_TIMECHECK2, HEAD_VERSION, COMPAT_VERSION),
+    Message{MSG_TIMECHECK2, HEAD_VERSION, COMPAT_VERSION},
     op(op)
   { }
 
@@ -85,4 +83,7 @@ public:
     encode(skews, payload, features);
     encode(latencies, payload, features);
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
index 63b4350c4f08f4cb4c16d6898de11f12bed87a90..7a31ec8c56bbfc02e6d6a09897b0cf84564b5c96 100644 (file)
@@ -19,9 +19,7 @@
 #include "msg/Message.h"
 
 
-class MWatchNotify : public MessageInstance<MWatchNotify> {
-public:
-  friend factory;
+class MWatchNotify : public Message {
 private:
   static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 1;
@@ -36,9 +34,9 @@ private:
   uint64_t notifier_gid; ///< who sent the notify
 
   MWatchNotify()
-    : MessageInstance(CEPH_MSG_WATCH_NOTIFY, HEAD_VERSION, COMPAT_VERSION) { }
+    : Message{CEPH_MSG_WATCH_NOTIFY, HEAD_VERSION, COMPAT_VERSION} { }
   MWatchNotify(uint64_t c, uint64_t v, uint64_t i, uint8_t o, ceph::buffer::list b)
-    : MessageInstance(CEPH_MSG_WATCH_NOTIFY, HEAD_VERSION, COMPAT_VERSION),
+    : Message{CEPH_MSG_WATCH_NOTIFY, HEAD_VERSION, COMPAT_VERSION},
       cookie(c),
       ver(v),
       notify_id(i),
@@ -92,6 +90,9 @@ public:
        << " ret " << return_code
        << ")";
   }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
index 0c47cfcd2eea542c61cc9bf9fc8e4e7125a0f422..de867c620d771b707676d58ad2c99416d9b3c920 100644 (file)
@@ -2767,7 +2767,7 @@ void DaemonServer::_send_configure(ConnectionRef c)
 {
   ceph_assert(lock.is_locked_by_me());
 
-  auto configure = new MMgrConfigure();
+  auto configure = make_message<MMgrConfigure>();
   configure->stats_period = g_conf().get_val<int64_t>("mgr_stats_period");
   configure->stats_threshold = g_conf().get_val<int64_t>("mgr_stats_threshold");
 
@@ -2776,7 +2776,7 @@ void DaemonServer::_send_configure(ConnectionRef c)
         osd_perf_metric_collector.get_queries();
   }
 
-  c->send_message(configure);
+  c->send_message2(configure);
 }
 
 OSDPerfMetricQueryID DaemonServer::add_osd_perf_query(
index 9ece47bbb92b82928956353c67b0471d70c417c9..d2ecd02ee222c1bd83a868c07342e7b1af27edc6 100644 (file)
@@ -184,7 +184,7 @@ void MgrClient::reconnect()
 void MgrClient::_send_open()
 {
   if (session && session->con) {
-    auto open = new MMgrOpen();
+    auto open = make_message<MMgrOpen>();
     if (!service_name.empty()) {
       open->service_name = service_name;
       open->daemon_name = daemon_name;
@@ -197,7 +197,7 @@ void MgrClient::_send_open()
     }
     cct->_conf.get_config_bl(0, &open->config_bl, &last_config_bl_version);
     cct->_conf.get_defaults_bl(&open->config_defaults_bl);
-    session->con->send_message(open);
+    session->con->send_message2(open);
   }
 }
 
@@ -258,7 +258,7 @@ void MgrClient::_send_report()
   ceph_assert(session);
   report_callback = nullptr;
 
-  auto report = new MMgrReport();
+  auto report = make_message<MMgrReport>();
   auto pcc = cct->get_perfcounters_collection();
 
   pcc->with_counters([this, report](
@@ -359,7 +359,7 @@ void MgrClient::_send_report()
     get_perf_report_cb(&report->osd_perf_metric_reports);
   }
 
-  session->con->send_message(report);
+  session->con->send_message2(report);
 }
 
 void MgrClient::send_pgstats()
index 6258c20f861e8c8cbb8368ffe80c6a83a234a073..66903ec9b570f1db9e40f9803d49440f16b0a5ce 100644 (file)
@@ -379,7 +379,7 @@ bool MDSMonitor::preprocess_beacon(MonOpRequestRef op)
       MDSMap null_map;
       null_map.epoch = fsmap.epoch;
       null_map.compat = fsmap.compat;
-      auto m = MMDSMap::create(mon->monmap->fsid, null_map);
+      auto m = make_message<MMDSMap>(mon->monmap->fsid, null_map);
       mon->send_reply(op, m.detach());
       return true;
     } else {
@@ -455,7 +455,7 @@ bool MDSMonitor::preprocess_beacon(MonOpRequestRef op)
   ceph_assert(effective_epoch > 0);
   _note_beacon(m);
   {
-    auto beacon = MMDSBeacon::create(mon->monmap->fsid,
+    auto beacon = make_message<MMDSBeacon>(mon->monmap->fsid,
         m->get_global_id(), m->get_name(), effective_epoch,
         state, seq, CEPH_FEATURES_SUPPORTED_DEFAULT);
     mon->send_reply(op, beacon.detach());
@@ -645,7 +645,7 @@ bool MDSMonitor::prepare_beacon(MonOpRequestRef op)
           MDSMap null_map;
           null_map.epoch = fsmap.epoch;
           null_map.compat = fsmap.compat;
-          auto m = MMDSMap::create(mon->monmap->fsid, null_map);
+          auto m = make_message<MMDSMap>(mon->monmap->fsid, null_map);
           mon->send_reply(op, m.detach());
         } else {
           dispatch(op);        // try again
@@ -720,7 +720,7 @@ bool MDSMonitor::prepare_beacon(MonOpRequestRef op)
       last_beacon.erase(gid);
 
       // Respond to MDS, so that it knows it can continue to shut down
-      auto beacon = MMDSBeacon::create(
+      auto beacon = make_message<MMDSBeacon>(
                        mon->monmap->fsid, m->get_global_id(),
                        m->get_name(), pending.get_epoch(), state, seq,
                        CEPH_FEATURES_SUPPORTED_DEFAULT);
@@ -738,7 +738,7 @@ bool MDSMonitor::prepare_beacon(MonOpRequestRef op)
       request_proposal(mon->osdmon());
 
       // Respond to MDS, so that it knows it can continue to shut down
-      auto beacon = MMDSBeacon::create(mon->monmap->fsid,
+      auto beacon = make_message<MMDSBeacon>(mon->monmap->fsid,
           m->get_global_id(), m->get_name(), pending.get_epoch(), state, seq,
           CEPH_FEATURES_SUPPORTED_DEFAULT);
       mon->send_reply(op, beacon.detach());
@@ -828,10 +828,10 @@ void MDSMonitor::_updated(MonOpRequestRef op)
     MDSMap null_map;
     null_map.epoch = fsmap.epoch;
     null_map.compat = fsmap.compat;
-    auto m = MMDSMap::create(mon->monmap->fsid, null_map);
+    auto m = make_message<MMDSMap>(mon->monmap->fsid, null_map);
     mon->send_reply(op, m.detach());
   } else {
-    auto beacon = MMDSBeacon::create(mon->monmap->fsid,
+    auto beacon = make_message<MMDSBeacon>(mon->monmap->fsid,
         m->get_global_id(), m->get_name(), fsmap.get_epoch(),
         m->get_state(), m->get_seq(), CEPH_FEATURES_SUPPORTED_DEFAULT);
     mon->send_reply(op, beacon.detach());
@@ -1647,7 +1647,7 @@ void MDSMonitor::check_sub(Subscription *sub)
     if (sub->next > mds_map->epoch) {
       return;
     }
-    auto msg = MMDSMap::create(mon->monmap->fsid, *mds_map);
+    auto msg = make_message<MMDSMap>(mon->monmap->fsid, *mds_map);
 
     sub->session->con->send_message(msg.detach());
     if (sub->onetime) {
index 453ac87aaafd03a300b3850c498661f8202d8ffe..a9f935d29a1ad3565e9b31579e33c468b9c6e816 100644 (file)
@@ -584,7 +584,7 @@ void MgrMonitor::check_sub(Subscription *sub)
     if (sub->next <= map.get_epoch()) {
       dout(20) << "Sending map to subscriber " << sub->session->con
               << " " << sub->session->con->get_peer_addr() << dendl;
-      sub->session->con->send_message(new MMgrMap(map));
+      sub->session->con->send_message2(make_message<MMgrMap>(map));
       if (sub->onetime) {
         mon->session_map.remove_sub(sub);
       } else {
@@ -626,7 +626,7 @@ void MgrMonitor::send_digests()
   for (auto sub : *(mon->session_map.subs[type])) {
     dout(10) << __func__ << " sending digest to subscriber " << sub->session->con
             << " " << sub->session->con->get_peer_addr() << dendl;
-    MMgrDigest *mdigest = new MMgrDigest;
+    auto mdigest = make_message<MMgrDigest>();
 
     JSONFormatter f;
     mon->get_health_status(true, &f, nullptr, nullptr, nullptr);
@@ -638,7 +638,7 @@ void MgrMonitor::send_digests()
     f.flush(mdigest->mon_status_json);
     f.reset();
 
-    sub->session->con->send_message(mdigest);
+    sub->session->con->send_message2(mdigest);
   }
 
 timer:
index 77a65f005ae205b7c2bbd2f37bdde8c1830276bb..b091da2b387ea7d0ad500cec3e6928454cbcd689 100644 (file)
@@ -338,510 +338,510 @@ Message *decode_message(CephContext *cct, int crcflags,
     // -- with payload --
 
   case MSG_PGSTATS:
-    m = MPGStats::create();
+    m = make_message<MPGStats>();
     break;
   case MSG_PGSTATSACK:
-    m = MPGStatsAck::create();
+    m = make_message<MPGStatsAck>();
     break;
 
   case CEPH_MSG_STATFS:
-    m = MStatfs::create();
+    m = make_message<MStatfs>();
     break;
   case CEPH_MSG_STATFS_REPLY:
-    m = MStatfsReply::create();
+    m = make_message<MStatfsReply>();
     break;
   case MSG_GETPOOLSTATS:
-    m = MGetPoolStats::create();
+    m = make_message<MGetPoolStats>();
     break;
   case MSG_GETPOOLSTATSREPLY:
-    m = MGetPoolStatsReply::create();
+    m = make_message<MGetPoolStatsReply>();
     break;
   case CEPH_MSG_POOLOP:
-    m = MPoolOp::create();
+    m = make_message<MPoolOp>();
     break;
   case CEPH_MSG_POOLOP_REPLY:
-    m = MPoolOpReply::create();
+    m = make_message<MPoolOpReply>();
     break;
   case MSG_MON_COMMAND:
-    m = MMonCommand::create();
+    m = make_message<MMonCommand>();
     break;
   case MSG_MON_COMMAND_ACK:
-    m = MMonCommandAck::create();
+    m = make_message<MMonCommandAck>();
     break;
   case MSG_MON_PAXOS:
-    m = MMonPaxos::create();
+    m = make_message<MMonPaxos>();
     break;
   case MSG_CONFIG:
-    m = MConfig::create();
+    m = make_message<MConfig>();
     break;
   case MSG_GET_CONFIG:
-    m = MGetConfig::create();
+    m = make_message<MGetConfig>();
     break;
 
   case MSG_MON_PROBE:
-    m = MMonProbe::create();
+    m = make_message<MMonProbe>();
     break;
   case MSG_MON_JOIN:
-    m = MMonJoin::create();
+    m = make_message<MMonJoin>();
     break;
   case MSG_MON_ELECTION:
-    m = MMonElection::create();
+    m = make_message<MMonElection>();
     break;
   case MSG_MON_SYNC:
-    m = MMonSync::create();
+    m = make_message<MMonSync>();
     break;
   case MSG_MON_SCRUB:
-    m = MMonScrub::create();
+    m = make_message<MMonScrub>();
     break;
 
   case MSG_LOG:
-    m = MLog::create();
+    m = make_message<MLog>();
     break;
   case MSG_LOGACK:
-    m = MLogAck::create();
+    m = make_message<MLogAck>();
     break;
 
   case CEPH_MSG_PING:
-    m = MPing::create();
+    m = make_message<MPing>();
     break;
   case MSG_COMMAND:
-    m = MCommand::create();
+    m = make_message<MCommand>();
     break;
   case MSG_COMMAND_REPLY:
-    m = MCommandReply::create();
+    m = make_message<MCommandReply>();
     break;
   case MSG_OSD_BACKFILL_RESERVE:
-    m = MBackfillReserve::create();
+    m = make_message<MBackfillReserve>();
     break;
   case MSG_OSD_RECOVERY_RESERVE:
-    m = MRecoveryReserve::create();
+    m = make_message<MRecoveryReserve>();
     break;
   case MSG_OSD_FORCE_RECOVERY:
-    m = MOSDForceRecovery::create();
+    m = make_message<MOSDForceRecovery>();
     break;
 
   case MSG_ROUTE:
-    m = MRoute::create();
+    m = make_message<MRoute>();
     break;
   case MSG_FORWARD:
-    m = MForward::create();
+    m = make_message<MForward>();
     break;
     
   case CEPH_MSG_MON_MAP:
-    m = MMonMap::create();
+    m = make_message<MMonMap>();
     break;
   case CEPH_MSG_MON_GET_MAP:
-    m = MMonGetMap::create();
+    m = make_message<MMonGetMap>();
     break;
   case CEPH_MSG_MON_GET_OSDMAP:
-    m = MMonGetOSDMap::create();
+    m = make_message<MMonGetOSDMap>();
     break;
   case CEPH_MSG_MON_GET_VERSION:
-    m = MMonGetVersion::create();
+    m = make_message<MMonGetVersion>();
     break;
   case CEPH_MSG_MON_GET_VERSION_REPLY:
-    m = MMonGetVersionReply::create();
+    m = make_message<MMonGetVersionReply>();
     break;
   case CEPH_MSG_MON_METADATA:
-    m = MMonMetadata::create();
+    m = make_message<MMonMetadata>();
     break;
 
   case MSG_OSD_BOOT:
-    m = MOSDBoot::create();
+    m = make_message<MOSDBoot>();
     break;
   case MSG_OSD_ALIVE:
-    m = MOSDAlive::create();
+    m = make_message<MOSDAlive>();
     break;
   case MSG_OSD_BEACON:
-    m = MOSDBeacon::create();
+    m = make_message<MOSDBeacon>();
     break;
   case MSG_OSD_PGTEMP:
-    m = MOSDPGTemp::create();
+    m = make_message<MOSDPGTemp>();
     break;
   case MSG_OSD_FAILURE:
-    m = MOSDFailure::create();
+    m = make_message<MOSDFailure>();
     break;
   case MSG_OSD_MARK_ME_DOWN:
-    m = MOSDMarkMeDown::create();
+    m = make_message<MOSDMarkMeDown>();
     break;
   case MSG_OSD_FULL:
-    m = MOSDFull::create();
+    m = make_message<MOSDFull>();
     break;
   case MSG_OSD_PING:
-    m = MOSDPing::create();
+    m = make_message<MOSDPing>();
     break;
   case CEPH_MSG_OSD_OP:
-    m = MOSDOp::create();
+    m = make_message<MOSDOp>();
     break;
   case CEPH_MSG_OSD_OPREPLY:
-    m = MOSDOpReply::create();
+    m = make_message<MOSDOpReply>();
     break;
   case MSG_OSD_REPOP:
-    m = MOSDRepOp::create();
+    m = make_message<MOSDRepOp>();
     break;
   case MSG_OSD_REPOPREPLY:
-    m = MOSDRepOpReply::create();
+    m = make_message<MOSDRepOpReply>();
     break;
   case MSG_OSD_PG_CREATED:
-    m = MOSDPGCreated::create();
+    m = make_message<MOSDPGCreated>();
     break;
   case MSG_OSD_PG_UPDATE_LOG_MISSING:
-    m = MOSDPGUpdateLogMissing::create();
+    m = make_message<MOSDPGUpdateLogMissing>();
     break;
   case MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY:
-    m = MOSDPGUpdateLogMissingReply::create();
+    m = make_message<MOSDPGUpdateLogMissingReply>();
     break;
   case CEPH_MSG_OSD_BACKOFF:
-    m = MOSDBackoff::create();
+    m = make_message<MOSDBackoff>();
     break;
 
   case CEPH_MSG_OSD_MAP:
-    m = MOSDMap::create();
+    m = make_message<MOSDMap>();
     break;
 
   case CEPH_MSG_WATCH_NOTIFY:
-    m = MWatchNotify::create();
+    m = make_message<MWatchNotify>();
     break;
 
   case MSG_OSD_PG_NOTIFY:
-    m = MOSDPGNotify::create();
+    m = make_message<MOSDPGNotify>();
     break;
   case MSG_OSD_PG_QUERY:
-    m = MOSDPGQuery::create();
+    m = make_message<MOSDPGQuery>();
     break;
   case MSG_OSD_PG_LOG:
-    m = MOSDPGLog::create();
+    m = make_message<MOSDPGLog>();
     break;
   case MSG_OSD_PG_REMOVE:
-    m = MOSDPGRemove::create();
+    m = make_message<MOSDPGRemove>();
     break;
   case MSG_OSD_PG_INFO:
-    m = MOSDPGInfo::create();
+    m = make_message<MOSDPGInfo>();
     break;
   case MSG_OSD_PG_CREATE:
-    m = MOSDPGCreate::create();
+    m = make_message<MOSDPGCreate>();
     break;
   case MSG_OSD_PG_CREATE2:
-    m = MOSDPGCreate2::create();
+    m = make_message<MOSDPGCreate2>();
     break;
   case MSG_OSD_PG_TRIM:
-    m = MOSDPGTrim::create();
+    m = make_message<MOSDPGTrim>();
     break;
 
   case MSG_OSD_SCRUB:
-    m = MOSDScrub::create();
+    m = make_message<MOSDScrub>();
     break;
   case MSG_OSD_SCRUB2:
-    m = MOSDScrub2::create();
+    m = make_message<MOSDScrub2>();
     break;
   case MSG_OSD_SCRUB_RESERVE:
-    m = MOSDScrubReserve::create();
+    m = make_message<MOSDScrubReserve>();
     break;
   case MSG_REMOVE_SNAPS:
-    m = MRemoveSnaps::create();
+    m = make_message<MRemoveSnaps>();
     break;
   case MSG_OSD_REP_SCRUB:
-    m = MOSDRepScrub::create();
+    m = make_message<MOSDRepScrub>();
     break;
   case MSG_OSD_REP_SCRUBMAP:
-    m = MOSDRepScrubMap::create();
+    m = make_message<MOSDRepScrubMap>();
     break;
   case MSG_OSD_PG_SCAN:
-    m = MOSDPGScan::create();
+    m = make_message<MOSDPGScan>();
     break;
   case MSG_OSD_PG_BACKFILL:
-    m = MOSDPGBackfill::create();
+    m = make_message<MOSDPGBackfill>();
     break;
   case MSG_OSD_PG_BACKFILL_REMOVE:
-    m = MOSDPGBackfillRemove::create();
+    m = make_message<MOSDPGBackfillRemove>();
     break;
   case MSG_OSD_PG_PUSH:
-    m = MOSDPGPush::create();
+    m = make_message<MOSDPGPush>();
     break;
   case MSG_OSD_PG_PULL:
-    m = MOSDPGPull::create();
+    m = make_message<MOSDPGPull>();
     break;
   case MSG_OSD_PG_PUSH_REPLY:
-    m = MOSDPGPushReply::create();
+    m = make_message<MOSDPGPushReply>();
     break;
   case MSG_OSD_PG_RECOVERY_DELETE:
-    m = MOSDPGRecoveryDelete::create();
+    m = make_message<MOSDPGRecoveryDelete>();
     break;
   case MSG_OSD_PG_RECOVERY_DELETE_REPLY:
-    m = MOSDPGRecoveryDeleteReply::create();
+    m = make_message<MOSDPGRecoveryDeleteReply>();
     break;
   case MSG_OSD_PG_READY_TO_MERGE:
-    m = MOSDPGReadyToMerge::create();
+    m = make_message<MOSDPGReadyToMerge>();
     break;
   case MSG_OSD_EC_WRITE:
-    m = MOSDECSubOpWrite::create();
+    m = make_message<MOSDECSubOpWrite>();
     break;
   case MSG_OSD_EC_WRITE_REPLY:
-    m = MOSDECSubOpWriteReply::create();
+    m = make_message<MOSDECSubOpWriteReply>();
     break;
   case MSG_OSD_EC_READ:
-    m = MOSDECSubOpRead::create();
+    m = make_message<MOSDECSubOpRead>();
     break;
   case MSG_OSD_EC_READ_REPLY:
-    m = MOSDECSubOpReadReply::create();
+    m = make_message<MOSDECSubOpReadReply>();
     break;
    // auth
   case CEPH_MSG_AUTH:
-    m = MAuth::create();
+    m = make_message<MAuth>();
     break;
   case CEPH_MSG_AUTH_REPLY:
-    m = MAuthReply::create();
+    m = make_message<MAuthReply>();
     break;
 
   case MSG_MON_GLOBAL_ID:
-    m = MMonGlobalID::create();
+    m = make_message<MMonGlobalID>();
     break; 
 
     // clients
   case CEPH_MSG_MON_SUBSCRIBE:
-    m = MMonSubscribe::create();
+    m = make_message<MMonSubscribe>();
     break;
   case CEPH_MSG_MON_SUBSCRIBE_ACK:
-    m = MMonSubscribeAck::create();
+    m = make_message<MMonSubscribeAck>();
     break;
   case CEPH_MSG_CLIENT_SESSION:
-    m = MClientSession::create();
+    m = make_message<MClientSession>();
     break;
   case CEPH_MSG_CLIENT_RECONNECT:
-    m = MClientReconnect::create();
+    m = make_message<MClientReconnect>();
     break;
   case CEPH_MSG_CLIENT_REQUEST:
-    m = MClientRequest::create();
+    m = make_message<MClientRequest>();
     break;
   case CEPH_MSG_CLIENT_REQUEST_FORWARD:
-    m = MClientRequestForward::create();
+    m = make_message<MClientRequestForward>();
     break;
   case CEPH_MSG_CLIENT_REPLY:
-    m = MClientReply::create();
+    m = make_message<MClientReply>();
     break;
   case CEPH_MSG_CLIENT_RECLAIM:
-    m = MClientReclaim::create();
+    m = make_message<MClientReclaim>();
     break;
   case CEPH_MSG_CLIENT_RECLAIM_REPLY:
-    m = MClientReclaimReply::create();
+    m = make_message<MClientReclaimReply>();
     break;
   case CEPH_MSG_CLIENT_CAPS:
-    m = MClientCaps::create();
+    m = make_message<MClientCaps>();
     break;
   case CEPH_MSG_CLIENT_CAPRELEASE:
-    m = MClientCapRelease::create();
+    m = make_message<MClientCapRelease>();
     break;
   case CEPH_MSG_CLIENT_LEASE:
-    m = MClientLease::create();
+    m = make_message<MClientLease>();
     break;
   case CEPH_MSG_CLIENT_SNAP:
-    m = MClientSnap::create();
+    m = make_message<MClientSnap>();
     break;
   case CEPH_MSG_CLIENT_QUOTA:
-    m = MClientQuota::create();
+    m = make_message<MClientQuota>();
     break;
 
     // mds
   case MSG_MDS_SLAVE_REQUEST:
-    m = MMDSSlaveRequest::create();
+    m = make_message<MMDSSlaveRequest>();
     break;
 
   case CEPH_MSG_MDS_MAP:
-    m = MMDSMap::create();
+    m = make_message<MMDSMap>();
     break;
   case CEPH_MSG_FS_MAP:
-    m = MFSMap::create();
+    m = make_message<MFSMap>();
     break;
   case CEPH_MSG_FS_MAP_USER:
-    m = MFSMapUser::create();
+    m = make_message<MFSMapUser>();
     break;
   case MSG_MDS_BEACON:
-    m = MMDSBeacon::create();
+    m = make_message<MMDSBeacon>();
     break;
   case MSG_MDS_OFFLOAD_TARGETS:
-    m = MMDSLoadTargets::create();
+    m = make_message<MMDSLoadTargets>();
     break;
   case MSG_MDS_RESOLVE:
-    m = MMDSResolve::create();
+    m = make_message<MMDSResolve>();
     break;
   case MSG_MDS_RESOLVEACK:
-    m = MMDSResolveAck::create();
+    m = make_message<MMDSResolveAck>();
     break;
   case MSG_MDS_CACHEREJOIN:
-    m = MMDSCacheRejoin::create();
+    m = make_message<MMDSCacheRejoin>();
        break;
   
   case MSG_MDS_DIRUPDATE:
-    m = MDirUpdate::create();
+    m = make_message<MDirUpdate>();
     break;
 
   case MSG_MDS_DISCOVER:
-    m = MDiscover::create();
+    m = make_message<MDiscover>();
     break;
   case MSG_MDS_DISCOVERREPLY:
-    m = MDiscoverReply::create();
+    m = make_message<MDiscoverReply>();
     break;
 
   case MSG_MDS_FINDINO:
-    m = MMDSFindIno::create();
+    m = make_message<MMDSFindIno>();
     break;
   case MSG_MDS_FINDINOREPLY:
-    m = MMDSFindInoReply::create();
+    m = make_message<MMDSFindInoReply>();
     break;
 
   case MSG_MDS_OPENINO:
-    m = MMDSOpenIno::create();
+    m = make_message<MMDSOpenIno>();
     break;
   case MSG_MDS_OPENINOREPLY:
-    m = MMDSOpenInoReply::create();
+    m = make_message<MMDSOpenInoReply>();
     break;
 
   case MSG_MDS_SNAPUPDATE:
-    m = MMDSSnapUpdate::create();
+    m = make_message<MMDSSnapUpdate>();
     break;
 
   case MSG_MDS_FRAGMENTNOTIFY:
-    m = MMDSFragmentNotify::create();
+    m = make_message<MMDSFragmentNotify>();
     break;
 
   case MSG_MDS_FRAGMENTNOTIFYACK:
-    m = MMDSFragmentNotifyAck::create();
+    m = make_message<MMDSFragmentNotifyAck>();
     break;
 
   case MSG_MDS_EXPORTDIRDISCOVER:
-    m = MExportDirDiscover::create();
+    m = make_message<MExportDirDiscover>();
     break;
   case MSG_MDS_EXPORTDIRDISCOVERACK:
-    m = MExportDirDiscoverAck::create();
+    m = make_message<MExportDirDiscoverAck>();
     break;
   case MSG_MDS_EXPORTDIRCANCEL:
-    m = MExportDirCancel::create();
+    m = make_message<MExportDirCancel>();
     break;
 
   case MSG_MDS_EXPORTDIR:
-    m = MExportDir::create();
+    m = make_message<MExportDir>();
     break;
   case MSG_MDS_EXPORTDIRACK:
-    m = MExportDirAck::create();
+    m = make_message<MExportDirAck>();
     break;
   case MSG_MDS_EXPORTDIRFINISH:
-    m = MExportDirFinish::create();
+    m = make_message<MExportDirFinish>();
     break;
 
   case MSG_MDS_EXPORTDIRNOTIFY:
-    m = MExportDirNotify::create();
+    m = make_message<MExportDirNotify>();
     break;
 
   case MSG_MDS_EXPORTDIRNOTIFYACK:
-    m = MExportDirNotifyAck::create();
+    m = make_message<MExportDirNotifyAck>();
     break;
 
   case MSG_MDS_EXPORTDIRPREP:
-    m = MExportDirPrep::create();
+    m = make_message<MExportDirPrep>();
     break;
 
   case MSG_MDS_EXPORTDIRPREPACK:
-    m = MExportDirPrepAck::create();
+    m = make_message<MExportDirPrepAck>();
     break;
 
   case MSG_MDS_EXPORTCAPS:
-    m = MExportCaps::create();
+    m = make_message<MExportCaps>();
     break;
   case MSG_MDS_EXPORTCAPSACK:
-    m = MExportCapsAck::create();
+    m = make_message<MExportCapsAck>();
     break;
   case MSG_MDS_GATHERCAPS:
-    m = MGatherCaps::create();
+    m = make_message<MGatherCaps>();
     break;
 
 
   case MSG_MDS_DENTRYUNLINK:
-    m = MDentryUnlink::create();
+    m = make_message<MDentryUnlink>();
     break;
   case MSG_MDS_DENTRYLINK:
-    m = MDentryLink::create();
+    m = make_message<MDentryLink>();
     break;
 
   case MSG_MDS_HEARTBEAT:
-    m = MHeartbeat::create();
+    m = make_message<MHeartbeat>();
     break;
 
   case MSG_MDS_CACHEEXPIRE:
-    m = MCacheExpire::create();
+    m = make_message<MCacheExpire>();
     break;
 
   case MSG_MDS_TABLE_REQUEST:
-    m = MMDSTableRequest::create();
+    m = make_message<MMDSTableRequest>();
     break;
 
        /*  case MSG_MDS_INODEUPDATE:
-    m = MInodeUpdate::create();
+    m = make_message<MInodeUpdate>();
     break;
        */
 
   case MSG_MDS_INODEFILECAPS:
-    m = MInodeFileCaps::create();
+    m = make_message<MInodeFileCaps>();
     break;
 
   case MSG_MDS_LOCK:
-    m = MLock::create();
+    m = make_message<MLock>();
     break;
 
   case MSG_MGR_BEACON:
-    m = MMgrBeacon::create();
+    m = make_message<MMgrBeacon>();
     break;
 
   case MSG_MON_MGR_REPORT:
-    m = MMonMgrReport::create();
+    m = make_message<MMonMgrReport>();
     break;
 
   case MSG_SERVICE_MAP:
-    m = MServiceMap::create();
+    m = make_message<MServiceMap>();
     break;
 
   case MSG_MGR_MAP:
-    m = MMgrMap::create();
+    m = make_message<MMgrMap>();
     break;
 
   case MSG_MGR_DIGEST:
-    m = MMgrDigest::create();
+    m = make_message<MMgrDigest>();
     break;
 
   case MSG_MGR_OPEN:
-    m = MMgrOpen::create();
+    m = make_message<MMgrOpen>();
     break;
 
   case MSG_MGR_CLOSE:
-    m = MMgrClose::create();
+    m = make_message<MMgrClose>();
     break;
 
   case MSG_MGR_REPORT:
-    m = MMgrReport::create();
+    m = make_message<MMgrReport>();
     break;
 
   case MSG_MGR_CONFIGURE:
-    m = MMgrConfigure::create();
+    m = make_message<MMgrConfigure>();
     break;
 
   case MSG_TIMECHECK:
-    m = MTimeCheck::create();
+    m = make_message<MTimeCheck>();
     break;
   case MSG_TIMECHECK2:
-    m = MTimeCheck2::create();
+    m = make_message<MTimeCheck2>();
     break;
 
   case MSG_MON_HEALTH:
-    m = MMonHealth::create();
+    m = make_message<MMonHealth>();
     break;
 
   case MSG_MON_HEALTH_CHECKS:
-    m = MMonHealthChecks::create();
+    m = make_message<MMonHealthChecks>();
     break;
 
     // -- simple messages without payload --
 
   case CEPH_MSG_SHUTDOWN:
-    m = MGenericMessage::create(type);
+    m = make_message<MGenericMessage>(type);
     break;
 
   default:
index 0baac6ef62a1392b9e77563be37f4f1c14e4e953..8686d1871b138256b85e9eeb18a4dedd722f496c 100644 (file)
@@ -574,9 +574,9 @@ template<class T, class U>
 boost::intrusive_ptr<const T> ref_cast(const boost::intrusive_ptr<const U>& r) noexcept {
   return static_cast<const T*>(r.get());
 }
-template<class T, class U>
-boost::intrusive_ptr<const T> ref_cast(const boost::intrusive_ptr<const U>&& r) noexcept {
-  return {static_cast<const T*>(r.detach()), false};
+template<class T, typename... Args>
+boost::intrusive_ptr<T> make_message(Args&&... args) {
+  return {new T(std::forward<Args>(args)...), false};
 }
 }
 
index cc7e4708f2ef631d351ac345f4939e5fb91745ce..2a17eef1b7a2fa7c70a3425aa737f0ab110959bb 100644 (file)
@@ -218,7 +218,7 @@ class MessageDencoderImpl : public Dencoder {
   list<ref_t<T>> m_list;
 
 public:
-  MessageDencoderImpl() : m_object(T::create()) {}
+  MessageDencoderImpl() : m_object{make_message<T>()} {}
   ~MessageDencoderImpl() override {}
 
   string decode(bufferlist bl, uint64_t seek) override {