diff options
Diffstat (limited to 'net/rds')
| -rw-r--r-- | net/rds/bind.c | 6 | ||||
| -rw-r--r-- | net/rds/ib_send.c | 4 | ||||
| -rw-r--r-- | net/rds/message.c | 4 | ||||
| -rw-r--r-- | net/rds/rds.h | 4 | ||||
| -rw-r--r-- | net/rds/send.c | 2 |
5 files changed, 8 insertions, 12 deletions
diff --git a/net/rds/bind.c b/net/rds/bind.c index 762d2c6788a3..17c9d9f0c848 100644 --- a/net/rds/bind.c +++ b/net/rds/bind.c | |||
| @@ -78,10 +78,10 @@ struct rds_sock *rds_find_bound(const struct in6_addr *addr, __be16 port, | |||
| 78 | __rds_create_bind_key(key, addr, port, scope_id); | 78 | __rds_create_bind_key(key, addr, port, scope_id); |
| 79 | rcu_read_lock(); | 79 | rcu_read_lock(); |
| 80 | rs = rhashtable_lookup(&bind_hash_table, key, ht_parms); | 80 | rs = rhashtable_lookup(&bind_hash_table, key, ht_parms); |
| 81 | if (rs && !sock_flag(rds_rs_to_sk(rs), SOCK_DEAD)) | 81 | if (rs && (sock_flag(rds_rs_to_sk(rs), SOCK_DEAD) || |
| 82 | rds_sock_addref(rs); | 82 | !refcount_inc_not_zero(&rds_rs_to_sk(rs)->sk_refcnt))) |
| 83 | else | ||
| 84 | rs = NULL; | 83 | rs = NULL; |
| 84 | |||
| 85 | rcu_read_unlock(); | 85 | rcu_read_unlock(); |
| 86 | 86 | ||
| 87 | rdsdebug("returning rs %p for %pI6c:%u\n", rs, addr, | 87 | rdsdebug("returning rs %p for %pI6c:%u\n", rs, addr, |
diff --git a/net/rds/ib_send.c b/net/rds/ib_send.c index 2dcb555e6350..4e0c36acf866 100644 --- a/net/rds/ib_send.c +++ b/net/rds/ib_send.c | |||
| @@ -522,7 +522,7 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, | |||
| 522 | if (be32_to_cpu(rm->m_inc.i_hdr.h_len) == 0) | 522 | if (be32_to_cpu(rm->m_inc.i_hdr.h_len) == 0) |
| 523 | i = 1; | 523 | i = 1; |
| 524 | else | 524 | else |
| 525 | i = ceil(be32_to_cpu(rm->m_inc.i_hdr.h_len), RDS_FRAG_SIZE); | 525 | i = DIV_ROUND_UP(be32_to_cpu(rm->m_inc.i_hdr.h_len), RDS_FRAG_SIZE); |
| 526 | 526 | ||
| 527 | work_alloc = rds_ib_ring_alloc(&ic->i_send_ring, i, &pos); | 527 | work_alloc = rds_ib_ring_alloc(&ic->i_send_ring, i, &pos); |
| 528 | if (work_alloc == 0) { | 528 | if (work_alloc == 0) { |
| @@ -879,7 +879,7 @@ int rds_ib_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op) | |||
| 879 | * Instead of knowing how to return a partial rdma read/write we insist that there | 879 | * Instead of knowing how to return a partial rdma read/write we insist that there |
| 880 | * be enough work requests to send the entire message. | 880 | * be enough work requests to send the entire message. |
| 881 | */ | 881 | */ |
| 882 | i = ceil(op->op_count, max_sge); | 882 | i = DIV_ROUND_UP(op->op_count, max_sge); |
| 883 | 883 | ||
| 884 | work_alloc = rds_ib_ring_alloc(&ic->i_send_ring, i, &pos); | 884 | work_alloc = rds_ib_ring_alloc(&ic->i_send_ring, i, &pos); |
| 885 | if (work_alloc != i) { | 885 | if (work_alloc != i) { |
diff --git a/net/rds/message.c b/net/rds/message.c index f139420ba1f6..50f13f1d4ae0 100644 --- a/net/rds/message.c +++ b/net/rds/message.c | |||
| @@ -341,7 +341,7 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in | |||
| 341 | { | 341 | { |
| 342 | struct rds_message *rm; | 342 | struct rds_message *rm; |
| 343 | unsigned int i; | 343 | unsigned int i; |
| 344 | int num_sgs = ceil(total_len, PAGE_SIZE); | 344 | int num_sgs = DIV_ROUND_UP(total_len, PAGE_SIZE); |
| 345 | int extra_bytes = num_sgs * sizeof(struct scatterlist); | 345 | int extra_bytes = num_sgs * sizeof(struct scatterlist); |
| 346 | int ret; | 346 | int ret; |
| 347 | 347 | ||
| @@ -351,7 +351,7 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in | |||
| 351 | 351 | ||
| 352 | set_bit(RDS_MSG_PAGEVEC, &rm->m_flags); | 352 | set_bit(RDS_MSG_PAGEVEC, &rm->m_flags); |
| 353 | rm->m_inc.i_hdr.h_len = cpu_to_be32(total_len); | 353 | rm->m_inc.i_hdr.h_len = cpu_to_be32(total_len); |
| 354 | rm->data.op_nents = ceil(total_len, PAGE_SIZE); | 354 | rm->data.op_nents = DIV_ROUND_UP(total_len, PAGE_SIZE); |
| 355 | rm->data.op_sg = rds_message_alloc_sgs(rm, num_sgs, &ret); | 355 | rm->data.op_sg = rds_message_alloc_sgs(rm, num_sgs, &ret); |
| 356 | if (!rm->data.op_sg) { | 356 | if (!rm->data.op_sg) { |
| 357 | rds_message_put(rm); | 357 | rds_message_put(rm); |
diff --git a/net/rds/rds.h b/net/rds/rds.h index 02ec4a3b2799..4ffe100ff5e6 100644 --- a/net/rds/rds.h +++ b/net/rds/rds.h | |||
| @@ -48,10 +48,6 @@ void rdsdebug(char *fmt, ...) | |||
| 48 | } | 48 | } |
| 49 | #endif | 49 | #endif |
| 50 | 50 | ||
| 51 | /* XXX is there one of these somewhere? */ | ||
| 52 | #define ceil(x, y) \ | ||
| 53 | ({ unsigned long __x = (x), __y = (y); (__x + __y - 1) / __y; }) | ||
| 54 | |||
| 55 | #define RDS_FRAG_SHIFT 12 | 51 | #define RDS_FRAG_SHIFT 12 |
| 56 | #define RDS_FRAG_SIZE ((unsigned int)(1 << RDS_FRAG_SHIFT)) | 52 | #define RDS_FRAG_SIZE ((unsigned int)(1 << RDS_FRAG_SHIFT)) |
| 57 | 53 | ||
diff --git a/net/rds/send.c b/net/rds/send.c index 3d822bad7de9..fd8b687d5c05 100644 --- a/net/rds/send.c +++ b/net/rds/send.c | |||
| @@ -1107,7 +1107,7 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len) | |||
| 1107 | size_t total_payload_len = payload_len, rdma_payload_len = 0; | 1107 | size_t total_payload_len = payload_len, rdma_payload_len = 0; |
| 1108 | bool zcopy = ((msg->msg_flags & MSG_ZEROCOPY) && | 1108 | bool zcopy = ((msg->msg_flags & MSG_ZEROCOPY) && |
| 1109 | sock_flag(rds_rs_to_sk(rs), SOCK_ZEROCOPY)); | 1109 | sock_flag(rds_rs_to_sk(rs), SOCK_ZEROCOPY)); |
| 1110 | int num_sgs = ceil(payload_len, PAGE_SIZE); | 1110 | int num_sgs = DIV_ROUND_UP(payload_len, PAGE_SIZE); |
| 1111 | int namelen; | 1111 | int namelen; |
| 1112 | struct rds_iov_vector_arr vct; | 1112 | struct rds_iov_vector_arr vct; |
| 1113 | int ind; | 1113 | int ind; |
