Whamcloud - gitweb
LU-8648 all: remove all Sun license and URL references
[fs/lustre-release.git] / lnet / selftest / rpc.c
index 8d81792..dc26cab 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -88,14 +84,12 @@ void srpc_set_counters (const srpc_counters_t *cnt)
 }
 
 static int
-srpc_add_bulk_page(srpc_bulk_t *bk, struct page *pg, int i, int nob)
+srpc_add_bulk_page(srpc_bulk_t *bk, struct page *pg, int i, int off, int nob)
 {
-       nob = min(nob, (int)PAGE_CACHE_SIZE);
-
-       LASSERT(nob > 0);
-       LASSERT(i >= 0 && i < bk->bk_niov);
+       LASSERT(off < PAGE_SIZE);
+       LASSERT(nob > 0 && nob <= PAGE_SIZE);
 
-       bk->bk_iovs[i].kiov_offset = 0;
+       bk->bk_iovs[i].kiov_offset = off;
        bk->bk_iovs[i].kiov_page   = pg;
        bk->bk_iovs[i].kiov_len    = nob;
        return nob;
@@ -121,7 +115,8 @@ srpc_free_bulk (srpc_bulk_t *bk)
 }
 
 srpc_bulk_t *
-srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink)
+srpc_alloc_bulk(int cpt, unsigned bulk_off, unsigned bulk_npg,
+               unsigned bulk_len, int sink)
 {
        srpc_bulk_t  *bk;
        int           i;
@@ -144,15 +139,19 @@ 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);
                        return NULL;
                }
 
-               nob = srpc_add_bulk_page(bk, pg, i, bulk_len);
+               nob = min_t(unsigned, bulk_off + bulk_len, PAGE_SIZE) -
+                     bulk_off;
+
+               srpc_add_bulk_page(bk, pg, i, bulk_off, nob);
                bulk_len -= nob;
+               bulk_off = 0;
        }
 
        return bk;
@@ -385,7 +384,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 +424,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,7 +435,7 @@ 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;