From 0e3db04d045d040382031261bf70973c853bc63e Mon Sep 17 00:00:00 2001 From: Changcheng Liu Date: Mon, 10 Jun 2019 12:56:15 +0800 Subject: [PATCH] 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 --- src/msg/async/rdma/RDMAConnectedSocketImpl.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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() -- 2.39.5