41 if (k ==
NULL || len == 0 || len > LNET_MAX_IOV)
43 for (
i = 0;
i < len; ++
i, ++k) {
44 if (k->kiov_page ==
NULL || k->kiov_len == 0 ||
47 if (k->kiov_offset != 0 &&
i != 0)
49 if (k->kiov_len !=
PAGE_SIZE &&
i != (len - 1) &&
52 if (k->kiov_offset != 0 &&
53 (k->kiov_offset + k->kiov_len) >
PAGE_SIZE)
76 npages = (uint64_t)(seg_addr + seg_len - 1) /
PAGE_SIZE -
102 for (pnum = 0; pnum < num_pages; ++pnum) {
110 pg = virt_to_page(seg_addr);
113 kiov[pnum].kiov_page = pg;
114 kiov[pnum].kiov_len = len;
115 kiov[pnum].kiov_offset =
offset;
149 if (num_pages > LNET_MAX_IOV) {
196 for (pnum = 0; pnum < num_pages; ++pnum) {
204 down_read(¤t->mm->mmap_sem);
206 up_read(¤t->mm->mmap_sem);
211 kiov[pnum].kiov_page = pg;
212 kiov[pnum].kiov_len = len;
213 kiov[pnum].kiov_offset =
offset;
251 if (num_pages == 0) {
255 if (num_pages > LNET_MAX_IOV) {
314 for (
i = 0,
count = 0;
i < kiov_len &&
count < bytes; ++
i, ++kiov)
315 count += kiov->kiov_len;
319 *last_len = (kiov->kiov_len -
count + bytes) % kiov->kiov_len;
321 *last_len = kiov->kiov_len;
323 NLXP(
"bytes=%lu n=%lu c=%ld k=%ld l=%u\n", (
unsigned long) bytes,
324 (
unsigned long)
i, (
unsigned long)
count,
325 (
unsigned long) kiov->kiov_len, *last_len);
static unsigned bufvec_seg_kla_to_kiov(const struct m0_bufvec *bvec, unsigned n, lnet_kiov_t *kiov)
#define WRITABLE_USER_PAGE_GET(uaddr, pg)
static size_t nlx_kcore_num_kiov_entries_for_bytes(const lnet_kiov_t *kiov, size_t kiov_len, m0_bcount_t bytes, unsigned *last_len)
#define NLX_PAGE_OFFSET(addr)
static int nlx_kcore_buffer_uva_to_kiov(struct nlx_kcore_buffer *kb, const struct m0_bufvec *bvec)
#define NLX_ALLOC_ARR(ptr, nr)
static int nlx_kcore_buffer_kla_to_kiov(struct nlx_kcore_buffer *kb, const struct m0_bufvec *bvec)
return M0_ERR(-EOPNOTSUPP)
static struct m0_bufvec bvec
static int bufvec_seg_uva_to_kiov(struct nlx_kcore_buffer *kb, const struct m0_bufvec *bvec, unsigned n, lnet_kiov_t *kiov)
static m0_bindex_t offset
static uint8_t fail[DATA_UNIT_COUNT_MAX+PARITY_UNIT_COUNT_MAX]
#define WRITABLE_USER_PAGE_PUT(pg)
static unsigned bufvec_seg_page_count(const struct m0_bufvec *bvec, unsigned n)
static bool nlx_kcore_buffer_invariant(const struct nlx_kcore_buffer *kcb)
static bool nlx_kcore_kiov_invariant(const lnet_kiov_t *k, size_t len)