Whamcloud - gitweb
LU-6245 libcfs: remove types abstraction from libcfs/LNet code
[fs/lustre-release.git] / lnet / selftest / rpc.c
index 5685a60..eb9e9dc 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2014, Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -144,7 +144,7 @@ srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink)
                struct page *pg;
                int         nob;
 
-               pg = cfs_page_cpt_alloc(lnet_cpt_table(), cpt, GFP_IOFS);
+               pg = cfs_page_cpt_alloc(lnet_cpt_table(), cpt, GFP_KERNEL);
                if (pg == NULL) {
                        CERROR("Can't allocate page %d of %d\n", i, bulk_npg);
                        srpc_free_bulk(bk);
@@ -385,7 +385,7 @@ srpc_post_passive_rdma(int portal, int local, __u64 matchbits, void *buf,
         }
 
         CDEBUG (D_NET,
-                "Posted passive RDMA: peer %s, portal %d, matchbits "LPX64"\n",
+               "Posted passive RDMA: peer %s, portal %d, matchbits %#llx\n",
                 libcfs_id2str(peer), portal, matchbits);
         return 0;
 }
@@ -425,7 +425,7 @@ srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len,
         }
 
         if (rc != 0) {
-                CERROR ("LNet%s(%s, %d, "LPD64") failed: %d\n",
+               CERROR ("LNet%s(%s, %d, %lld) failed: %d\n",
                         ((options & LNET_MD_OP_PUT) != 0) ? "Put" : "Get",
                         libcfs_id2str(peer), portal, matchbits, rc);
 
@@ -436,22 +436,13 @@ srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len,
                 LASSERT (rc == 0);
         } else {
                 CDEBUG (D_NET,
-                        "Posted active RDMA: peer %s, portal %u, matchbits "LPX64"\n",
+                       "Posted active RDMA: peer %s, portal %u, matchbits %#llx\n",
                         libcfs_id2str(peer), portal, matchbits);
         }
         return 0;
 }
 
 static int
-srpc_post_active_rqtbuf(lnet_process_id_t peer, int service, void *buf,
-                       int len, lnet_handle_md_t *mdh, srpc_event_t *ev)
-{
-       return srpc_post_active_rdma(srpc_serv_portal(service), service,
-                                    buf, len, LNET_MD_OP_PUT, peer,
-                                    LNET_NID_ANY, mdh, ev);
-}
-
-static int
 srpc_post_passive_rqtbuf(int service, int local, void *buf, int len,
                         lnet_handle_md_t *mdh, srpc_event_t *ev)
 {
@@ -798,9 +789,11 @@ srpc_send_request (srpc_client_rpc_t *rpc)
         ev->ev_data  = rpc;
         ev->ev_type  = SRPC_REQUEST_SENT;
 
-        rc = srpc_post_active_rqtbuf(rpc->crpc_dest, rpc->crpc_service,
-                                     &rpc->crpc_reqstmsg, sizeof(srpc_msg_t),
-                                     &rpc->crpc_reqstmdh, ev);
+       rc = srpc_post_active_rdma(srpc_serv_portal(rpc->crpc_service),
+                                  rpc->crpc_service, &rpc->crpc_reqstmsg,
+                                  sizeof(srpc_msg_t), LNET_MD_OP_PUT,
+                                  rpc->crpc_dest, LNET_NID_ANY,
+                                  &rpc->crpc_reqstmdh, ev);
         if (rc != 0) {
                 LASSERT (rc == -ENOMEM);
                 ev->ev_fired = 1;  /* no more event expected */
@@ -1117,7 +1110,7 @@ srpc_del_client_rpc_timer (srpc_client_rpc_t *rpc)
        if (rpc->crpc_timeout == 0)
                return;
 
-       /* timer sucessfully defused */
+       /* timer successfully defused */
        if (stt_del_timer(&rpc->crpc_timer))
                return;
 
@@ -1593,9 +1586,10 @@ srpc_startup (void)
        memset(&srpc_data, 0, sizeof(struct smoketest_rpc));
        spin_lock_init(&srpc_data.rpc_glock);
 
-        /* 1 second pause to avoid timestamp reuse */
-        cfs_pause(cfs_time_seconds(1));
-        srpc_data.rpc_matchbits = ((__u64) cfs_time_current_sec()) << 48;
+       /* 1 second pause to avoid timestamp reuse */
+       set_current_state(TASK_UNINTERRUPTIBLE);
+       schedule_timeout(cfs_time_seconds(1));
+       srpc_data.rpc_matchbits = ((__u64) cfs_time_current_sec()) << 48;
 
         srpc_data.rpc_state = SRPC_STATE_NONE;