]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async/rdma: operate event fd with event_{read,write}
authorChangcheng Liu <changcheng.liu@aliyun.com>
Mon, 10 Jun 2019 04:56:15 +0000 (12:56 +0800)
committerChangcheng Liu <changcheng.liu@aliyun.com>
Fri, 23 Aug 2019 02:45:05 +0000 (10:45 +0800)
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 <changcheng.liu@aliyun.com>
src/msg/async/rdma/RDMAConnectedSocketImpl.cc

index ec10aa8204420aa3588019a2c7340fd315fb2239..6c8550d6ab0877e474f68017ce71157022d71914 100644 (file)
@@ -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()