]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
xprtrdma: Rename rpcrdma_buffer::rb_all
authorChuck Lever <chuck.lever@oracle.com>
Mon, 19 Aug 2019 22:42:31 +0000 (18:42 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 20 Aug 2019 17:56:45 +0000 (13:56 -0400)
Clean up: There are other "all" list heads. For code clarity
distinguish this one as for use only for MRs by renaming it.

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

index 3c275a7a4e4c3c08a9c7caf36584d662371c7222..e004873cc4f05b1c6a19dbb734da057a6eb24da8 100644 (file)
@@ -944,8 +944,6 @@ rpcrdma_mrs_create(struct rpcrdma_xprt *r_xprt)
        struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
        struct rpcrdma_ia *ia = &r_xprt->rx_ia;
        unsigned int count;
        struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
        struct rpcrdma_ia *ia = &r_xprt->rx_ia;
        unsigned int count;
-       LIST_HEAD(free);
-       LIST_HEAD(all);
 
        for (count = 0; count < ia->ri_max_segs; count++) {
                struct rpcrdma_mr *mr;
 
        for (count = 0; count < ia->ri_max_segs; count++) {
                struct rpcrdma_mr *mr;
@@ -963,15 +961,13 @@ rpcrdma_mrs_create(struct rpcrdma_xprt *r_xprt)
 
                mr->mr_xprt = r_xprt;
 
 
                mr->mr_xprt = r_xprt;
 
-               list_add(&mr->mr_list, &free);
-               list_add(&mr->mr_all, &all);
+               spin_lock(&buf->rb_mrlock);
+               list_add(&mr->mr_list, &buf->rb_mrs);
+               list_add(&mr->mr_all, &buf->rb_all_mrs);
+               spin_unlock(&buf->rb_mrlock);
        }
 
        }
 
-       spin_lock(&buf->rb_mrlock);
-       list_splice(&free, &buf->rb_mrs);
-       list_splice(&all, &buf->rb_all);
        r_xprt->rx_stats.mrs_allocated += count;
        r_xprt->rx_stats.mrs_allocated += count;
-       spin_unlock(&buf->rb_mrlock);
        trace_xprtrdma_createmrs(r_xprt, count);
 }
 
        trace_xprtrdma_createmrs(r_xprt, count);
 }
 
@@ -1089,7 +1085,7 @@ int rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt)
        spin_lock_init(&buf->rb_mrlock);
        spin_lock_init(&buf->rb_lock);
        INIT_LIST_HEAD(&buf->rb_mrs);
        spin_lock_init(&buf->rb_mrlock);
        spin_lock_init(&buf->rb_lock);
        INIT_LIST_HEAD(&buf->rb_mrs);
-       INIT_LIST_HEAD(&buf->rb_all);
+       INIT_LIST_HEAD(&buf->rb_all_mrs);
        INIT_DELAYED_WORK(&buf->rb_refresh_worker,
                          rpcrdma_mr_refresh_worker);
 
        INIT_DELAYED_WORK(&buf->rb_refresh_worker,
                          rpcrdma_mr_refresh_worker);
 
@@ -1156,24 +1152,18 @@ rpcrdma_mrs_destroy(struct rpcrdma_buffer *buf)
 
        count = 0;
        spin_lock(&buf->rb_mrlock);
 
        count = 0;
        spin_lock(&buf->rb_mrlock);
-       while (!list_empty(&buf->rb_all)) {
-               mr = list_entry(buf->rb_all.next, struct rpcrdma_mr, mr_all);
+       while ((mr = list_first_entry_or_null(&buf->rb_all_mrs,
+                                             struct rpcrdma_mr,
+                                             mr_all)) != NULL) {
                list_del(&mr->mr_all);
                list_del(&mr->mr_all);
-
                spin_unlock(&buf->rb_mrlock);
 
                spin_unlock(&buf->rb_mrlock);
 
-               /* Ensure MW is not on any rl_registered list */
-               if (!list_empty(&mr->mr_list))
-                       list_del(&mr->mr_list);
-
                frwr_release_mr(mr);
                count++;
                spin_lock(&buf->rb_mrlock);
        }
        spin_unlock(&buf->rb_mrlock);
        r_xprt->rx_stats.mrs_allocated = 0;
                frwr_release_mr(mr);
                count++;
                spin_lock(&buf->rb_mrlock);
        }
        spin_unlock(&buf->rb_mrlock);
        r_xprt->rx_stats.mrs_allocated = 0;
-
-       dprintk("RPC:       %s: released %u MRs\n", __func__, count);
 }
 
 /**
 }
 
 /**
index eaf6b907a76ece5c2faafaaae2c504f74c3b01ac..5aaa53b8ae1232e768c8bf42af0e5b5ab9c8a1d1 100644 (file)
@@ -360,7 +360,7 @@ rpcrdma_mr_pop(struct list_head *list)
 struct rpcrdma_buffer {
        spinlock_t              rb_mrlock;      /* protect rb_mrs list */
        struct list_head        rb_mrs;
 struct rpcrdma_buffer {
        spinlock_t              rb_mrlock;      /* protect rb_mrs list */
        struct list_head        rb_mrs;
-       struct list_head        rb_all;
+       struct list_head        rb_all_mrs;
 
        unsigned long           rb_sc_head;
        unsigned long           rb_sc_tail;
 
        unsigned long           rb_sc_head;
        unsigned long           rb_sc_tail;