]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
bluestore/NVMEDevice: do not deference a dangled pointer
authorKefu Chai <kchai@redhat.com>
Tue, 21 Nov 2017 07:09:22 +0000 (15:09 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 21 Nov 2017 07:18:53 +0000 (15:18 +0800)
commit98f76f8e7ef6d83690696082df44ad0e1e2cfbbc
treef0b0fe7c28faea74d698825ac54f14278302d6db
parent67ad6a2a3998d010a7b083ad561eed57ec785176
bluestore/NVMEDevice: do not deference a dangled pointer

* pass coremask_arg to the working thread by value.
  after 81249ab9d, get_val<>() returns a temporary variables instead of a
  reference to the variant held by config. so calling string::c_str(), and
  passing the returned `const char*` to a thread is not advisable. instead
  we should pass a string by value. since spdk_env_init() will copy the
  settings passed in by opt. it's safe even to destruct the coremask_arg
  afterward.
* use ffsll() to find the LSB. it's not a bottleneck, but it's easier
  and simpler, and probably improves the readability.
* refactor the NVMEManager::try_get() method: to define the variables
  when they are used for the first time.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/os/bluestore/NVMEDevice.cc