]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
osd/scrub_machine: pass an instance of event to post_event()
authorKefu Chai <kchai@redhat.com>
Sun, 3 Jan 2021 04:30:12 +0000 (12:30 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 3 Jan 2021 04:45:35 +0000 (12:45 +0800)
commit3c8e115e93c4b909eb1f72a33963f35557e5c087
tree9a7b6edf87ecc0cfa101c8fc27f0b1a0ed7dffe6
parentb106a03dcddaee80493825e85bc5e399ab4d8746
osd/scrub_machine: pass an instance of event to post_event()

instead of passing an intrusive_ptr<> to it, pass an instance of event
to post_event(). for couple reasons:

* post_event() is able to create an intrusive_ptr<> from the event
  passed to it using event.intrusive_from_this() which creates a clone
  of the original event. but since the overhead of creating scrub events
  is relative low. and presumably, it is not the bottleneck of the
  overall performance of Ceph, so it should be fine.
* simpler this way. so we don't need to repeat
  `boost::intrusive_ptr<EventName>(new EventName{})`
* more consistent this way. we use the same variant of `post_event()`
  elsewhere.
* for silencing the warning from GCC-11, like:
../src/osd/scrub_machine.cc:323:64: note: returned from ‘static void* boost::statechart::event<MostDerived, Allocator>::operator new(std::size_t) [with MostDerived = Scrub::GotReplicas; Allocator =
std::allocator<boost::statechart::none>]’
../src/osd/scrub_machine.cc: In constructor ‘Scrub::WaitReplicas::WaitReplicas(boost::statechart::state<Scrub::WaitReplicas, Scrub::ActiveScrubbing>::my_context)’:
../src/osd/scrub_machine.cc:346:64: warning: ‘static void boost::statechart::event<MostDerived, Allocator>::operator delete(void*) [with MostDerived = Scrub::GotReplicas; Allocator =
std::allocator<boost::statechart::none>]’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  346 |   post_event(boost::intrusive_ptr<GotReplicas>(new GotReplicas{}));
      |
  this warning is a false alarm. but it is distracting.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/osd/scrub_machine.cc