* associated with a MD: LNetMDUnlink().
* @{ */
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);
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 != 0) {
CERROR("Can't attach ping target MD: %d\n", rc);
goto fail_unlink_ping_me;
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);
init_completion(&pd.completion);
- rc = LNetMDBind(md, LNET_UNLINK, &pd.mdh);
+ rc = LNetMDBind(&md, LNET_UNLINK, &pd.mdh);
if (rc != 0) {
CERROR("Can't bind MD: %d\n", rc);
goto fail_ping_buffer_decref;
}
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;
}
static int
-lnet_md_validate(struct lnet_md *umd)
+lnet_md_validate(const struct lnet_md *umd)
{
if (umd->start == NULL && umd->length != 0) {
CERROR("MD start pointer can not be NULL with length %u\n",
* 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);
LASSERT(the_lnet.ln_refcount > 0);
- if (lnet_md_validate(&umd) != 0)
+ if (lnet_md_validate(umd) != 0)
return -EINVAL;
- if ((umd.options & (LNET_MD_OP_GET | LNET_MD_OP_PUT)) == 0) {
+ if ((umd->options & (LNET_MD_OP_GET | LNET_MD_OP_PUT)) == 0) {
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);
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 != 0)
goto out_unlock;
* 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;
LASSERT(the_lnet.ln_refcount > 0);
- if (lnet_md_validate(&umd) != 0)
+ if (lnet_md_validate(umd) != 0)
return -EINVAL;
- if ((umd.options & (LNET_MD_OP_GET | LNET_MD_OP_PUT)) != 0) {
+ if ((umd->options & (LNET_MD_OP_GET | LNET_MD_OP_PUT)) != 0) {
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);
cpt = lnet_res_lock_current();
- rc = lnet_md_link(md, umd.handler, cpt);
+ rc = lnet_md_link(md, umd->handler, cpt);
if (rc != 0)
goto out_unlock;
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);
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);
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 != 0) {
CERROR("LNetMDAttach failed: %d\n", rc);
LASSERT(rc == -ENOMEM);
md.threshold = ((options & LNET_MD_OP_GET) != 0) ? 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 != 0) {
CERROR("LNetMDBind failed: %d\n", rc);
LASSERT(rc == -ENOMEM);
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);
* page-aligned. Otherwise we'd have to send client bulk
* sizes over and split server buffer accordingly */
ptlrpc_fill_bulk_md(&md, desc, posted_md);
- rc = LNetMDBind(md, LNET_UNLINK, &desc->bd_mds[posted_md]);
+ rc = LNetMDBind(&md, LNET_UNLINK, &desc->bd_mds[posted_md]);
if (rc != 0) {
CERROR("%s: LNetMDBind failed for MD %u: rc = %d\n",
exp->exp_obd->obd_name, posted_md, rc);
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",
/* 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);
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;