@@ -74,7 +74,7 @@ static int ptl_send_buf(struct lnet_handle_md *mdh, void *base, int len,
/* 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);
@@ -197,7 +197,7 @@ static int ptlrpc_register_bulk(struct ptlrpc_request *req)
percpu_ref_get(&ptlrpc_pending);
/* About to let the network at it... */
- rc = LNetMDAttach(me, md, LNET_UNLINK,
+ rc = LNetMDAttach(me, &md, LNET_UNLINK,
&desc->bd_mds[posted_md]);
if (rc != 0) {
CERROR("%s: LNetMDAttach failed x%llu/%d: rc = %d\n",
@@ -656,7 +656,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
/* We must see the unlink callback to set rq_reply_unlinked,
* so we can't auto-unlink
*/
- rc = LNetMDAttach(reply_me, reply_md, LNET_RETAIN,
+ rc = LNetMDAttach(reply_me, &reply_md, LNET_RETAIN,
&request->rq_reply_md_h);
if (rc != 0) {
CERROR("LNetMDAttach failed: %d\n", rc);
@@ -786,7 +786,7 @@ int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd)
md.user_ptr = &rqbd->rqbd_cbid;
md.handler = ptlrpc_handler;
- rc = LNetMDAttach(me, md, LNET_UNLINK, &rqbd->rqbd_md_h);
+ rc = LNetMDAttach(me, &md, LNET_UNLINK, &rqbd->rqbd_md_h);
if (rc == 0) {
percpu_ref_get(&ptlrpc_pending);
return 0;
@@ -119,11 +119,11 @@ struct lnet_me *
* @{
*/
int LNetMDAttach(struct lnet_me *current_in,
- struct lnet_md md_in,
+ const struct lnet_md *md_in,
enum lnet_unlink unlink_in,
struct lnet_handle_md *md_handle_out);
-int LNetMDBind(struct lnet_md md_in,
+int LNetMDBind(const struct lnet_md *md_in,
enum lnet_unlink unlink_in,
struct lnet_handle_md *md_handle_out);
@@ -1646,7 +1646,7 @@ struct lnet_ping_buffer *
md.handler = the_lnet.ln_ping_target_handler;
md.user_ptr = *ppbuf;
- rc = LNetMDAttach(me, md, LNET_RETAIN, ping_mdh);
+ rc = LNetMDAttach(me, &md, LNET_RETAIN, ping_mdh);
if (rc) {
CERROR("Can't attach ping target MD: %d\n", rc);
goto fail_unlink_ping_me;
@@ -1856,7 +1856,7 @@ int lnet_push_target_post(struct lnet_ping_buffer *pbuf,
md.user_ptr = pbuf;
md.handler = the_lnet.ln_push_target_handler;
- rc = LNetMDAttach(me, md, LNET_UNLINK, mdhp);
+ rc = LNetMDAttach(me, &md, LNET_UNLINK, mdhp);
if (rc) {
CERROR("Can't attach push MD: %d\n", rc);
LNetMEUnlink(me);
@@ -4066,7 +4066,7 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout,
init_completion(&pd.completion);
- rc = LNetMDBind(md, LNET_UNLINK, &pd.mdh);
+ rc = LNetMDBind(&md, LNET_UNLINK, &pd.mdh);
if (rc) {
CERROR("Can't bind MD: %d\n", rc);
goto fail_ping_buffer_decref;
@@ -124,7 +124,7 @@ int lnet_cpt_of_md(struct lnet_libmd *md, unsigned int offset)
}
static struct lnet_libmd *
-lnet_md_build(struct lnet_md *umd, int unlink)
+lnet_md_build(const struct lnet_md *umd, int unlink)
{
int i;
unsigned int niov;
@@ -269,7 +269,7 @@ int lnet_cpt_of_md(struct lnet_libmd *md, unsigned int offset)
}
static int
-lnet_md_validate(struct lnet_md *umd)
+lnet_md_validate(const struct lnet_md *umd)
{
if (!umd->start && umd->length) {
CERROR("MD start pointer can not be NULL with length %u\n",
@@ -314,7 +314,7 @@ int lnet_cpt_of_md(struct lnet_libmd *md, unsigned int offset)
* a MD.
*/
int
-LNetMDAttach(struct lnet_me *me, struct lnet_md umd,
+LNetMDAttach(struct lnet_me *me, const struct lnet_md *umd,
enum lnet_unlink unlink, struct lnet_handle_md *handle)
{
LIST_HEAD(matches);
@@ -325,15 +325,15 @@ int lnet_cpt_of_md(struct lnet_libmd *md, unsigned int offset)
LASSERT(the_lnet.ln_refcount > 0);
- if (lnet_md_validate(&umd))
+ if (lnet_md_validate(umd))
return -EINVAL;
- if (!(umd.options & (LNET_MD_OP_GET | LNET_MD_OP_PUT))) {
+ if (!(umd->options & (LNET_MD_OP_GET | LNET_MD_OP_PUT))) {
CERROR("Invalid option: no MD_OP set\n");
return -EINVAL;
}
- md = lnet_md_build(&umd, unlink);
+ md = lnet_md_build(umd, unlink);
if (IS_ERR(md))
return PTR_ERR(md);
@@ -344,7 +344,7 @@ int lnet_cpt_of_md(struct lnet_libmd *md, unsigned int offset)
if (me->me_md)
rc = -EBUSY;
else
- rc = lnet_md_link(md, umd.handler, cpt);
+ rc = lnet_md_link(md, umd->handler, cpt);
if (rc)
goto out_unlock;
@@ -388,7 +388,7 @@ int lnet_cpt_of_md(struct lnet_libmd *md, unsigned int offset)
* calling LNetInvalidateHandle() on it.
*/
int
-LNetMDBind(struct lnet_md umd, enum lnet_unlink unlink,
+LNetMDBind(const struct lnet_md *umd, enum lnet_unlink unlink,
struct lnet_handle_md *handle)
{
struct lnet_libmd *md;
@@ -397,15 +397,15 @@ int lnet_cpt_of_md(struct lnet_libmd *md, unsigned int offset)
LASSERT(the_lnet.ln_refcount > 0);
- if (lnet_md_validate(&umd))
+ if (lnet_md_validate(umd))
return -EINVAL;
- if ((umd.options & (LNET_MD_OP_GET | LNET_MD_OP_PUT))) {
+ if ((umd->options & (LNET_MD_OP_GET | LNET_MD_OP_PUT))) {
CERROR("Invalid option: GET|PUT illegal on active MDs\n");
return -EINVAL;
}
- md = lnet_md_build(&umd, unlink);
+ md = lnet_md_build(umd, unlink);
if (IS_ERR(md))
return PTR_ERR(md);
@@ -418,7 +418,7 @@ int lnet_cpt_of_md(struct lnet_libmd *md, unsigned int offset)
cpt = lnet_res_lock_current();
- rc = lnet_md_link(md, umd.handler, cpt);
+ rc = lnet_md_link(md, umd->handler, cpt);
if (rc)
goto out_unlock;
@@ -3305,7 +3305,7 @@ struct lnet_mt_event_info {
md.user_ptr = user_data;
md.handler = handler;
- rc = LNetMDBind(md, LNET_UNLINK, mdh);
+ rc = LNetMDBind(&md, LNET_UNLINK, mdh);
if (rc) {
lnet_ping_buffer_decref(pbuf);
CERROR("Can't bind MD: %d\n", rc);
@@ -3073,7 +3073,7 @@ static int lnet_peer_send_push(struct lnet_peer *lp)
md.handler = the_lnet.ln_dc_handler;
md.user_ptr = lp;
- rc = LNetMDBind(md, LNET_UNLINK, &lp->lp_push_mdh);
+ rc = LNetMDBind(&md, LNET_UNLINK, &lp->lp_push_mdh);
if (rc) {
lnet_ping_buffer_decref(pbuf);
CERROR("Can't bind push source MD: %d\n", rc);
@@ -378,7 +378,7 @@ struct srpc_bulk *
md.options = options;
md.handler = srpc_data.rpc_lnet_handler;
- rc = LNetMDAttach(me, md, LNET_UNLINK, mdh);
+ rc = LNetMDAttach(me, &md, LNET_UNLINK, mdh);
if (rc) {
CERROR("LNetMDAttach failed: %d\n", rc);
LASSERT(rc == -ENOMEM);
@@ -409,7 +409,7 @@ struct srpc_bulk *
md.threshold = options & LNET_MD_OP_GET ? 2 : 1;
md.options = options & ~(LNET_MD_OP_PUT | LNET_MD_OP_GET);
- rc = LNetMDBind(md, LNET_UNLINK, mdh);
+ rc = LNetMDBind(&md, LNET_UNLINK, mdh);
if (rc) {
CERROR("LNetMDBind failed: %d\n", rc);
LASSERT(rc == -ENOMEM);