Whamcloud - gitweb
LU-5835 ptlrpc: Introduce iovec to bulk descriptor
[fs/lustre-release.git] / lustre / ptlrpc / sec_plain.c
index 9eaa852..94b924a 100644 (file)
@@ -159,14 +159,16 @@ static void corrupt_bulk_data(struct ptlrpc_bulk_desc *desc)
        char           *ptr;
        unsigned int    off, i;
 
+       LASSERT(ptlrpc_is_bulk_desc_kiov(desc->bd_type));
+
        for (i = 0; i < desc->bd_iov_count; i++) {
-               if (desc->bd_iov[i].kiov_len == 0)
+               if (BD_GET_KIOV(desc, i).kiov_len == 0)
                        continue;
 
-               ptr = kmap(desc->bd_iov[i].kiov_page);
-               off = desc->bd_iov[i].kiov_offset & ~PAGE_MASK;
+               ptr = kmap(BD_GET_KIOV(desc, i).kiov_page);
+               off = BD_GET_KIOV(desc, i).kiov_offset & ~PAGE_MASK;
                ptr[off] ^= 0x1;
-               kunmap(desc->bd_iov[i].kiov_page);
+               kunmap(BD_GET_KIOV(desc, i).kiov_page);
                return;
        }
 }
@@ -341,6 +343,7 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx,
         int                          rc;
         int                          i, nob;
 
+       LASSERT(ptlrpc_is_bulk_desc_kiov(desc->bd_type));
         LASSERT(req->rq_pack_bulk);
         LASSERT(req->rq_reqbuf->lm_bufcount == PLAIN_PACK_SEGMENTS);
         LASSERT(req->rq_repdata->lm_bufcount == PLAIN_PACK_SEGMENTS);
@@ -354,14 +357,15 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx,
                 return 0;
         }
 
-        /* fix the actual data size */
-        for (i = 0, nob = 0; i < desc->bd_iov_count; i++) {
-                if (desc->bd_iov[i].kiov_len + nob > desc->bd_nob_transferred) {
-                        desc->bd_iov[i].kiov_len =
-                                desc->bd_nob_transferred - nob;
-                }
-                nob += desc->bd_iov[i].kiov_len;
-        }
+       /* fix the actual data size */
+       for (i = 0, nob = 0; i < desc->bd_iov_count; i++) {
+               if (BD_GET_KIOV(desc, i).kiov_len +
+                   nob > desc->bd_nob_transferred) {
+                       BD_GET_KIOV(desc, i).kiov_len =
+                               desc->bd_nob_transferred - nob;
+               }
+               nob += BD_GET_KIOV(desc, i).kiov_len;
+       }
 
         rc = plain_verify_bulk_csum(desc, req->rq_flvr.u_bulk.hash.hash_alg,
                                     tokenv);