aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds/message.c
diff options
context:
space:
mode:
authorAndy Grover <andy.grover@oracle.com>2010-01-12 17:13:15 -0500
committerAndy Grover <andy.grover@oracle.com>2010-09-08 21:11:38 -0400
commitff87e97a9d70c9ae133d3d3d7792b26ab85f4297 (patch)
tree32de73cdf5e4353e89b3351eaae695f69faa868b /net/rds/message.c
parent21f79afa5fda2820671a8f64c3d0e43bb118053b (diff)
RDS: make m_rdma_op a member of rds_message
This eliminates a separate memory alloc, although it is now necessary to add an "r_active" flag, since it is no longer to use the m_rdma_op pointer as an indicator of if an rdma op is present. rdma SGs allocated from rm sg pool. rds_rm_size also gets bigger. It's a little inefficient to run through CMSGs twice, but it makes later steps a lot smoother. Signed-off-by: Andy Grover <andy.grover@oracle.com>
Diffstat (limited to 'net/rds/message.c')
-rw-r--r--net/rds/message.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/rds/message.c b/net/rds/message.c
index fb382fbb5b6f..4352ce79b376 100644
--- a/net/rds/message.c
+++ b/net/rds/message.c
@@ -69,8 +69,8 @@ static void rds_message_purge(struct rds_message *rm)
69 } 69 }
70 rm->data.m_nents = 0; 70 rm->data.m_nents = 0;
71 71
72 if (rm->rdma.m_rdma_op) 72 if (rm->rdma.m_rdma_op.r_active)
73 rds_rdma_free_op(rm->rdma.m_rdma_op); 73 rds_rdma_free_op(&rm->rdma.m_rdma_op);
74 if (rm->rdma.m_rdma_mr) 74 if (rm->rdma.m_rdma_mr)
75 rds_mr_put(rm->rdma.m_rdma_mr); 75 rds_mr_put(rm->rdma.m_rdma_mr);
76} 76}
@@ -259,14 +259,17 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in
259{ 259{
260 struct rds_message *rm; 260 struct rds_message *rm;
261 unsigned int i; 261 unsigned int i;
262 int num_sgs = ceil(total_len, PAGE_SIZE);
263 int extra_bytes = num_sgs * sizeof(struct scatterlist);
262 264
263 rm = rds_message_alloc(ceil(total_len, PAGE_SIZE), GFP_KERNEL); 265 rm = rds_message_alloc(extra_bytes, GFP_KERNEL);
264 if (!rm) 266 if (!rm)
265 return ERR_PTR(-ENOMEM); 267 return ERR_PTR(-ENOMEM);
266 268
267 set_bit(RDS_MSG_PAGEVEC, &rm->m_flags); 269 set_bit(RDS_MSG_PAGEVEC, &rm->m_flags);
268 rm->m_inc.i_hdr.h_len = cpu_to_be32(total_len); 270 rm->m_inc.i_hdr.h_len = cpu_to_be32(total_len);
269 rm->data.m_nents = ceil(total_len, PAGE_SIZE); 271 rm->data.m_nents = ceil(total_len, PAGE_SIZE);
272 rm->data.m_sg = rds_message_alloc_sgs(rm, num_sgs);
270 273
271 for (i = 0; i < rm->data.m_nents; ++i) { 274 for (i = 0; i < rm->data.m_nents; ++i) {
272 sg_set_page(&rm->data.m_sg[i], 275 sg_set_page(&rm->data.m_sg[i],