aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph/messenger.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ceph/messenger.c')
-rw-r--r--net/ceph/messenger.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index fc0cee7c9aa2..ab690e2e1206 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -501,30 +501,6 @@ bool ceph_con_opened(struct ceph_connection *con)
501} 501}
502 502
503/* 503/*
504 * generic get/put
505 */
506struct ceph_connection *ceph_con_get(struct ceph_connection *con)
507{
508 int nref = __atomic_add_unless(&con->nref, 1, 0);
509
510 dout("con_get %p nref = %d -> %d\n", con, nref, nref + 1);
511
512 return nref ? con : NULL;
513}
514
515void ceph_con_put(struct ceph_connection *con)
516{
517 int nref = atomic_dec_return(&con->nref);
518
519 BUG_ON(nref < 0);
520 if (nref == 0) {
521 BUG_ON(con->sock);
522 kfree(con);
523 }
524 dout("con_put %p nref = %d -> %d\n", con, nref + 1, nref);
525}
526
527/*
528 * initialize a new connection. 504 * initialize a new connection.
529 */ 505 */
530void ceph_con_init(struct ceph_connection *con, void *private, 506void ceph_con_init(struct ceph_connection *con, void *private,
@@ -535,7 +511,6 @@ void ceph_con_init(struct ceph_connection *con, void *private,
535 memset(con, 0, sizeof(*con)); 511 memset(con, 0, sizeof(*con));
536 con->private = private; 512 con->private = private;
537 con->ops = ops; 513 con->ops = ops;
538 atomic_set(&con->nref, 1);
539 con->msgr = msgr; 514 con->msgr = msgr;
540 515
541 con_sock_state_init(con); 516 con_sock_state_init(con);
@@ -1951,8 +1926,7 @@ static int try_write(struct ceph_connection *con)
1951{ 1926{
1952 int ret = 1; 1927 int ret = 1;
1953 1928
1954 dout("try_write start %p state %lu nref %d\n", con, con->state, 1929 dout("try_write start %p state %lu\n", con, con->state);
1955 atomic_read(&con->nref));
1956 1930
1957more: 1931more:
1958 dout("try_write out_kvec_bytes %d\n", con->out_kvec_bytes); 1932 dout("try_write out_kvec_bytes %d\n", con->out_kvec_bytes);