]> Pileus Git - ~andy/linux/blobdiff - drivers/staging/lustre/lustre/ptlrpc/niobuf.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml
[~andy/linux] / drivers / staging / lustre / lustre / ptlrpc / niobuf.c
index a0e009717a5ad825b9d9627977ad49deb864f7bd..3c6bf23415f9862b8cbd2f61241ac4da4f8fa36b 100644 (file)
  * over \a conn connection to portal \a portal.
  * Returns 0 on success or error code.
  */
-static int ptl_send_buf (lnet_handle_md_t *mdh, void *base, int len,
-                        lnet_ack_req_t ack, struct ptlrpc_cb_id *cbid,
-                        struct ptlrpc_connection *conn, int portal, __u64 xid,
-                        unsigned int offset)
+static int ptl_send_buf(lnet_handle_md_t *mdh, void *base, int len,
+                       lnet_ack_req_t ack, struct ptlrpc_cb_id *cbid,
+                       struct ptlrpc_connection *conn, int portal, __u64 xid,
+                       unsigned int offset)
 {
        int           rc;
        lnet_md_t        md;
 
-       LASSERT (portal != 0);
-       LASSERT (conn != NULL);
-       CDEBUG (D_INFO, "conn=%p id %s\n", conn, libcfs_id2str(conn->c_peer));
+       LASSERT(portal != 0);
+       LASSERT(conn != NULL);
+       CDEBUG(D_INFO, "conn=%p id %s\n", conn, libcfs_id2str(conn->c_peer));
        md.start     = base;
        md.length    = len;
        md.threshold = (ack == LNET_ACK_REQ) ? 2 : 1;
@@ -66,23 +66,24 @@ static int ptl_send_buf (lnet_handle_md_t *mdh, void *base, int len,
        md.eq_handle = ptlrpc_eq_h;
 
        if (unlikely(ack == LNET_ACK_REQ &&
-                    OBD_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_ACK, OBD_FAIL_ONCE))){
+                    OBD_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_ACK,
+                                         OBD_FAIL_ONCE))) {
                /* don't ask for the ack to simulate failing client */
                ack = LNET_NOACK_REQ;
        }
 
-       rc = LNetMDBind (md, LNET_UNLINK, mdh);
+       rc = LNetMDBind(md, LNET_UNLINK, mdh);
        if (unlikely(rc != 0)) {
-               CERROR ("LNetMDBind failed: %d\n", rc);
-               LASSERT (rc == -ENOMEM);
+               CERROR("LNetMDBind failed: %d\n", rc);
+               LASSERT(rc == -ENOMEM);
                return -ENOMEM;
        }
 
        CDEBUG(D_NET, "Sending %d bytes to portal %d, xid "LPD64", offset %u\n",
               len, portal, xid, offset);
 
