xprtrdma: Remove rpcrdma_buffer::rb_mrlock
authorChuck Lever <chuck.lever@oracle.com>
Mon, 19 Aug 2019 22:47:57 +0000 (18:47 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Wed, 21 Aug 2019 15:40:00 +0000 (11:40 -0400)
Clean up: Now that the free list is used sparingly, get rid of the
separate spin lock protecting it.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtrdma/frwr_ops.c
net/sunrpc/xprtrdma/verbs.c
net/sunrpc/xprtrdma/xprt_rdma.h

index 0e740bae2d801414efe351d7ee0dc28f1b583410..368cdf3edfc94313fbedfedf98501a29c2fa05aa 100644 (file)
@@ -106,10 +106,10 @@ frwr_mr_recycle_worker(struct work_struct *work)
                mr->mr_dir = DMA_NONE;
        }
 
-       spin_lock(&r_xprt->rx_buf.rb_mrlock);
+       spin_lock(&r_xprt->rx_buf.rb_lock);
        list_del(&mr->mr_all);
        r_xprt->rx_stats.mrs_recycled++;
-       spin_unlock(&r_xprt->rx_buf.rb_mrlock);
+       spin_unlock(&r_xprt->rx_buf.rb_lock);
 
        frwr_release_mr(mr);
 }
index 69753ec73c369e09f81add1c690fedc4f1c86741..52444c4d1be2e9aa20f69c4b13d24f82ef3987cf 100644 (file)
@@ -962,10 +962,10 @@ rpcrdma_mrs_create(struct rpcrdma_xprt *r_xprt)
 
                mr->mr_xprt = r_xprt;
 
-               spin_lock(&buf->rb_mrlock);
+               spin_lock(&buf->rb_lock);
                list_add(&mr->mr_list, &buf->rb_mrs);
                list_add(&mr->mr_all, &buf->rb_all_mrs);
-               spin_unlock(&buf->rb_mrlock);
+               spin_unlock(&buf->rb_lock);
        }
 
        r_xprt->rx_stats.mrs_allocated += count;
@@ -1084,7 +1084,6 @@ int rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt)
 
        buf->rb_max_requests = r_xprt->rx_ep.rep_max_requests;
        buf->rb_bc_srv_max_requests = 0;
-       spin_lock_init(&buf->rb_mrlock);
        spin_lock_init(&buf->rb_lock);
        INIT_LIST_HEAD(&buf->rb_mrs);
        INIT_LIST_HEAD(&buf->rb_all_mrs);
@@ -1154,18 +1153,18 @@ rpcrdma_mrs_destroy(struct rpcrdma_buffer *buf)
        unsigned int count;
 
        count = 0;
-       spin_lock(&buf->rb_mrlock);
+       spin_lock(&buf->rb_lock);
        while ((mr = list_first_entry_or_null(&buf->rb_all_mrs,
                                              struct rpcrdma_mr,
                                              mr_all)) != NULL) {
                list_del(&mr->mr_all);
-               spin_unlock(&buf->rb_mrlock);
+               spin_unlock(&buf->rb_lock);
 
                frwr_release_mr(mr);
                count++;
-               spin_lock(&buf->rb_mrlock);
+               spin_lock(&buf->rb_lock);
        }
-       spin_unlock(&buf->rb_mrlock);
+       spin_unlock(&buf->rb_lock);
        r_xprt->rx_stats.mrs_allocated = 0;
 }
 
@@ -1218,9 +1217,9 @@ rpcrdma_mr_get(struct rpcrdma_xprt *r_xprt)
        struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
        struct rpcrdma_mr *mr;
 
-       spin_lock(&buf->rb_mrlock);
+       spin_lock(&buf->rb_lock);
        mr = rpcrdma_mr_pop(&buf->rb_mrs);
-       spin_unlock(&buf->rb_mrlock);
+       spin_unlock(&buf->rb_lock);
        return mr;
 }
 
@@ -1249,9 +1248,9 @@ static void rpcrdma_mr_free(struct rpcrdma_mr *mr)
        struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
 
        mr->mr_req = NULL;
-       spin_lock(&buf->rb_mrlock);
+       spin_lock(&buf->rb_lock);
        rpcrdma_mr_push(mr, &buf->rb_mrs);
-       spin_unlock(&buf->rb_mrlock);
+       spin_unlock(&buf->rb_lock);
 }
 
 /**
index c375b0e434ac7e1bfa2d10fb54fde8f19208b1af..200d075bbe313ebf645d32a62ec29e004a08527e 100644 (file)
@@ -360,19 +360,18 @@ rpcrdma_mr_pop(struct list_head *list)
  * One of these is associated with a transport instance
  */
 struct rpcrdma_buffer {
-       spinlock_t              rb_mrlock;      /* protect rb_mrs list */
+       spinlock_t              rb_lock;
+       struct list_head        rb_send_bufs;
+       struct list_head        rb_recv_bufs;
        struct list_head        rb_mrs;
-       struct list_head        rb_all_mrs;
 
        unsigned long           rb_sc_head;
        unsigned long           rb_sc_tail;
        unsigned long           rb_sc_last;
        struct rpcrdma_sendctx  **rb_sc_ctxs;
 
-       spinlock_t              rb_lock;        /* protect buf lists */
-       struct list_head        rb_send_bufs;
-       struct list_head        rb_recv_bufs;
        struct list_head        rb_allreqs;
+       struct list_head        rb_all_mrs;
 
        u32                     rb_max_requests;
        u32                     rb_credits;     /* most recent credit grant */