| 
18 | 18 |  * Copyright (c) 2015      Cisco Systems, Inc.  All rights reserved.  | 
19 | 19 |  * Copyright (c) 2016      Research Organization for Information Science  | 
20 | 20 |  *                         and Technology (RIST). All rights reserved.  | 
 | 21 | + * Copyright (c) 2018      FUJITSU LIMITED.  All rights reserved.  | 
21 | 22 |  * $COPYRIGHT$  | 
22 | 23 |  *  | 
23 | 24 |  * Additional copyrights may follow  | 
@@ -417,29 +418,31 @@ int mca_pml_ob1_send_request_start_buffered(  | 
417 | 418 |     des->des_cbfunc = mca_pml_ob1_rndv_completion;  | 
418 | 419 |     des->des_cbdata = sendreq;  | 
419 | 420 | 
 
  | 
420 |  | -    /* buffer the remainder of the message */  | 
421 |  | -    rc = mca_pml_base_bsend_request_alloc((ompi_request_t*)sendreq);  | 
422 |  | -    if( OPAL_UNLIKELY(OMPI_SUCCESS != rc) ) {  | 
423 |  | -        mca_bml_base_free(bml_btl, des);  | 
424 |  | -        return rc;  | 
425 |  | -    }  | 
 | 421 | +    /* buffer the remainder of the message if it is not buffered yet */  | 
 | 422 | +    if( OPAL_LIKELY(sendreq->req_send.req_addr == sendreq->req_send.req_base.req_addr) ) {  | 
 | 423 | +        rc = mca_pml_base_bsend_request_alloc((ompi_request_t*)sendreq);  | 
 | 424 | +        if( OPAL_UNLIKELY(OMPI_SUCCESS != rc) ) {  | 
 | 425 | +            mca_bml_base_free(bml_btl, des);  | 
 | 426 | +            return rc;  | 
 | 427 | +        }  | 
426 | 428 | 
 
  | 
427 |  | -    iov.iov_base = (IOVBASE_TYPE*)(((unsigned char*)sendreq->req_send.req_addr) + max_data);  | 
428 |  | -    iov.iov_len = max_data = sendreq->req_send.req_bytes_packed - max_data;  | 
 | 429 | +        iov.iov_base = (IOVBASE_TYPE*)(((unsigned char*)sendreq->req_send.req_addr) + max_data);  | 
 | 430 | +        iov.iov_len = max_data = sendreq->req_send.req_bytes_packed - max_data;  | 
429 | 431 | 
 
  | 
430 |  | -    if((rc = opal_convertor_pack( &sendreq->req_send.req_base.req_convertor,  | 
431 |  | -                                  &iov,  | 
432 |  | -                                  &iov_count,  | 
433 |  | -                                  &max_data)) < 0) {  | 
434 |  | -        mca_bml_base_free(bml_btl, des);  | 
435 |  | -        return rc;  | 
436 |  | -    }  | 
 | 432 | +        if((rc = opal_convertor_pack( &sendreq->req_send.req_base.req_convertor,  | 
 | 433 | +                                      &iov,  | 
 | 434 | +                                      &iov_count,  | 
 | 435 | +                                      &max_data)) < 0) {  | 
 | 436 | +            mca_bml_base_free(bml_btl, des);  | 
 | 437 | +            return rc;  | 
 | 438 | +        }  | 
437 | 439 | 
 
  | 
438 |  | -    /* re-init convertor for packed data */  | 
439 |  | -    opal_convertor_prepare_for_send( &sendreq->req_send.req_base.req_convertor,  | 
440 |  | -                                     &(ompi_mpi_byte.dt.super),  | 
441 |  | -                                     sendreq->req_send.req_bytes_packed,  | 
442 |  | -                                     sendreq->req_send.req_addr );  | 
 | 440 | +        /* re-init convertor for packed data */  | 
 | 441 | +        opal_convertor_prepare_for_send( &sendreq->req_send.req_base.req_convertor,  | 
 | 442 | +                                         &(ompi_mpi_byte.dt.super),  | 
 | 443 | +                                         sendreq->req_send.req_bytes_packed,  | 
 | 444 | +                                         sendreq->req_send.req_addr );  | 
 | 445 | +    }  | 
443 | 446 | 
 
  | 
444 | 447 |     /* wait for ack and completion */  | 
445 | 448 |     sendreq->req_state = 2;  | 
 | 
0 commit comments