Loading net/rds/ib.h +1 −2 Original line number Diff line number Diff line Loading @@ -316,8 +316,7 @@ int rds_ib_recv_alloc_caches(struct rds_ib_connection *ic); void rds_ib_recv_free_caches(struct rds_ib_connection *ic); void rds_ib_recv_refill(struct rds_connection *conn, int prefill); void rds_ib_inc_free(struct rds_incoming *inc); int rds_ib_inc_copy_to_user(struct rds_incoming *inc, struct iovec *iov, size_t size); int rds_ib_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to); void rds_ib_recv_cq_comp_handler(struct ib_cq *cq, void *context); void rds_ib_recv_tasklet_fn(unsigned long data); void rds_ib_recv_init_ring(struct rds_ib_connection *ic); Loading net/rds/ib_recv.c +11 −26 Original line number Diff line number Diff line Loading @@ -472,15 +472,12 @@ static struct list_head *rds_ib_recv_cache_get(struct rds_ib_refill_cache *cache return head; } int rds_ib_inc_copy_to_user(struct rds_incoming *inc, struct iovec *first_iov, size_t size) int rds_ib_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to) { struct rds_ib_incoming *ibinc; struct rds_page_frag *frag; struct iovec *iov = first_iov; unsigned long to_copy; unsigned long frag_off = 0; unsigned long iov_off = 0; int copied = 0; int ret; u32 len; Loading @@ -489,37 +486,25 @@ int rds_ib_inc_copy_to_user(struct rds_incoming *inc, struct iovec *first_iov, frag = list_entry(ibinc->ii_frags.next, struct rds_page_frag, f_item); len = be32_to_cpu(inc->i_hdr.h_len); while (copied < size && copied < len) { while (iov_iter_count(to) && copied < len) { if (frag_off == RDS_FRAG_SIZE) { frag = list_entry(frag->f_item.next, struct rds_page_frag, f_item); frag_off = 0; } while (iov_off == iov->iov_len) { iov_off = 0; iov++; } to_copy = min(iov->iov_len - iov_off, RDS_FRAG_SIZE - frag_off); to_copy = min_t(size_t, to_copy, size - copied); to_copy = min_t(unsigned long, iov_iter_count(to), RDS_FRAG_SIZE - frag_off); to_copy = min_t(unsigned long, to_copy, len - copied); rdsdebug("%lu bytes to user [%p, %zu] + %lu from frag " "[%p, %u] + %lu\n", to_copy, iov->iov_base, iov->iov_len, iov_off, sg_page(&frag->f_sg), frag->f_sg.offset, frag_off); /* XXX needs + offset for multiple recvs per page */ ret = rds_page_copy_to_user(sg_page(&frag->f_sg), rds_stats_add(s_copy_to_user, to_copy); ret = copy_page_to_iter(sg_page(&frag->f_sg), frag->f_sg.offset + frag_off, iov->iov_base + iov_off, to_copy); if (ret) { copied = ret; break; } to_copy, to); if (ret != to_copy) return -EFAULT; iov_off += to_copy; frag_off += to_copy; copied += to_copy; } Loading net/rds/iw.h +1 −2 Original line number Diff line number Diff line Loading @@ -325,8 +325,7 @@ int rds_iw_recv(struct rds_connection *conn); int rds_iw_recv_refill(struct rds_connection *conn, gfp_t kptr_gfp, gfp_t page_gfp, int prefill); void rds_iw_inc_free(struct rds_incoming *inc); int rds_iw_inc_copy_to_user(struct rds_incoming *inc, struct iovec *iov, size_t size); int rds_iw_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to); void rds_iw_recv_cq_comp_handler(struct ib_cq *cq, void *context); void rds_iw_recv_tasklet_fn(unsigned long data); void rds_iw_recv_init_ring(struct rds_iw_connection *ic); Loading net/rds/iw_recv.c +11 −26 Original line number Diff line number Diff line Loading @@ -303,15 +303,12 @@ void rds_iw_inc_free(struct rds_incoming *inc) BUG_ON(atomic_read(&rds_iw_allocation) < 0); } int rds_iw_inc_copy_to_user(struct rds_incoming *inc, struct iovec *first_iov, size_t size) int rds_iw_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to) { struct rds_iw_incoming *iwinc; struct rds_page_frag *frag; struct iovec *iov = first_iov; unsigned long to_copy; unsigned long frag_off = 0; unsigned long iov_off = 0; int copied = 0; int ret; u32 len; Loading @@ -320,37 +317,25 @@ int rds_iw_inc_copy_to_user(struct rds_incoming *inc, struct iovec *first_iov, frag = list_entry(iwinc->ii_frags.next, struct rds_page_frag, f_item); len = be32_to_cpu(inc->i_hdr.h_len); while (copied < size && copied < len) { while (iov_iter_count(to) && copied < len) { if (frag_off == RDS_FRAG_SIZE) { frag = list_entry(frag->f_item.next, struct rds_page_frag, f_item); frag_off = 0; } while (iov_off == iov->iov_len) { iov_off = 0; iov++; } to_copy = min(iov->iov_len - iov_off, RDS_FRAG_SIZE - frag_off); to_copy = min_t(size_t, to_copy, size - copied); to_copy = min_t(unsigned long, iov_iter_count(to), RDS_FRAG_SIZE - frag_off); to_copy = min_t(unsigned long, to_copy, len - copied); rdsdebug("%lu bytes to user [%p, %zu] + %lu from frag " "[%p, %lu] + %lu\n", to_copy, iov->iov_base, iov->iov_len, iov_off, frag->f_page, frag->f_offset, frag_off); /* XXX needs + offset for multiple recvs per page */ ret = rds_page_copy_to_user(frag->f_page, rds_stats_add(s_copy_to_user, to_copy); ret = copy_page_to_iter(frag->f_page, frag->f_offset + frag_off, iov->iov_base + iov_off, to_copy); if (ret) { copied = ret; break; } to_copy, to); if (ret != to_copy) return -EFAULT; iov_off += to_copy; frag_off += to_copy; copied += to_copy; } Loading net/rds/message.c +8 −27 Original line number Diff line number Diff line Loading @@ -325,14 +325,11 @@ int rds_message_copy_from_user(struct rds_message *rm, struct iovec *first_iov, return ret; } int rds_message_inc_copy_to_user(struct rds_incoming *inc, struct iovec *first_iov, size_t size) int rds_message_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to) { struct rds_message *rm; struct iovec *iov; struct scatterlist *sg; unsigned long to_copy; unsigned long iov_off; unsigned long vec_off; int copied; int ret; Loading @@ -341,36 +338,20 @@ int rds_message_inc_copy_to_user(struct rds_incoming *inc, rm = container_of(inc, struct rds_message, m_inc); len = be32_to_cpu(rm->m_inc.i_hdr.h_len); iov = first_iov; iov_off = 0; sg = rm->data.op_sg; vec_off = 0; copied = 0; while (copied < size && copied < len) { while (iov_off == iov->iov_len) { iov_off = 0; iov++; } to_copy = min(iov->iov_len - iov_off, sg->length - vec_off); to_copy = min_t(size_t, to_copy, size - copied); while (iov_iter_count(to) && copied < len) { to_copy = min(iov_iter_count(to), sg->length - vec_off); to_copy = min_t(unsigned long, to_copy, len - copied); rdsdebug("copying %lu bytes to user iov [%p, %zu] + %lu to " "sg [%p, %u, %u] + %lu\n", to_copy, iov->iov_base, iov->iov_len, iov_off, sg_page(sg), sg->offset, sg->length, vec_off); ret = rds_page_copy_to_user(sg_page(sg), sg->offset + vec_off, iov->iov_base + iov_off, to_copy); if (ret) { copied = ret; break; } rds_stats_add(s_copy_to_user, to_copy); ret = copy_page_to_iter(sg_page(sg), sg->offset + vec_off, to_copy, to); if (ret != to_copy) return -EFAULT; iov_off += to_copy; vec_off += to_copy; copied += to_copy; Loading Loading
net/rds/ib.h +1 −2 Original line number Diff line number Diff line Loading @@ -316,8 +316,7 @@ int rds_ib_recv_alloc_caches(struct rds_ib_connection *ic); void rds_ib_recv_free_caches(struct rds_ib_connection *ic); void rds_ib_recv_refill(struct rds_connection *conn, int prefill); void rds_ib_inc_free(struct rds_incoming *inc); int rds_ib_inc_copy_to_user(struct rds_incoming *inc, struct iovec *iov, size_t size); int rds_ib_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to); void rds_ib_recv_cq_comp_handler(struct ib_cq *cq, void *context); void rds_ib_recv_tasklet_fn(unsigned long data); void rds_ib_recv_init_ring(struct rds_ib_connection *ic); Loading
net/rds/ib_recv.c +11 −26 Original line number Diff line number Diff line Loading @@ -472,15 +472,12 @@ static struct list_head *rds_ib_recv_cache_get(struct rds_ib_refill_cache *cache return head; } int rds_ib_inc_copy_to_user(struct rds_incoming *inc, struct iovec *first_iov, size_t size) int rds_ib_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to) { struct rds_ib_incoming *ibinc; struct rds_page_frag *frag; struct iovec *iov = first_iov; unsigned long to_copy; unsigned long frag_off = 0; unsigned long iov_off = 0; int copied = 0; int ret; u32 len; Loading @@ -489,37 +486,25 @@ int rds_ib_inc_copy_to_user(struct rds_incoming *inc, struct iovec *first_iov, frag = list_entry(ibinc->ii_frags.next, struct rds_page_frag, f_item); len = be32_to_cpu(inc->i_hdr.h_len); while (copied < size && copied < len) { while (iov_iter_count(to) && copied < len) { if (frag_off == RDS_FRAG_SIZE) { frag = list_entry(frag->f_item.next, struct rds_page_frag, f_item); frag_off = 0; } while (iov_off == iov->iov_len) { iov_off = 0; iov++; } to_copy = min(iov->iov_len - iov_off, RDS_FRAG_SIZE - frag_off); to_copy = min_t(size_t, to_copy, size - copied); to_copy = min_t(unsigned long, iov_iter_count(to), RDS_FRAG_SIZE - frag_off); to_copy = min_t(unsigned long, to_copy, len - copied); rdsdebug("%lu bytes to user [%p, %zu] + %lu from frag " "[%p, %u] + %lu\n", to_copy, iov->iov_base, iov->iov_len, iov_off, sg_page(&frag->f_sg), frag->f_sg.offset, frag_off); /* XXX needs + offset for multiple recvs per page */ ret = rds_page_copy_to_user(sg_page(&frag->f_sg), rds_stats_add(s_copy_to_user, to_copy); ret = copy_page_to_iter(sg_page(&frag->f_sg), frag->f_sg.offset + frag_off, iov->iov_base + iov_off, to_copy); if (ret) { copied = ret; break; } to_copy, to); if (ret != to_copy) return -EFAULT; iov_off += to_copy; frag_off += to_copy; copied += to_copy; } Loading
net/rds/iw.h +1 −2 Original line number Diff line number Diff line Loading @@ -325,8 +325,7 @@ int rds_iw_recv(struct rds_connection *conn); int rds_iw_recv_refill(struct rds_connection *conn, gfp_t kptr_gfp, gfp_t page_gfp, int prefill); void rds_iw_inc_free(struct rds_incoming *inc); int rds_iw_inc_copy_to_user(struct rds_incoming *inc, struct iovec *iov, size_t size); int rds_iw_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to); void rds_iw_recv_cq_comp_handler(struct ib_cq *cq, void *context); void rds_iw_recv_tasklet_fn(unsigned long data); void rds_iw_recv_init_ring(struct rds_iw_connection *ic); Loading
net/rds/iw_recv.c +11 −26 Original line number Diff line number Diff line Loading @@ -303,15 +303,12 @@ void rds_iw_inc_free(struct rds_incoming *inc) BUG_ON(atomic_read(&rds_iw_allocation) < 0); } int rds_iw_inc_copy_to_user(struct rds_incoming *inc, struct iovec *first_iov, size_t size) int rds_iw_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to) { struct rds_iw_incoming *iwinc; struct rds_page_frag *frag; struct iovec *iov = first_iov; unsigned long to_copy; unsigned long frag_off = 0; unsigned long iov_off = 0; int copied = 0; int ret; u32 len; Loading @@ -320,37 +317,25 @@ int rds_iw_inc_copy_to_user(struct rds_incoming *inc, struct iovec *first_iov, frag = list_entry(iwinc->ii_frags.next, struct rds_page_frag, f_item); len = be32_to_cpu(inc->i_hdr.h_len); while (copied < size && copied < len) { while (iov_iter_count(to) && copied < len) { if (frag_off == RDS_FRAG_SIZE) { frag = list_entry(frag->f_item.next, struct rds_page_frag, f_item); frag_off = 0; } while (iov_off == iov->iov_len) { iov_off = 0; iov++; } to_copy = min(iov->iov_len - iov_off, RDS_FRAG_SIZE - frag_off); to_copy = min_t(size_t, to_copy, size - copied); to_copy = min_t(unsigned long, iov_iter_count(to), RDS_FRAG_SIZE - frag_off); to_copy = min_t(unsigned long, to_copy, len - copied); rdsdebug("%lu bytes to user [%p, %zu] + %lu from frag " "[%p, %lu] + %lu\n", to_copy, iov->iov_base, iov->iov_len, iov_off, frag->f_page, frag->f_offset, frag_off); /* XXX needs + offset for multiple recvs per page */ ret = rds_page_copy_to_user(frag->f_page, rds_stats_add(s_copy_to_user, to_copy); ret = copy_page_to_iter(frag->f_page, frag->f_offset + frag_off, iov->iov_base + iov_off, to_copy); if (ret) { copied = ret; break; } to_copy, to); if (ret != to_copy) return -EFAULT; iov_off += to_copy; frag_off += to_copy; copied += to_copy; } Loading
net/rds/message.c +8 −27 Original line number Diff line number Diff line Loading @@ -325,14 +325,11 @@ int rds_message_copy_from_user(struct rds_message *rm, struct iovec *first_iov, return ret; } int rds_message_inc_copy_to_user(struct rds_incoming *inc, struct iovec *first_iov, size_t size) int rds_message_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to) { struct rds_message *rm; struct iovec *iov; struct scatterlist *sg; unsigned long to_copy; unsigned long iov_off; unsigned long vec_off; int copied; int ret; Loading @@ -341,36 +338,20 @@ int rds_message_inc_copy_to_user(struct rds_incoming *inc, rm = container_of(inc, struct rds_message, m_inc); len = be32_to_cpu(rm->m_inc.i_hdr.h_len); iov = first_iov; iov_off = 0; sg = rm->data.op_sg; vec_off = 0; copied = 0; while (copied < size && copied < len) { while (iov_off == iov->iov_len) { iov_off = 0; iov++; } to_copy = min(iov->iov_len - iov_off, sg->length - vec_off); to_copy = min_t(size_t, to_copy, size - copied); while (iov_iter_count(to) && copied < len) { to_copy = min(iov_iter_count(to), sg->length - vec_off); to_copy = min_t(unsigned long, to_copy, len - copied); rdsdebug("copying %lu bytes to user iov [%p, %zu] + %lu to " "sg [%p, %u, %u] + %lu\n", to_copy, iov->iov_base, iov->iov_len, iov_off, sg_page(sg), sg->offset, sg->length, vec_off); ret = rds_page_copy_to_user(sg_page(sg), sg->offset + vec_off, iov->iov_base + iov_off, to_copy); if (ret) { copied = ret; break; } rds_stats_add(s_copy_to_user, to_copy); ret = copy_page_to_iter(sg_page(sg), sg->offset + vec_off, to_copy, to); if (ret != to_copy) return -EFAULT; iov_off += to_copy; vec_off += to_copy; copied += to_copy; Loading