mirror of
https://github.com/ceph/ceph
synced 2025-03-30 23:40:09 +00:00
msg: using switch-case in place of if-else.
For point of performance, swith-case is better than if-else for blackhole check. Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
This commit is contained in:
parent
485ddccc35
commit
0471a2d6c9
@ -7,8 +7,17 @@
|
|||||||
|
|
||||||
bool Connection::is_blackhole() const {
|
bool Connection::is_blackhole() const {
|
||||||
auto& conf = msgr->cct->_conf;
|
auto& conf = msgr->cct->_conf;
|
||||||
return ((conf->ms_blackhole_mon && peer_type == CEPH_ENTITY_TYPE_MON) ||
|
|
||||||
(conf->ms_blackhole_osd && peer_type == CEPH_ENTITY_TYPE_OSD) ||
|
switch (peer_type) {
|
||||||
(conf->ms_blackhole_mds && peer_type == CEPH_ENTITY_TYPE_MDS) ||
|
case CEPH_ENTITY_TYPE_MON:
|
||||||
(conf->ms_blackhole_client && peer_type == CEPH_ENTITY_TYPE_CLIENT));
|
return conf->ms_blackhole_mon;
|
||||||
|
case CEPH_ENTITY_TYPE_OSD:
|
||||||
|
return conf->ms_blackhole_osd;
|
||||||
|
case CEPH_ENTITY_TYPE_MDS:
|
||||||
|
return conf->ms_blackhole_mds;
|
||||||
|
case CEPH_ENTITY_TYPE_CLIENT:
|
||||||
|
return conf->ms_blackhole_client;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user