RDS: make sure all sgs alloced are initialized
authorAndy Grover <andy.grover@oracle.com>
Tue, 12 Jan 2010 22:17:31 +0000 (14:17 -0800)
committerAndy Grover <andy.grover@oracle.com>
Thu, 9 Sep 2010 01:11:39 +0000 (18:11 -0700)
rds_message_alloc_sgs() now returns correctly-initialized
sg lists, so calleds need not do this themselves.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
net/rds/message.c
net/rds/rdma.c

index 4352ce79b376356217238296016fe17052ae2615..7d678e217820faf52c8d6f3e1f43bf756e45b624 100644 (file)
@@ -249,7 +249,7 @@ struct scatterlist *rds_message_alloc_sgs(struct rds_message *rm, int nents)
        WARN_ON(rm->m_used_sgs + nents > rm->m_total_sgs);
 
        sg_ret = &sg_first[rm->m_used_sgs];
-
+       sg_init_table(sg_ret, nents);
        rm->m_used_sgs += nents;
 
        return sg_ret;
index 7ff3379bab14d16d24e274880924f07911e4a385..4fda33045598510268d1b238b392580a6fe2c334 100644 (file)
@@ -534,14 +534,13 @@ static int rds_rdma_prepare(struct rds_message *rm,
                goto out;
        }
 
-       op->r_sg = rds_message_alloc_sgs(rm, nr_pages);
        op->r_write = !!(args->flags & RDS_RDMA_READWRITE);
        op->r_fence = !!(args->flags & RDS_RDMA_FENCE);
        op->r_notify = !!(args->flags & RDS_RDMA_NOTIFY_ME);
        op->r_active = 1;
        op->r_recverr = rs->rs_recverr;
        WARN_ON(!nr_pages);
-       sg_init_table(op->r_sg, nr_pages);
+       op->r_sg = rds_message_alloc_sgs(rm, nr_pages);
 
        if (op->r_notify || op->r_recverr) {
                /* We allocate an uninitialized notifier here, because