Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-13004 modules: replace lnet_kiov_t with struct bio_vec
[fs/lustre-release.git]
/
lnet
/
lnet
/
lib-md.c
diff --git
a/lnet/lnet/lib-md.c
b/lnet/lnet/lib-md.c
index
9bf890c
..
b7b0939
100644
(file)
--- a/
lnet/lnet/lib-md.c
+++ b/
lnet/lnet/lib-md.c
@@
-132,7
+132,7
@@
lnet_cpt_of_md(struct lnet_libmd *md, unsigned int offset)
/*
* There are three cases to handle:
/*
* There are three cases to handle:
- * 1. The MD is using
lnet_kiov_t
+ * 1. The MD is using
struct bio_vec
* 2. The MD is using struct kvec
* 3. Contiguous buffer allocated via vmalloc
*
* 2. The MD is using struct kvec
* 3. Contiguous buffer allocated via vmalloc
*
@@
-147,10
+147,10
@@
lnet_cpt_of_md(struct lnet_libmd *md, unsigned int offset)
* DMAed.
*/
if ((md->md_options & LNET_MD_KIOV) != 0) {
* DMAed.
*/
if ((md->md_options & LNET_MD_KIOV) != 0) {
-
lnet_kiov_t
*kiov = md->md_iov.kiov;
+
struct bio_vec
*kiov = md->md_iov.kiov;
- while (offset >= kiov->
kio
v_len) {
- offset -= kiov->
kio
v_len;
+ while (offset >= kiov->
b
v_len) {
+ offset -= kiov->
b
v_len;
niov--;
kiov++;
if (niov == 0) {
niov--;
kiov++;
if (niov == 0) {
@@
-160,7
+160,7
@@
lnet_cpt_of_md(struct lnet_libmd *md, unsigned int offset)
}
cpt = cfs_cpt_of_node(lnet_cpt_table(),
}
cpt = cfs_cpt_of_node(lnet_cpt_table(),
- page_to_nid(kiov->
kio
v_page));
+ page_to_nid(kiov->
b
v_page));
} else {
struct kvec *iov = md->md_iov.iov;
unsigned long vaddr;
} else {
struct kvec *iov = md->md_iov.iov;
unsigned long vaddr;
@@
-239,11
+239,11
@@
lnet_md_build(struct lnet_libmd *lmd, struct lnet_md *umd, int unlink)
for (i = 0; i < (int)niov; i++) {
/* We take the page pointer on trust */
for (i = 0; i < (int)niov; i++) {
/* We take the page pointer on trust */
- if (lmd->md_iov.kiov[i].
kio
v_offset +
- lmd->md_iov.kiov[i].
kio
v_len > PAGE_SIZE)
+ if (lmd->md_iov.kiov[i].
b
v_offset +
+ lmd->md_iov.kiov[i].
b
v_len > PAGE_SIZE)
return -EINVAL; /* invalid length */
return -EINVAL; /* invalid length */
- total_length += lmd->md_iov.kiov[i].
kio
v_len;
+ total_length += lmd->md_iov.kiov[i].
b
v_len;
}
lmd->md_length = total_length;
}
lmd->md_length = total_length;
@@
-269,7
+269,7
@@
lnet_md_build(struct lnet_libmd *lmd, struct lnet_md *umd, int unlink)
/* must be called with resource lock held */
static int
/* must be called with resource lock held */
static int
-lnet_md_link(struct lnet_libmd *md, struct lnet_
handle_eq eq_handle
, int cpt)
+lnet_md_link(struct lnet_libmd *md, struct lnet_
eq *eq
, int cpt)
{
struct lnet_res_container *container = the_lnet.ln_md_containers[cpt];
{
struct lnet_res_container *container = the_lnet.ln_md_containers[cpt];
@@
-285,12
+285,8
@@
lnet_md_link(struct lnet_libmd *md, struct lnet_handle_eq eq_handle, int cpt)
* maybe there we shouldn't even allow LNET_EQ_NONE!)
* LASSERT (eq == NULL);
*/
* maybe there we shouldn't even allow LNET_EQ_NONE!)
* LASSERT (eq == NULL);
*/
- if (!LNetEQHandleIsInvalid(eq_handle)) {
- md->md_eq = lnet_handle2eq(&eq_handle);
-
- if (md->md_eq == NULL)
- return -ENOENT;
-
+ if (eq) {
+ md->md_eq = eq;
(*md->md_eq->eq_refs[cpt])++;
}
(*md->md_eq->eq_refs[cpt])++;
}
@@
-318,7
+314,6
@@
lnet_md_deconstruct(struct lnet_libmd *lmd, struct lnet_md *umd)
umd->max_size = lmd->md_max_size;
umd->options = lmd->md_options;
umd->user_ptr = lmd->md_user_ptr;
umd->max_size = lmd->md_max_size;
umd->options = lmd->md_options;
umd->user_ptr = lmd->md_user_ptr;
- lnet_eq2handle(&umd->eq_handle, lmd->md_eq);
}
static int
}
static int
@@
-343,7
+338,7
@@
lnet_md_validate(struct lnet_md *umd)
/**
* Create a memory descriptor and attach it to a ME
*
/**
* Create a memory descriptor and attach it to a ME
*
- * \param me
h A handle for a
ME to associate the new MD with.
+ * \param me
An
ME to associate the new MD with.
* \param umd Provides initial values for the user-visible parts of a MD.
* Other than its use for initialization, there is no linkage between this
* structure and the MD maintained by the LNet.
* \param umd Provides initial values for the user-visible parts of a MD.
* Other than its use for initialization, there is no linkage between this
* structure and the MD maintained by the LNet.
@@
-366,12
+361,11
@@
lnet_md_validate(struct lnet_md *umd)
* a MD.
*/
int
* a MD.
*/
int
-LNetMDAttach(struct lnet_
handle_me meh
, struct lnet_md umd,
+LNetMDAttach(struct lnet_
me *me
, struct lnet_md umd,
enum lnet_unlink unlink, struct lnet_handle_md *handle)
{
enum lnet_unlink unlink, struct lnet_handle_md *handle)
{
- struct list_head matches = LIST_HEAD_INIT(matches);
- struct list_head drops = LIST_HEAD_INIT(drops);
- struct lnet_me *me;
+ LIST_HEAD(matches);
+ LIST_HEAD(drops);
struct lnet_libmd *md;
int cpt;
int rc;
struct lnet_libmd *md;
int cpt;
int rc;
@@
-394,14
+388,11
@@
LNetMDAttach(struct lnet_handle_me meh, struct lnet_md umd,
if (rc != 0)
goto out_free;
if (rc != 0)
goto out_free;
- cpt =
lnet_cpt_of_cookie(meh.cookie)
;
+ cpt =
me->me_cpt
;
lnet_res_lock(cpt);
lnet_res_lock(cpt);
- me = lnet_handle2me(&meh);
- if (me == NULL)
- rc = -ENOENT;
- else if (me->me_md != NULL)
+ if (me->me_md)
rc = -EBUSY;
else
rc = lnet_md_link(md, umd.eq_handle, cpt);
rc = -EBUSY;
else
rc = lnet_md_link(md, umd.eq_handle, cpt);
@@
-472,6
+463,13
@@
LNetMDBind(struct lnet_md umd, enum lnet_unlink unlink,
if (rc != 0)
goto out_free;
if (rc != 0)
goto out_free;
+ if (md->md_length > LNET_MTU) {
+ CERROR("Invalid length: too big transfer size %u, %d max\n",
+ md->md_length, LNET_MTU);
+ rc = -EINVAL;
+ goto out_free;
+ }
+
cpt = lnet_res_lock_current();
rc = lnet_md_link(md, umd.eq_handle, cpt);
cpt = lnet_res_lock_current();
rc = lnet_md_link(md, umd.eq_handle, cpt);
@@
-549,6
+547,9
@@
LNetMDUnlink(struct lnet_handle_md mdh)
lnet_eq_enqueue_event(md->md_eq, &ev);
}
lnet_eq_enqueue_event(md->md_eq, &ev);
}
+ if (md->md_rspt_ptr != NULL)
+ lnet_detach_rsp_tracker(md, cpt);
+
lnet_md_unlink(md);
lnet_res_unlock(cpt);
lnet_md_unlink(md);
lnet_res_unlock(cpt);