rds: use DIV_ROUND_UP instead of ceil
Yes indeed, DIV_ROUND_UP is in kernel.h. Signed-off-by: Jacob Wen <jian.w.wen@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
10262b0b53
Коммит
eeb2c4fb6a
|
@ -522,7 +522,7 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm,
|
|||
if (be32_to_cpu(rm->m_inc.i_hdr.h_len) == 0)
|
||||
i = 1;
|
||||
else
|
||||
i = ceil(be32_to_cpu(rm->m_inc.i_hdr.h_len), RDS_FRAG_SIZE);
|
||||
i = DIV_ROUND_UP(be32_to_cpu(rm->m_inc.i_hdr.h_len), RDS_FRAG_SIZE);
|
||||
|
||||
work_alloc = rds_ib_ring_alloc(&ic->i_send_ring, i, &pos);
|
||||
if (work_alloc == 0) {
|
||||
|
@ -879,7 +879,7 @@ int rds_ib_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op)
|
|||
* Instead of knowing how to return a partial rdma read/write we insist that there
|
||||
* be enough work requests to send the entire message.
|
||||
*/
|
||||
i = ceil(op->op_count, max_sge);
|
||||
i = DIV_ROUND_UP(op->op_count, max_sge);
|
||||
|
||||
work_alloc = rds_ib_ring_alloc(&ic->i_send_ring, i, &pos);
|
||||
if (work_alloc != i) {
|
||||
|
|
|
@ -341,7 +341,7 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in
|
|||
{
|
||||
struct rds_message *rm;
|
||||
unsigned int i;
|
||||
int num_sgs = ceil(total_len, PAGE_SIZE);
|
||||
int num_sgs = DIV_ROUND_UP(total_len, PAGE_SIZE);
|
||||
int extra_bytes = num_sgs * sizeof(struct scatterlist);
|
||||
int ret;
|
||||
|
||||
|
@ -351,7 +351,7 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in
|
|||
|
||||
set_bit(RDS_MSG_PAGEVEC, &rm->m_flags);
|
||||
rm->m_inc.i_hdr.h_len = cpu_to_be32(total_len);
|
||||
rm->data.op_nents = ceil(total_len, PAGE_SIZE);
|
||||
rm->data.op_nents = DIV_ROUND_UP(total_len, PAGE_SIZE);
|
||||
rm->data.op_sg = rds_message_alloc_sgs(rm, num_sgs, &ret);
|
||||
if (!rm->data.op_sg) {
|
||||
rds_message_put(rm);
|
||||
|
|
|
@ -48,10 +48,6 @@ void rdsdebug(char *fmt, ...)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* XXX is there one of these somewhere? */
|
||||
#define ceil(x, y) \
|
||||
({ unsigned long __x = (x), __y = (y); (__x + __y - 1) / __y; })
|
||||
|
||||
#define RDS_FRAG_SHIFT 12
|
||||
#define RDS_FRAG_SIZE ((unsigned int)(1 << RDS_FRAG_SHIFT))
|
||||
|
||||
|
|
|
@ -1107,7 +1107,7 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
|
|||
size_t total_payload_len = payload_len, rdma_payload_len = 0;
|
||||
bool zcopy = ((msg->msg_flags & MSG_ZEROCOPY) &&
|
||||
sock_flag(rds_rs_to_sk(rs), SOCK_ZEROCOPY));
|
||||
int num_sgs = ceil(payload_len, PAGE_SIZE);
|
||||
int num_sgs = DIV_ROUND_UP(payload_len, PAGE_SIZE);
|
||||
int namelen;
|
||||
struct rds_iov_vector_arr vct;
|
||||
int ind;
|
||||
|
|
Загрузка…
Ссылка в новой задаче