]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
libceph: drop ceph_con_get/put helpers and nref member
authorSage Weil <sage@inktank.com>
Thu, 21 Jun 2012 19:49:23 +0000 (12:49 -0700)
committerAlex Elder <elder@inktank.com>
Fri, 22 Jun 2012 13:13:45 +0000 (08:13 -0500)
These are no longer used.  Every ceph_connection instance is embedded in
another structure, and refcounts manipulated via the get/put ops.

Signed-off-by: Sage Weil <sage@inktank.com>
include/linux/ceph/messenger.h
net/ceph/messenger.c

index a334dbd1b32403119a49f4d42ef4ccc06efbe2cb..cc6f9bdcf466c314c3cdaa212b29153b9d3b2b31 100644 (file)
@@ -135,7 +135,6 @@ struct ceph_msg_pos {
  */
 struct ceph_connection {
        void *private;
-       atomic_t nref;
 
        const struct ceph_connection_operations *ops;
 
index fc0cee7c9aa248a85c1d377b2d01d51c05bdf923..ab690e2e1206582f04a1f0e542ee696f612e0958 100644 (file)
@@ -500,30 +500,6 @@ bool ceph_con_opened(struct ceph_connection *con)
        return con->connect_seq > 0;
 }
 
-/*
- * generic get/put
- */
-struct ceph_connection *ceph_con_get(struct ceph_connection *con)
-{
-       int nref = __atomic_add_unless(&con->nref, 1, 0);
-
-       dout("con_get %p nref = %d -> %d\n", con, nref, nref + 1);
-
-       return nref ? con : NULL;
-}
-
-void ceph_con_put(struct ceph_connection *con)
-{
-       int nref = atomic_dec_return(&con->nref);
-
-       BUG_ON(nref < 0);
-       if (nref == 0) {
-               BUG_ON(con->sock);
-               kfree(con);
-       }
-       dout("con_put %p nref = %d -> %d\n", con, nref + 1, nref);
-}
-
 /*
  * initialize a new connection.
  */
@@ -535,7 +511,6 @@ void ceph_con_init(struct ceph_connection *con, void *private,
        memset(con, 0, sizeof(*con));
        con->private = private;
        con->ops = ops;
-       atomic_set(&con->nref, 1);
        con->msgr = msgr;
 
        con_sock_state_init(con);
@@ -1951,8 +1926,7 @@ static int try_write(struct ceph_connection *con)
 {
        int ret = 1;
 
-       dout("try_write start %p state %lu nref %d\n", con, con->state,
-            atomic_read(&con->nref));
+       dout("try_write start %p state %lu\n", con, con->state);
 
 more:
        dout("try_write out_kvec_bytes %d\n", con->out_kvec_bytes);