From 38cf7c13cae96f22116d306719507db740d2748c Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sun, 14 Apr 2019 12:34:24 +0800 Subject: [PATCH] client,mds: use ref_cast instead of Foo::msgref_cast Signed-off-by: Kefu Chai --- src/client/Client.cc | 26 +++++++++---------- src/mds/Beacon.cc | 2 +- src/mds/Locker.cc | 10 ++++---- src/mds/MDBalancer.cc | 2 +- src/mds/MDCache.cc | 32 ++++++++++++------------ src/mds/MDSDaemon.cc | 4 +-- src/mds/MDSRank.cc | 2 +- src/mds/Migrator.cc | 26 +++++++++---------- src/mds/Server.cc | 12 ++++----- src/tools/ceph-dencoder/ceph_dencoder.cc | 2 +- 10 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 4499cb19487..fad1a9a11e0 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -2573,53 +2573,53 @@ bool Client::ms_dispatch2(const MessageRef &m) switch (m->get_type()) { // mounting and mds sessions case CEPH_MSG_MDS_MAP: - handle_mds_map(MMDSMap::msgref_cast(m)); + handle_mds_map(ref_cast(m)); break; case CEPH_MSG_FS_MAP: - handle_fs_map(MFSMap::msgref_cast(m)); + handle_fs_map(ref_cast(m)); break; case CEPH_MSG_FS_MAP_USER: - handle_fs_map_user(MFSMapUser::msgref_cast(m)); + handle_fs_map_user(ref_cast(m)); break; case CEPH_MSG_CLIENT_SESSION: - handle_client_session(MClientSession::msgref_cast(m)); + handle_client_session(ref_cast(m)); break; case CEPH_MSG_OSD_MAP: - handle_osd_map(MOSDMap::msgref_cast(m)); + handle_osd_map(ref_cast(m)); break; // requests case CEPH_MSG_CLIENT_REQUEST_FORWARD: - handle_client_request_forward(MClientRequestForward::msgref_cast(m)); + handle_client_request_forward(ref_cast(m)); break; case CEPH_MSG_CLIENT_REPLY: - handle_client_reply(MClientReply::msgref_cast(m)); + handle_client_reply(ref_cast(m)); break; // reclaim reply case CEPH_MSG_CLIENT_RECLAIM_REPLY: - handle_client_reclaim_reply(MClientReclaimReply::msgref_cast(m)); + handle_client_reclaim_reply(ref_cast(m)); break; case CEPH_MSG_CLIENT_SNAP: - handle_snap(MClientSnap::msgref_cast(m)); + handle_snap(ref_cast(m)); break; case CEPH_MSG_CLIENT_CAPS: - handle_caps(MClientCaps::msgref_cast(m)); + handle_caps(ref_cast(m)); break; case CEPH_MSG_CLIENT_LEASE: - handle_lease(MClientLease::msgref_cast(m)); + handle_lease(ref_cast(m)); break; case MSG_COMMAND_REPLY: if (m->get_source().type() == CEPH_ENTITY_TYPE_MDS) { - handle_command_reply(MCommandReply::msgref_cast(m)); + handle_command_reply(ref_cast(m)); } else { return false; } break; case CEPH_MSG_CLIENT_QUOTA: - handle_quota(MClientQuota::msgref_cast(m)); + handle_quota(ref_cast(m)); break; default: diff --git a/src/mds/Beacon.cc b/src/mds/Beacon.cc index e08bf3ee4d0..de1284ba5dc 100644 --- a/src/mds/Beacon.cc +++ b/src/mds/Beacon.cc @@ -102,7 +102,7 @@ bool Beacon::ms_dispatch2(const ref_t& m) { if (m->get_type() == MSG_MDS_BEACON) { if (m->get_connection()->get_peer_type() == CEPH_ENTITY_TYPE_MON) { - handle_mds_beacon(MMDSBeacon::msgref_cast(m)); + handle_mds_beacon(ref_cast(m)); } return true; } diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 00a8e317165..014d8d7f4ae 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -95,21 +95,21 @@ void Locker::dispatch(const cref_t &m) switch (m->get_type()) { // inter-mds locking case MSG_MDS_LOCK: - handle_lock(MLock::msgref_cast(m)); + handle_lock(ref_cast(m)); break; // inter-mds caps case MSG_MDS_INODEFILECAPS: - handle_inode_file_caps(MInodeFileCaps::msgref_cast(m)); + handle_inode_file_caps(ref_cast(m)); break; // client sync case CEPH_MSG_CLIENT_CAPS: - handle_client_caps(MClientCaps::msgref_cast(m)); + handle_client_caps(ref_cast(m)); break; case CEPH_MSG_CLIENT_CAPRELEASE: - handle_client_cap_release(MClientCapRelease::msgref_cast(m)); + handle_client_cap_release(ref_cast(m)); break; case CEPH_MSG_CLIENT_LEASE: - handle_client_lease(MClientLease::msgref_cast(m)); + handle_client_lease(ref_cast(m)); break; default: derr << "locker unknown message " << m->get_type() << dendl; diff --git a/src/mds/MDBalancer.cc b/src/mds/MDBalancer.cc index ec4a03f2c9e..ee809fbcbf8 100644 --- a/src/mds/MDBalancer.cc +++ b/src/mds/MDBalancer.cc @@ -64,7 +64,7 @@ int MDBalancer::proc_message(const cref_t &m) switch (m->get_type()) { case MSG_MDS_HEARTBEAT: - handle_heartbeat(MHeartbeat::msgref_cast(m)); + handle_heartbeat(ref_cast(m)); break; default: diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 464e25d67b9..4d5398ac7fc 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -7883,62 +7883,62 @@ void MDCache::dispatch(const cref_t &m) // RESOLVE case MSG_MDS_RESOLVE: - handle_resolve(MMDSResolve::msgref_cast(m)); + handle_resolve(ref_cast(m)); break; case MSG_MDS_RESOLVEACK: - handle_resolve_ack(MMDSResolveAck::msgref_cast(m)); + handle_resolve_ack(ref_cast(m)); break; // REJOIN case MSG_MDS_CACHEREJOIN: - handle_cache_rejoin(MMDSCacheRejoin::msgref_cast(m)); + handle_cache_rejoin(ref_cast(m)); break; case MSG_MDS_DISCOVER: - handle_discover(MDiscover::msgref_cast(m)); + handle_discover(ref_cast(m)); break; case MSG_MDS_DISCOVERREPLY: - handle_discover_reply(MDiscoverReply::msgref_cast(m)); + handle_discover_reply(ref_cast(m)); break; case MSG_MDS_DIRUPDATE: - handle_dir_update(MDirUpdate::msgref_cast(m)); + handle_dir_update(ref_cast(m)); break; case MSG_MDS_CACHEEXPIRE: - handle_cache_expire(MCacheExpire::msgref_cast(m)); + handle_cache_expire(ref_cast(m)); break; case MSG_MDS_DENTRYLINK: - handle_dentry_link(MDentryLink::msgref_cast(m)); + handle_dentry_link(ref_cast(m)); break; case MSG_MDS_DENTRYUNLINK: - handle_dentry_unlink(MDentryUnlink::msgref_cast(m)); + handle_dentry_unlink(ref_cast(m)); break; case MSG_MDS_FRAGMENTNOTIFY: - handle_fragment_notify(MMDSFragmentNotify::msgref_cast(m)); + handle_fragment_notify(ref_cast(m)); break; case MSG_MDS_FRAGMENTNOTIFYACK: - handle_fragment_notify_ack(MMDSFragmentNotifyAck::msgref_cast(m)); + handle_fragment_notify_ack(ref_cast(m)); break; case MSG_MDS_FINDINO: - handle_find_ino(MMDSFindIno::msgref_cast(m)); + handle_find_ino(ref_cast(m)); break; case MSG_MDS_FINDINOREPLY: - handle_find_ino_reply(MMDSFindInoReply::msgref_cast(m)); + handle_find_ino_reply(ref_cast(m)); break; case MSG_MDS_OPENINO: - handle_open_ino(MMDSOpenIno::msgref_cast(m)); + handle_open_ino(ref_cast(m)); break; case MSG_MDS_OPENINOREPLY: - handle_open_ino_reply(MMDSOpenInoReply::msgref_cast(m)); + handle_open_ino_reply(ref_cast(m)); break; case MSG_MDS_SNAPUPDATE: - handle_snap_update(MMDSSnapUpdate::msgref_cast(m)); + handle_snap_update(ref_cast(m)); break; default: diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index 4f313160096..db0b7f543ae 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -1190,12 +1190,12 @@ bool MDSDaemon::handle_core_message(const cref_t &m) // MDS case CEPH_MSG_MDS_MAP: ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_MON | CEPH_ENTITY_TYPE_MDS); - handle_mds_map(MMDSMap::msgref_cast(m)); + handle_mds_map(ref_cast(m)); break; // OSD case MSG_COMMAND: - handle_command(MCommand::msgref_cast(m)); + handle_command(ref_cast(m)); break; case CEPH_MSG_OSD_MAP: ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_MON | CEPH_ENTITY_TYPE_OSD); diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 78d7a40a900..1791048e8a0 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -1193,7 +1193,7 @@ bool MDSRank::handle_deferrable_message(const cref_t &m) case MSG_MDS_TABLE_REQUEST: ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_MDS); { - const cref_t &req = MMDSTableRequest::msgref_cast(m); + const cref_t &req = ref_cast(m); if (req->op < 0) { MDSTableClient *client = get_table_client(req->table); client->handle_request(req); diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index b35500aabda..b1868b53f15 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -96,54 +96,54 @@ void Migrator::dispatch(const cref_t &m) switch (m->get_type()) { // import case MSG_MDS_EXPORTDIRDISCOVER: - handle_export_discover(MExportDirDiscover::msgref_cast(m)); + handle_export_discover(ref_cast(m)); break; case MSG_MDS_EXPORTDIRPREP: - handle_export_prep(MExportDirPrep::msgref_cast(m)); + handle_export_prep(ref_cast(m)); break; case MSG_MDS_EXPORTDIR: if (unlikely(inject_session_race)) { dout(0) << "waiting for inject_session_race" << dendl; mds->wait_for_any_client_connection(new C_MDS_RetryMessage(mds, m)); } else { - handle_export_dir(MExportDir::msgref_cast(m)); + handle_export_dir(ref_cast(m)); } break; case MSG_MDS_EXPORTDIRFINISH: - handle_export_finish(MExportDirFinish::msgref_cast(m)); + handle_export_finish(ref_cast(m)); break; case MSG_MDS_EXPORTDIRCANCEL: - handle_export_cancel(MExportDirCancel::msgref_cast(m)); + handle_export_cancel(ref_cast(m)); break; // export case MSG_MDS_EXPORTDIRDISCOVERACK: - handle_export_discover_ack(MExportDirDiscoverAck::msgref_cast(m)); + handle_export_discover_ack(ref_cast(m)); break; case MSG_MDS_EXPORTDIRPREPACK: - handle_export_prep_ack(MExportDirPrepAck::msgref_cast(m)); + handle_export_prep_ack(ref_cast(m)); break; case MSG_MDS_EXPORTDIRACK: - handle_export_ack(MExportDirAck::msgref_cast(m)); + handle_export_ack(ref_cast(m)); break; case MSG_MDS_EXPORTDIRNOTIFYACK: - handle_export_notify_ack(MExportDirNotifyAck::msgref_cast(m)); + handle_export_notify_ack(ref_cast(m)); break; // export 3rd party (dir_auth adjustments) case MSG_MDS_EXPORTDIRNOTIFY: - handle_export_notify(MExportDirNotify::msgref_cast(m)); + handle_export_notify(ref_cast(m)); break; // caps case MSG_MDS_EXPORTCAPS: - handle_export_caps(MExportCaps::msgref_cast(m)); + handle_export_caps(ref_cast(m)); break; case MSG_MDS_EXPORTCAPSACK: - handle_export_caps_ack(MExportCapsAck::msgref_cast(m)); + handle_export_caps_ack(ref_cast(m)); break; case MSG_MDS_GATHERCAPS: - handle_gather_caps(MGatherCaps::msgref_cast(m)); + handle_gather_caps(ref_cast(m)); break; default: diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 56b87b26ac1..112a48bf898 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -201,14 +201,14 @@ void Server::dispatch(const cref_t &m) { switch (m->get_type()) { case CEPH_MSG_CLIENT_RECONNECT: - handle_client_reconnect(MClientReconnect::msgref_cast(m)); + handle_client_reconnect(ref_cast(m)); return; } // active? // handle_slave_request()/handle_client_session() will wait if necessary if (m->get_type() == CEPH_MSG_CLIENT_REQUEST && !mds->is_active()) { - const auto &req = MClientRequest::msgref_cast(m); + const auto &req = ref_cast(m); if (mds->is_reconnect() || mds->get_want_state() == CEPH_MDS_STATE_RECONNECT) { Session *session = mds->get_session(req); if (!session || session->is_closed()) { @@ -259,16 +259,16 @@ void Server::dispatch(const cref_t &m) switch (m->get_type()) { case CEPH_MSG_CLIENT_SESSION: - handle_client_session(MClientSession::msgref_cast(m)); + handle_client_session(ref_cast(m)); return; case CEPH_MSG_CLIENT_REQUEST: - handle_client_request(MClientRequest::msgref_cast(m)); + handle_client_request(ref_cast(m)); return; case CEPH_MSG_CLIENT_RECLAIM: - handle_client_reclaim(MClientReclaim::msgref_cast(m)); + handle_client_reclaim(ref_cast(m)); return; case MSG_MDS_SLAVE_REQUEST: - handle_slave_request(MMDSSlaveRequest::msgref_cast(m)); + handle_slave_request(ref_cast(m)); return; default: derr << "server unknown message " << m->get_type() << dendl; diff --git a/src/tools/ceph-dencoder/ceph_dencoder.cc b/src/tools/ceph-dencoder/ceph_dencoder.cc index 18f9262b96e..cc7e4708f2e 100644 --- a/src/tools/ceph-dencoder/ceph_dencoder.cc +++ b/src/tools/ceph-dencoder/ceph_dencoder.cc @@ -233,7 +233,7 @@ public: ss << "decoded type " << n->get_type() << " instead of expected " << m_object->get_type(); throw std::runtime_error(ss.str()); } - m_object = boost::static_pointer_cast::type::element_type>(n); + m_object = ref_cast(n); } catch (buffer::error& e) { return e.what(); -- 2.39.5