-       rc = LNetPut (conn->c_self, *mdh, ack,
-                     conn->c_peer, portal, xid, offset, 0);
+       rc = LNetPut(conn->c_self, *mdh, ack,
+                    conn->c_peer, portal, xid, offset, 0);
        if (unlikely(rc != 0)) {
                int rc2;
                /* We're going to get an UNLINK event when I unlink below,
@@ -179,7 +180,7 @@ int ptlrpc_register_bulk(struct ptlrpc_request *req)
                                  LNET_UNLINK, LNET_INS_AFTER, &me_h);
                if (rc != 0) {
                        CERROR("%s: LNetMEAttach failed x"LPU64"/%d: rc = %d\n",
-                              desc->bd_export->exp_obd->obd_name, xid,
+                              desc->bd_import->imp_obd->obd_name, xid,
                               posted_md, rc);
                        break;
                }
@@ -189,7 +190,7 @@ int ptlrpc_register_bulk(struct ptlrpc_request *req)
                                  &desc->bd_mds[posted_md]);
                if (rc != 0) {
                        CERROR("%s: LNetMDAttach failed x"LPU64"/%d: rc = %d\n",
-                              desc->bd_export->exp_obd->obd_name, xid,
+                              desc->bd_import->imp_obd->obd_name, xid,
                               posted_md, rc);
                        rc2 = LNetMEUnlink(me_h);
                        LASSERT(rc2 == 0);
@@ -219,7 +220,7 @@ int ptlrpc_register_bulk(struct ptlrpc_request *req)
        /* Holler if peer manages to touch buffers before he knows the xid */
        if (desc->bd_md_count != total_md)
                CWARN("%s: Peer %s touched %d buffers while I registered\n",
-                     desc->bd_export->exp_obd->obd_name, libcfs_id2str(peer),
+                     desc->bd_import->imp_obd->obd_name, libcfs_id2str(peer),
                      total_md - desc->bd_md_count);
        spin_unlock(&desc->bd_lock);
 
@@ -363,14 +364,14 @@ int ptlrpc_send_reply(struct ptlrpc_request *req, int flags)
         * request, or a saved copy if this is a req saved in
         * target_queue_final_reply().
         */
-       LASSERT (req->rq_no_reply == 0);
-       LASSERT (req->rq_reqbuf != NULL);
-       LASSERT (rs != NULL);
-       LASSERT ((flags & PTLRPC_REPLY_MAYBE_DIFFICULT) || !rs->rs_difficult);
-       LASSERT (req->rq_repmsg != NULL);
-       LASSERT (req->rq_repmsg == rs->rs_msg);
-       LASSERT (rs->rs_cb_id.cbid_fn == reply_out_callback);
-       LASSERT (rs->rs_cb_id.cbid_arg == rs);
+       LASSERT(req->rq_no_reply == 0);
+       LASSERT(req->rq_reqbuf != NULL);
+       LASSERT(rs != NULL);
+       LASSERT((flags & PTLRPC_REPLY_MAYBE_DIFFICULT) || !rs->rs_difficult);
+       LASSERT(req->rq_repmsg != NULL);
+       LASSERT(req->rq_repmsg == rs->rs_msg);
+       LASSERT(rs->rs_cb_id.cbid_fn == reply_out_callback);
+       LASSERT(rs->rs_cb_id.cbid_arg == rs);
 
        /* There may be no rq_export during failover */
 
@@ -423,12 +424,12 @@ int ptlrpc_send_reply(struct ptlrpc_request *req, int flags)
 
        req->rq_sent = cfs_time_current_sec();
 
-       rc = ptl_send_buf (&rs->rs_md_h, rs->rs_repbuf, rs->rs_repdata_len,
-                          (rs->rs_difficult && !rs->rs_no_ack) ?
-                          LNET_ACK_REQ : LNET_NOACK_REQ,
-                          &rs->rs_cb_id, conn,
-                          ptlrpc_req2svc(req)->srv_rep_portal,
-                          req->rq_xid, req->rq_reply_off);
+       rc = ptl_send_buf(&rs->rs_md_h, rs->rs_repbuf, rs->rs_repdata_len,
+                         (rs->rs_difficult && !rs->rs_no_ack) ?
+                         LNET_ACK_REQ : LNET_NOACK_REQ,
+                         &rs->rs_cb_id, conn,
+                         ptlrpc_req2svc(req)->srv_rep_portal,
+                         req->rq_xid, req->rq_reply_off);
 out:
        if (unlikely(rc != 0))
                ptlrpc_req_drop_rs(req);
@@ -437,7 +438,7 @@ out:
 }
 EXPORT_SYMBOL(ptlrpc_send_reply);
 
-int ptlrpc_reply (struct ptlrpc_request *req)
+int ptlrpc_reply(struct ptlrpc_request *req)
 {
        if (req->rq_no_reply)
                return 0;
@@ -537,13 +538,13 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
 
        /* bulk register should be done after wrap_request() */
        if (request->rq_bulk != NULL) {
-               rc = ptlrpc_register_bulk (request);
+               rc = ptlrpc_register_bulk(request);
                if (rc != 0)
                        GOTO(out, rc);
        }
 
        if (!noreply) {
-               LASSERT (request->rq_replen != 0);
+               LASSERT(request->rq_replen != 0);
                if (request->rq_repbuf == NULL) {
                        LASSERT(request->rq_repdata == NULL);
                        LASSERT(request->rq_repmsg == NULL);
@@ -566,7 +567,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
                                  LNET_UNLINK, LNET_INS_AFTER, &reply_me_h);
                if (rc != 0) {
                        CERROR("LNetMEAttach failed: %d\n", rc);
-                       LASSERT (rc == -ENOMEM);
+                       LASSERT(rc == -ENOMEM);
                        GOTO(cleanup_bulk, rc = -ENOMEM);
                }
        }
@@ -604,7 +605,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
                                  &request->rq_reply_md_h);
                if (rc != 0) {
                        CERROR("LNetMDAttach failed: %d\n", rc);
-                       LASSERT (rc == -ENOMEM);
+                       LASSERT(rc == -ENOMEM);
                        spin_lock(&request->rq_lock);
                        /* ...but the MD attach didn't succeed... */
                        request->rq_receiving_reply = 0;
@@ -655,7 +656,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
         * nobody apart from the PUT's target has the right nid+XID to
         * access the reply buffer. */
        rc2 = LNetMEUnlink(reply_me_h);
-       LASSERT (rc2 == 0);
+       LASSERT(rc2 == 0);
        /* UNLINKED callback called synchronously */
        LASSERT(!request->rq_receiving_reply);
 
@@ -714,10 +715,10 @@ int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd)
        if (rc == 0)
                return (0);
 
-       CERROR("LNetMDAttach failed: %d; \n", rc);
-       LASSERT (rc == -ENOMEM);
-       rc = LNetMEUnlink (me_h);
-       LASSERT (rc == 0);
+       CERROR("LNetMDAttach failed: %d;\n", rc);
+       LASSERT(rc == -ENOMEM);
+       rc = LNetMEUnlink(me_h);
+       LASSERT(rc == 0);
        rqbd->rqbd_refcount = 0;
 
        return (-ENOMEM);