1
0
mirror of https://github.com/ceph/ceph synced 2025-03-20 09:16:59 +00:00

Merge pull request from tchaikov/wip-async-dpdk-temp-str

msg/async: avoid referencing the temporary string

Reviewed-by: Haomai Wang <haomai@xsky.com>
This commit is contained in:
Kefu Chai 2018-03-01 19:19:01 +08:00 committed by GitHub
commit e1c23cde27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,7 +40,7 @@ namespace dpdk {
std::condition_variable eal::cond;
std::list<std::function<void()>> eal::funcs;
static int bitcount(unsigned n)
static int bitcount(unsigned long long n)
{
return std::bitset<CHAR_BIT * sizeof(n)>{n}.count();
}
@ -52,8 +52,8 @@ namespace dpdk {
}
bool done = false;
const char *hexstring = c->_conf->get_val<std::string>("ms_dpdk_coremask").c_str();
int num = (int)strtol(hexstring, NULL, 0);
auto num = std::stoull(c->_conf->get_val<std::string>("ms_dpdk_coremask"),
nullptr, 16);
unsigned int coremaskbit = bitcount(num);
ceph_assert(coremaskbit > c->_conf->ms_async_op_threads);