From: Changcheng Liu Date: Mon, 10 Jun 2019 04:56:15 +0000 (+0800) Subject: msg/async/rdma: operate event fd with event_{read,write} X-Git-Tag: v15.1.0~1781^2~28 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0e3db04d045d040382031261bf70973c853bc63e;p=ceph-ci.git msg/async/rdma: operate event fd with event_{read,write} 1. use wrapper function event_read & event_write to access event file descriptor. 2. change event fd access value name to be event_val. Signed-off-by: Changcheng Liu --- diff --git a/src/msg/async/rdma/RDMAConnectedSocketImpl.cc b/src/msg/async/rdma/RDMAConnectedSocketImpl.cc index ec10aa82044..6c8550d6ab0 100644 --- a/src/msg/async/rdma/RDMAConnectedSocketImpl.cc +++ b/src/msg/async/rdma/RDMAConnectedSocketImpl.cc @@ -257,9 +257,9 @@ void RDMAConnectedSocketImpl::handle_connection() { ssize_t RDMAConnectedSocketImpl::read(char* buf, size_t len) { - uint64_t i = 0; - int r = ::read(notify_fd, &i, sizeof(i)); - ldout(cct, 20) << __func__ << " notify_fd : " << i << " in " << my_msg.qpn << " r = " << r << dendl; + eventfd_t event_val = 0; + int r = eventfd_read(notify_fd, &event_val); + ldout(cct, 20) << __func__ << " notify_fd : " << event_val << " in " << my_msg.qpn << " r = " << r << dendl; if (!active) { ldout(cct, 1) << __func__ << " when ib not active. len: " << len << dendl; @@ -618,11 +618,9 @@ void RDMAConnectedSocketImpl::cleanup() { void RDMAConnectedSocketImpl::notify() { - // note: notify_fd is an event fd (man eventfd) - // write argument must be a 64bit integer - uint64_t i = 1; - - ceph_assert(sizeof(i) == write(notify_fd, &i, sizeof(i))); + eventfd_t event_val = 1; + int r = eventfd_write(notify_fd, event_val); + ceph_assert(r == 0); } void RDMAConnectedSocketImpl::shutdown()