From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Elder Subject: [PATCH 11/12] libceph: make ceph_con_get() (etc.) private Date: Thu, 21 Jun 2012 09:22:45 -0500 Message-ID: <4FE32E35.3000807@inktank.com> References: <4FE32C84.2050408@inktank.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from mail-gg0-f174.google.com ([209.85.161.174]:59948 "EHLO mail-gg0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754378Ab2FUOWq (ORCPT ); Thu, 21 Jun 2012 10:22:46 -0400 Received: by mail-gg0-f174.google.com with SMTP id u4so497540ggl.19 for ; Thu, 21 Jun 2012 07:22:46 -0700 (PDT) In-Reply-To: <4FE32C84.2050408@inktank.com> Sender: ceph-devel-owner@vger.kernel.org List-ID: To: ceph-devel@vger.kernel.org The functions ceph_con_get() and ceph_con_put() are both only ever used in "net/ceph/messenger.c", so change them to have static scope. Move their definition up in the source file so they're both defined before their first use. Signed-off-by: Alex Elder --- include/linux/ceph/messenger.h | 2 - net/ceph/messenger.c | 48 ++++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 26 deletions(-) Index: b/include/linux/ceph/messenger.h =================================================================== --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h @@ -245,8 +245,6 @@ extern void ceph_msg_revoke(struct ceph_ extern void ceph_msg_revoke_incoming(struct ceph_msg *msg); extern void ceph_con_keepalive(struct ceph_connection *con); -extern struct ceph_connection *ceph_con_get(struct ceph_connection *con); -extern void ceph_con_put(struct ceph_connection *con); extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, bool can_fail); Index: b/net/ceph/messenger.c =================================================================== --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -408,6 +408,30 @@ static int con_close_socket(struct ceph_ } /* + * generic get/put + */ +static 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; +} + +static 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); +} + +/* * Reset a connection. Discard all incoming and outgoing messages * and clear *_seq state. */ @@ -504,30 +528,6 @@ bool ceph_con_opened(struct ceph_connect } /* - * 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. */ void ceph_con_init(struct ceph_connection *con, void *private,