-static int can_merge_iovs(lnet_md_iovec_t *existing, lnet_md_iovec_t *candidate)
-{
- if (existing->iov_base + existing->iov_len == candidate->iov_base)
- return 1;
-#if 0
- /* Enable this section to provide earlier evidence of fragmented bulk */
- CERROR("Can't merge iovs %p for %x, %p for %x\n",
- existing->iov_base, existing->iov_len,
- candidate->iov_base, candidate->iov_len);
-#endif
- return 0;
-}
-
-void ptlrpc_add_bulk_page(struct ptlrpc_bulk_desc *desc, cfs_page_t *page,
- int pageoffset, int len)
-{
- lnet_md_iovec_t *iov = &desc->bd_iov[desc->bd_iov_count];
-
- iov->iov_base = page->addr + pageoffset;
- iov->iov_len = len;
-
- if (desc->bd_iov_count > 0 && can_merge_iovs(iov - 1, iov)) {
- (iov - 1)->iov_len += len;
- } else {
- desc->bd_iov_count++;
- }
-}